/*
 * The Arcade tile: one ordinary card near the foot of the desktop. Its picture is the game itself: a still frame
 * (assets/art/arcade-still.png) and, when motion is welcome, a short silent clip of play on a canvas (arcade-attract.js)
 * with a button to stop it. Beside it the game's name and one line about it, the saved best score when there is one, and a
 * Play button. Words come from arcade-meta.js; markup is in index.html; arcade-tile.js fills in the live parts.
 */
.arcadeTile .mark { background: linear-gradient(150deg, #3b56b8, #111a48); color: #ffd45a; }
#grid > #arcade { display: flex; flex-direction: column; }

.arcadeBody { display: flex; flex: 1 0 auto; flex-direction: column; gap: 10px; padding: 12px 14px 14px; min-width: 0; }
.arcadePreview { position: relative; flex: 1 0 auto; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 12px; background: #0c1233; box-shadow: inset 0 0 0 1px rgba(122, 160, 255, .35); }
/* The still frame and the clip fill the same box the same way, keeping the ground in view. */
.arcadeStill, .arcadeClip { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 100%; image-rendering: pixelated; }
.arcadeClip[hidden] { display: none; }
.arcadeMotion { position: absolute; z-index: 2; left: 8px; bottom: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #ffffff66; border-radius: 50%; background: rgba(7, 11, 34, .82); color: #fff; cursor: pointer; }
.arcadeMotion[hidden] { display: none; }
.arcadeMotion svg { display: block; fill: currentColor; }
.arcadeMotion .arcadeIconPlay, .arcadeMotion[data-paused="true"] .arcadeIconPause { display: none; }
.arcadeMotion[data-paused="true"] .arcadeIconPlay { display: inline; }
.arcadeMotion:hover { background: #1a2766; }
.arcadeMotion:focus-visible { outline: 3px solid #ffd45a; outline-offset: 1px; }

.arcadeInfo { display: grid; align-content: start; gap: 3px; min-width: 0; }
.arcadeInfo p { margin: 0; overflow-wrap: anywhere; }
.arcadeName { font-size: 1.25rem; font-weight: 700; line-height: 1.2; color: var(--ink); }
.arcadeTagline { font-size: .875rem; line-height: 1.4; color: var(--ink); }
.arcadeHow { font-size: .8125rem; line-height: 1.4; color: var(--muted); }
/* The best-score line keeps its place (blank) until there is a score, so nothing below the picture shifts when it appears. */
.arcadeBest { min-height: 1.5em; justify-self: start; margin-top: 2px; font-size: .8125rem; font-weight: 600; line-height: 1.5; color: var(--accent-ink, var(--accent)); font-variant-numeric: tabular-nums; }
.arcadeBest[hidden] { display: block; visibility: hidden; }
.arcadePlay { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-width: 104px; min-height: 44px; padding: 0 24px; border: 1px solid #5a6fd0; border-radius: 12px; background: linear-gradient(150deg, #3b56b8, #111a48); color: #ffd45a; font-size: 1rem; font-weight: 700; line-height: 1; cursor: pointer; }
.arcadePlay[hidden] { display: inline-flex; visibility: hidden; }
.arcadePlay:hover { background: linear-gradient(150deg, #4a67cc, #1a2766); }
.arcadePlay:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#grid .tile.arcadeTile button.arcadePlay { min-height: 44px; }

/*
 * The laptop-sized desktop: one quarter-width, one-row card. The picture fills the card under its title bar; the score and
 * Play sit over the sky, the line about the game over the ground, so the player in between stays in view. The name is in
 * the title bar there, so the second copy of it and the controls line are left to screen readers (the game's own "How to
 * play" shows the controls).
 */
@media (min-width: 1240px) {
  #grid > #arcade > .arcadeBody { position: relative; display: grid; flex: 1 1 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0; min-height: 0; padding: 0; }
  #grid > #arcade .arcadePreview { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
  /* The picture ends where the caption band begins (48px: two lines of the tagline, or the pause button and its margins), so the player is never under it. */
  #grid > #arcade :is(.arcadeStill, .arcadeClip) { height: calc(100% - 48px); }
  #grid > #arcade .arcadeInfo { display: contents; }
  #grid > #arcade :is(.arcadeName, .arcadeHow) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #grid > #arcade .arcadeBest { z-index: 1; grid-area: 1 / 1; align-self: start; margin: 8px 0 0 8px; min-height: 0; padding: 2px 8px; border-radius: 8px; background: rgba(7, 11, 34, .82); color: #ffd45a; font-size: .75rem; }
  #grid > #arcade .arcadePlay { z-index: 1; grid-area: 1 / 2; align-self: start; min-width: 76px; margin: 8px 8px 0 6px; padding: 0 18px; box-shadow: 0 3px 10px #0007; }
  #grid > #arcade .arcadePlay:focus-visible { outline-color: #ffd45a; }
  #grid > #arcade .arcadeTagline { z-index: 1; grid-area: 3 / 1 / 4 / 3; padding: 8px 10px 8px 48px; background: linear-gradient(#070b22d9, #070b22f2); color: #fff; font-size: .75rem; line-height: 1.35; text-wrap: balance; pointer-events: none; }

  /*
   * With the built-in order at the foot of the desktop (live stats, three cards, the Arcade), the Arcade tucks under live
   * stats and its three neighbours stand two rows tall beside the pair, so the last rows are full. A visitor who has
   * arranged those cards differently keeps ordinary heights, and with live stats switched off the four make one full row.
   */
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > :is(#assistant, #miro, #photos) { grid-row: span 2; }
  /* Two rows leave room for what the one-row cards had to leave out: the Miro mark and the photo card's explanation. */
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > #miro .providerpreview { flex-direction: column; gap: 12px; }
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > #miro .providericon { display: grid; }
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > #photos .photoempty :is(.photosymbol, p) { display: block; }
}

/* A tablet: tiles are half or quarter width, so live stats and the three cards share one row, and the Arcade pairs with Photos. */
@media (min-width: 1001px) and (max-width: 1239px) {
  .arcadePreview { aspect-ratio: 2; } /* half the desktop wide here: a shallower picture keeps Photos beside it from growing too tall */
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > :is(#visitors, #assistant, #miro) { grid-column: span 4; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  /* Live stats takes the half beside Freeform, so Ask Shawn with Miro and Photos with the Arcade make two full rows. */
  #grid:has(> #visitors:not([hidden]):nth-last-child(5)):has(> :is(#assistant, #miro, #photos):nth-last-child(4)):has(> :is(#assistant, #miro, #photos):nth-last-child(3)):has(> :is(#assistant, #miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > #visitors { grid-column: span 6; }
  /* With live stats switched off, Ask Shawn pairs with Freeform and the last three cards share a row. */
  #grid:has(> #visitors[hidden]):has(> :is(#miro, #photos):nth-last-child(3)):has(> :is(#miro, #photos):nth-last-child(2)):has(> #arcade:last-child) > :is(#miro, #photos, #arcade) { grid-column: span 4; }
}
@media (max-width: 1239px) {
  .arcadePlay { width: 100%; }
}
