/* ==========================================================
   BPRO | Findet Amy
   Fullscreen-Wimmelbild auf team.html.
   ========================================================== */

body.amy-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.amy-modal[hidden] {
  display: none !important;
}

.amy-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: stretch;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.amy-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.amy-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.amy-modal__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--color-surface-1);
  transform: none;
  transition: none;
}

.amy-modal.is-open .amy-modal__dialog {
  transform: none;
}

.amy-modal__header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px 14px 20px;
  border-bottom: 0;
}

.amy-modal__title-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.amy-modal__paw {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.amy-modal__kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--color-text-dim);
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
}

.amy-modal__header h2 {
  margin: 0;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1;
  font-weight: 680;
}

.amy-modal__close {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.amy-modal__close:hover,
.amy-modal__close:focus-visible {
  border-color: rgba(255, 255, 255, 0.36);
  background: var(--surface-hover);
}

.amy-modal__close span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.amy-modal__close span:first-child {
  transform: translate(-50%, -50%) rotate(45deg);
}

.amy-modal__close span:last-child {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ---------- Spielfläche ---------- */

.amy-game {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0 10px 10px;
  overflow: hidden;
}

.amy-game__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: calc(var(--radius, 20px) - 7px);
  background: var(--color-text);
  cursor: default;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.amy-game__viewport.is-dragging {
  cursor: default;
}

.amy-game__canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 1600px;
  height: 900px;
  transform-origin: 0 0;
  will-change: transform;
  contain: strict;
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.amy-game__canvas.is-animating {
  transition: transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.amy-game__svg-host,
.amy-game__svg {
  display: block;
  width: 100%;
  height: 100%;
}

.amy-game__svg-host {
  position: absolute;
  inset: 0;
  contain: strict;
}

.amy-game__svg {
  overflow: visible;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;

  /* Die Zeichenqualität bleibt auch beim Klicken, Ziehen und Zoomen
     unverändert. optimizeSpeed ließ die feinen Illustrator-Outlines
     während einer Interaktion sichtbar dünner erscheinen. */
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

/* Die schwarzen Outlines liegen in der SVG über den Farbflächen.
   Sie bleiben sichtbar, dürfen die darunterliegenden Hitboxen aber
   nicht blockieren. */
.amy-game__svg [data-amy-outlines] {
  pointer-events: none;
}

/* Alle Farbgruppen sind zunächst unsichtbar. Erst die gefundene
   Dog-Gruppe blendet ihre eigene Colour-Ebene ein. */
.amy-game__svg [data-amy-colour] {
  display: none !important;
  pointer-events: none;
}

.amy-game__svg [data-amy-dog].is-found [data-amy-colour] {
  display: inline !important;
}

/* Illustrator exportiert die Hitboxen mit fill:none. Eine vollständig
   ungefüllte SVG-Fläche ist nicht zuverlässig anklickbar, deshalb wird
   sie transparent gefüllt und ausdrücklich für Pointer aktiviert. */
.amy-game__svg [data-amy-hitbox] {
  fill: transparent !important;
  stroke: transparent;
  stroke-width: 0;
  pointer-events: all;
  cursor: default;
  outline: none;
  touch-action: none;
}

.amy-game__svg [data-amy-dog].is-found [data-amy-hitbox] {
  pointer-events: none;
  cursor: default;
}

.amy-game__svg [data-amy-hitbox]:focus-visible {
  stroke: var(--color-text);
  stroke-width: 8px;
  vector-effect: non-scaling-stroke;
}

.amy-game__svg [data-amy-hitbox].is-hinting {
  animation: amy-svg-hint 780ms ease-out 2;
  stroke: var(--color-text);
  stroke-width: 11px;
  vector-effect: non-scaling-stroke;
}

@keyframes amy-svg-hint {
  0% { stroke-opacity: 0; }
  32% { stroke-opacity: 1; }
  100% { stroke-opacity: 0; }
}

.amy-game__status[hidden] {
  display: none !important;
}

.amy-game__status {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  background: var(--color-text);
  color: var(--color-surface-2);
  text-align: center;
  pointer-events: none;
}

.amy-game__status.is-error {
  color: #6d1717;
}

.amy-game__spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(0, 0, 0, 0.16);
  border-top-color: var(--color-surface-2);
  border-radius: 50%;
  animation: amy-spinner 720ms linear infinite;
}

.amy-game__status.is-error .amy-game__spinner {
  display: none;
}

@keyframes amy-spinner {
  to { transform: rotate(360deg); }
}

/* ---------- Steuerung im Bild ---------- */

.amy-toolbar {
  position: absolute;
  top: clamp(10px, 1.4vw, 18px);
  right: clamp(10px, 1.4vw, 18px);
  left: clamp(10px, 1.4vw, 18px);
  z-index: 20;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.amy-toolbar__progress,
.amy-toolbar__actions {
  pointer-events: auto;
}

.amy-toolbar__progress {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1;
}

.amy-toolbar__progress strong {
  color: var(--color-text);
  font-size: 15px;
}

.amy-toolbar__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.amy-toolbar .button {
  min-height: 44px;
  padding: 11px 16px;
  border-color: var(--border-soft);
  background: var(--color-bg);
  color: var(--color-text);
}

.amy-action-button {
  display: inline-flex;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

.amy-action-button__icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.amy-action-button__label {
  display: none;
}

.amy-game__help-mobile {
  display: none;
}

.amy-game__help {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 15;
  margin: 0;
  padding: 8px 11px;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 320ms ease, transform 320ms ease, visibility 320ms ease;
}

.amy-game__help.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
}

/* ---------- Abschlussmeldung ---------- */

.amy-complete[hidden] {
  display: none !important;
}

.amy-complete {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  isolation: isolate;
}

.amy-complete__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, var(--surface-glass), transparent 34%),
    rgba(5, 5, 5, 0.82);
  animation: amy-complete-backdrop-in 360ms ease both;
}

.amy-complete__dialog {
  position: relative;
  z-index: 1;
  width: min(590px, 100%);
  overflow: hidden;
  padding: clamp(30px, 5vw, 54px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-dialog);
  background:
    radial-gradient(circle at 50% -8%, rgba(255, 255, 255, 0.15), transparent 34%),
    linear-gradient(145deg, var(--color-surface-3) 0%, #090909 62%, var(--color-bg) 100%);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 var(--surface-glass);
  text-align: center;
  animation: amy-complete-dialog-in 520ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.amy-complete__dialog::before {
  content: "";
  position: absolute;
  pointer-events: none;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
}


.amy-complete__visual {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 24px;
}

.amy-complete__score {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.17), transparent 34%),
    rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.025),
    0 18px 42px rgba(0, 0, 0, 0.34);
}

.amy-complete__score::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: inherit;
  clip-path: polygon(0 0, 100% 0, 100% 76%, 68% 100%, 0 100%);
  animation: amy-complete-ring-in 760ms 140ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.amy-complete__paw {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 27px;
  height: 27px;
  color: rgba(255, 255, 255, 0.7);
  transform: translateX(-50%);
}

.amy-complete__score-value {
  display: block;
  margin-top: 21px;
  color: var(--color-text);
  font-size: 41px;
  font-weight: 720;
  line-height: 0.88;
  letter-spacing: -0.045em;
}

.amy-complete__score-total {
  display: block;
  margin-top: 7px;
  color: var(--color-text-dim);
  font-size: 11px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.amy-complete__check {
  position: absolute;
  right: -2px;
  bottom: 8px;
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 4px solid #0b0b0b;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  animation: amy-complete-check-in 440ms 390ms cubic-bezier(0.18, 0.82, 0.24, 1.25) both;
}

.amy-complete__kicker {
  display: inline-block;
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 620;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.amy-complete h2 {
  max-width: 470px;
  margin: 0 auto;
  font-size: clamp(36px, 5.6vw, 62px);
  font-weight: 650;
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.amy-complete p {
  max-width: 430px;
  margin: 18px auto 0;
  color: var(--color-text-muted);
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.5;
  text-wrap: balance;
}

.amy-complete__time {
  display: grid;
  justify-items: center;
  gap: 5px;
  width: min(260px, 100%);
  margin: 27px auto 0;
  padding: 15px 20px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.amy-complete__time span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
  font-weight: 610;
  line-height: 1;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.amy-complete__time strong {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 680;
  line-height: 1;
  letter-spacing: -0.035em;
}

.amy-confetti {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.amy-confetti i {
  position: absolute;
  top: -24px;
  left: var(--amy-confetti-x);
  width: var(--amy-confetti-width);
  height: var(--amy-confetti-height);
  border-radius: 2px;
  background: hsl(var(--amy-confetti-hue) 88% 64%);
  box-shadow: 0 0 10px hsl(var(--amy-confetti-hue) 88% 64% / 0.28);
  opacity: 0;
  will-change: transform, opacity;
  animation: amy-confetti-fall var(--amy-confetti-duration) var(--amy-confetti-delay) cubic-bezier(0.18, 0.72, 0.34, 1) forwards;
}

.amy-complete__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 27px;
}

.amy-complete__actions .button {
  min-width: 168px;
}

@keyframes amy-complete-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes amy-complete-dialog-in {
  from { opacity: 0; transform: translateY(24px) scale(0.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes amy-complete-ring-in {
  from { opacity: 0; transform: rotate(-42deg) scale(0.82); }
  to { opacity: 1; transform: rotate(0deg) scale(1); }
}

@keyframes amy-complete-check-in {
  from { opacity: 0; transform: scale(0.35) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes amy-confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -16px, 0) rotate(0deg);
  }
  9% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--amy-confetti-drift), var(--amy-confetti-fall), 0) rotate(var(--amy-confetti-rotate));
  }
}

@media (max-width: 820px) {
  .amy-modal__header {
    padding: 10px 10px 10px 14px;
  }

  .amy-modal__paw {
    width: 28px;
    height: 28px;
  }

  .amy-game {
    padding: 0 6px 6px;
  }

  .amy-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .amy-toolbar__actions {
    width: auto;
    justify-self: end;
    gap: 8px;
  }

  .amy-toolbar .button {
    min-height: 40px;
    padding: 10px 13px;
    font-size: 13px;
    white-space: nowrap;
  }

  .amy-toolbar .amy-action-button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 50%;
  }

  .amy-action-button__icon {
    width: 23px;
    height: 23px;
  }

}

@media (max-width: 640px), (hover: none) and (pointer: coarse) and (max-width: 900px) {
  .amy-modal {
    padding: 0;
  }

  .amy-modal__dialog {
    height: 100dvh;
    border-radius: 0;
  }

  .amy-modal__kicker {
    display: none;
  }

  .amy-modal__header {
    min-height: 58px;
    padding: 8px 8px 8px 12px;
  }

  .amy-modal__close {
    width: 40px;
    height: 40px;
  }

  .amy-toolbar {
    top: 8px;
    right: 8px;
    bottom: auto;
    left: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    pointer-events: none;
  }

  .amy-toolbar__progress {
    width: max-content;
    min-height: 40px;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid var(--border-soft);
    background: var(--color-bg);
    pointer-events: auto;
  }

  .amy-toolbar__progress strong {
    font-size: 14px;
  }

  .amy-toolbar__actions {
    display: flex;
    width: auto;
    gap: 6px;
    pointer-events: auto;
  }

  .amy-toolbar .amy-action-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .amy-action-button__icon {
    width: 23px;
    height: 23px;
  }

  .amy-action-button__label {
    display: none;
  }

  .amy-game__help {
    top: 56px;
    right: 8px;
    bottom: auto;
    left: auto;
    display: block;
    width: min(210px, calc(100% - 16px));
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 13px;
    background: var(--color-bg);
    font-size: 11px;
    line-height: 1.3;
    text-align: right;
  }

  .amy-game__help-desktop {
    display: none;
  }

  .amy-game__help-mobile {
    display: inline;
  }

  .amy-complete {
    padding: 14px;
  }

  .amy-complete__dialog {
    padding: 28px 20px 22px;
    border-radius: 22px;
  }

  .amy-complete__visual {
    width: 112px;
    height: 112px;
    margin-bottom: 20px;
  }

  .amy-complete__paw {
    top: 16px;
    width: 24px;
    height: 24px;
  }

  .amy-complete__score-value {
    margin-top: 18px;
    font-size: 36px;
  }

  .amy-complete__time {
    width: min(230px, 100%);
    margin-top: 22px;
    padding: 13px 16px 14px;
  }

  .amy-complete__actions {
    display: grid;
    margin-top: 22px;
  }

  .amy-complete__actions .button {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amy-modal,
  .amy-modal__dialog,
  .amy-game__canvas {
    transition: none !important;
  }

  .amy-game__spinner,
  .amy-game__svg [data-amy-hitbox].is-hinting,
  .amy-complete__backdrop,
  .amy-complete__dialog,
  .amy-complete__score::before,
  .amy-complete__check,
  .amy-confetti i {
    animation: none !important;
  }
}
