/* Mirror shares Slirdle's tokens, spacing scale, dialogs and results, so the two games read as siblings. */
@layer components  {
  /* The start screen shows two empty pictures where the board will be. */
  .empty-pictures  {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
    width: min(100%, 420px);
    margin: var(--s7) auto;
  }
  .empty-pictures span  {
    aspect-ratio: 4 / 3;
    border: var(--stroke) dashed var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
  }
  /* Game page */
  /* The actions sit out of flow, so the pictures keep their vertical budget. */
  .mirror .game-intro  {
    margin-bottom: var(--s4);
  }
  .mirror .game-intro h1 {
    font-weight: var(--weight-bold);
  }
  .mirror .scorebar  {
    max-width: var(--play-max);
    margin: var(--s0) auto var(--s4);
  }
  .mirror .found-count  {
    color: var(--muted);
  }
  /* Pictures: stacked and full width on a phone, side by side from 960px. Both keep the scene's 4:3 shape. */
  .mirror .pictures  {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
  }
  /* The rectangle of this element is what a tap is measured against, so it has no border or padding. */
  .mirror .picture  {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-card);
    background: var(--surface-2);
    box-shadow: 0 0 0 var(--stroke) var(--line);
    cursor: crosshair;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mirror .picture[aria-disabled="true"]  {
    cursor: default;
    opacity: 1;
  }
  .mirror .picture > svg  {
    grid-area: 1 / 1;
    display: block;
    width: 100%;
    height: 100%;
  }
  .mirror .ring-layer  {
    pointer-events: none;
    overflow: visible;
  }
  /* Rings keep the same width on screen at any size, with a dark halo so they show on light and dark art. */
  .mirror .ring, .mirror .hint-circle, .mirror .marker  {
    fill: none;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.85));
  }
  .mirror .ring  {
    stroke-width: 4px;
    transform-box: fill-box;
    transform-origin: center;
  }
  .mirror .ring.found  {
    stroke: var(--correct);
    animation: mirror-ring-in var(--reveal-duration) var(--ease);
  }
  /* A missed difference is dashed in another colour, so it never reads as a find. */
  .mirror .ring.missed  {
    stroke: var(--present);
    stroke-dasharray: 10 6;
  }
  /* In a team game each find takes its finder's colour, the same colours as Slirdle's team markers. */
  .mirror .ring.found.finder-1, .mirror .finder-dot.finder-1  {
    stroke: #087bb5;
    background: #087bb5;
  }
  .mirror .ring.found.finder-2, .mirror .finder-dot.finder-2  {
    stroke: #ba5a00;
    background: #ba5a00;
  }
  .mirror .ring.found.finder-3, .mirror .finder-dot.finder-3  {
    stroke: #b0307a;
    background: #b0307a;
  }
  .mirror .finder-dot  {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 50%;
  }
  .mirror .team-finds  {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .mirror .team-reconnecting  {
    text-align: center;
    font-weight: var(--weight-heavy);
    color: var(--accent);
  }
  .mirror .pictures[data-reconnecting] .picture  {
    opacity: 0.6;
  }
  .mirror .hint-circle  {
    fill: color-mix(in srgb, var(--accent) 16%, transparent);
    stroke: var(--accent);
    stroke-width: 3px;
    stroke-dasharray: 2 8;
    stroke-linecap: round;
    animation: mirror-reveal var(--reveal-duration) var(--ease);
  }
  .mirror .marker circle, .mirror .marker path  {
    fill: none;
    stroke: var(--focus);
    stroke-width: 6;
  }
  .mirror .penalty  {
    font: var(--weight-heavy) 64px var(--font-display);
    fill: #ffffff;
    stroke: #9f1d1d;
    stroke-width: 12px;
    paint-order: stroke;
    animation: mirror-penalty 1600ms var(--ease) forwards;
  }
  :root[data-contrast="true"] .mirror .ring  {
    stroke-width: 6px;
  }
  /* Each wrong tap switches between two identical animations, so the shake starts again. */
  .mirror .picture.shake-odd  {
    animation: picture-shake-odd var(--reveal-duration) var(--ease);
  }
  .mirror .picture.shake-even  {
    animation: picture-shake-even var(--reveal-duration) var(--ease);
  }
  .mirror .play-actions  {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s4);
    margin: var(--s6) var(--s0) var(--s2);
  }
  .mirror .hint-button  {
    display: inline-flex;
    gap: var(--s4);
    align-items: baseline;
  }
  .mirror .hint-button small  {
    color: var(--muted);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
  }
  .mirror .view-results  {
    width: 100%;
    max-width: var(--play-max);
  }
  .mirror .confirm-actions  {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s4);
  }
  /* Motion */
  @keyframes mirror-reveal  {
    0%  {
      opacity: 0.6;
    }
    100%  {
      opacity: 1;
    }
  }
  @keyframes mirror-ring-in  {
    from  {
      opacity: 0;
      transform: scale(1.4);
    }
    to  {
      opacity: 1;
      transform: scale(1);
    }
  }
  @keyframes mirror-penalty  {
    0%  {
      opacity: 1;
      transform: translateY(0);
    }
    100%  {
      opacity: 0;
      transform: translateY(-60px);
    }
  }
  @keyframes picture-shake-odd  {
    25%, 75%  {
      transform: translateX(calc(-1 * var(--s2)));
    }
    50%  {
      transform: translateX(var(--s2));
    }
  }
  @keyframes picture-shake-even  {
    25%, 75%  {
      transform: translateX(calc(-1 * var(--s2)));
    }
    50%  {
      transform: translateX(var(--s2));
    }
  }
  /* Below 960px the game buttons share the title's row, so the title moves left of them, as in Slirdle. */
  /* A phone gives the pictures the full width of the screen. */
  @media (max-width: 599px)  {
    .mirror .pictures  {
      margin-inline: calc(-1 * var(--s5));
    }
    .mirror .picture  {
      border-radius: 0;
    }
  }
  @media (min-width: 960px)  {
    .empty-pictures  {
      grid-template-columns: 1fr 1fr;
      width: min(100%, 840px);
    }
    .mirror .pictures  {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--s6);
    }
    .mirror dialog.results .dialog-panel > :not(.close-form):not(.share):not(.countdown):not(.result-actions):not(#install-pill)  {
      grid-column: 1;
      margin-block: 4px;
    }
    .mirror dialog.results .dialog-panel > .share  {
      grid-column: 2;
      grid-row: 1 / span 7;
      margin: 0;
    }
    .mirror dialog.results .dialog-panel > .countdown  {
      grid-column: 2;
      grid-row: 8;
      margin: 0;
    }
    .mirror dialog.results .dialog-panel > .result-actions  {
      grid-column: 1 / -1;
      grid-template-columns: repeat(3, 1fr);
      position: static;
      margin: 12px 0 0;
      padding: 0;
      border: 0;
    }
  }
  .mirror-pause-frame  {
    min-height: min(70vh, 48rem);
  }
}
