/* Double Drop. Existing tokens and values only (spec D10, listed for design review in
   docs/follow-ups.md). The board is dark grey in both themes, with one slightly lighter cell for
   each place a block can sit: the dark theme's wall and surface-2 values, fixed so the block tones
   read the same in either theme. Above the board, the chute holds the current block over the
   cursor column. Blocks are slots of 1/5 by 1/8 of the board, placed with the translate property
   from --c and --r (row 7 is the chute), so animations (anim.js) move them in percentages and
   scale them around their own center (translate moves the block after it is scaled). */

.g-drop { padding-block: var(--s3) var(--s7); }
.g-drop__intro { margin-bottom: var(--s3); }
.g-drop__intro h1 { font-size: 24px; }
.g-drop__intro p { margin-top: var(--s1); max-width: 60ch; }
.g-drop__note { margin-bottom: var(--s3); }

/* ---------- game card ---------- */
.g-drop__game { max-width: 460px; display: grid; gap: var(--s3); padding: var(--s3); }
@media (min-width: 400px) { .g-drop__game { padding: var(--s4); } }
.g-drop__game:focus { outline: none; }
.g-drop__bar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s2) var(--s4); }
.g-drop__bar .stat { min-width: 64px; }
.g-drop__bar-actions { margin-left: auto; display: flex; gap: var(--s2); }
.g-drop__bar-actions .btn { touch-action: manipulation; }

/* ---------- board ---------- */
.g-drop__stage { position: relative; }
.g-drop__board {
  --gap: clamp(4px, 1.6cqi, 8px);
  --board: #0E1014; /* dark theme --wall */
  --cell: #20242B; /* dark theme --surface-2 */
  --board-ink: #F2F3F5; /* dark theme --ink */
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 5 / 8;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.g-drop__cells {
  position: absolute; inset: 12.5% 0 0; border-radius: 12px; background: var(--board);
  display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(7, 1fr);
}
/* each cell lines up with a block's face: a slot less the block's padding */
.g-drop__cells span { margin: var(--gap); border-radius: 8px; background: var(--cell); }
.g-drop__blocks, .g-drop__floats { position: absolute; inset: 0; pointer-events: none; }
.g-drop__floats { z-index: 2; }
/* D7: the chain counter floats over the board's top edge, so it never moves the board */
.g-drop__chain { position: absolute; z-index: 2; left: 50%; top: 12.5%; translate: -50% -50%; pointer-events: none; }
.g-drop__chain[hidden] { display: none; }

.g-drop__block {
  position: absolute; left: 0; top: 0; width: 20%; height: 12.5%; padding: var(--gap); z-index: 1;
  translate: calc(var(--c) * 100%) calc((7 - var(--r)) * 100%);
}
.g-drop__face {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 8px;
  font-weight: 800; font-stretch: 100%; line-height: 1; font-variant-numeric: tabular-nums;
  font-size: calc(20cqi * 0.36);
}
.g-drop__face.is-long { font-size: calc(20cqi * 0.3); font-stretch: 87.5%; }
.g-drop__block.is-light .g-drop__face { background: var(--light); color: var(--deep); }
.g-drop__block.is-field .g-drop__face { background: var(--field); color: var(--on); }
.g-drop__current[hidden] { display: none; }

.g-drop__float {
  position: absolute; left: 0; top: 0; width: 20%; height: 12.5%;
  translate: calc(var(--c) * 100%) calc((7 - var(--r)) * 100%);
  display: grid; place-items: center; opacity: 0;
  font-weight: 800; font-size: calc(20cqi * 0.26); color: var(--board-ink);
}

/* Column buttons over the whole height: tap to drop (D9). Transparent: the current block above the
   board shows the cursor or hovered column. Keyboard focus rings that block instead of outlining the
   column. touch-action: manipulation drops the double-tap delay; pinch-zoom still works. */
.g-drop__cols { position: absolute; inset: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr); }
.g-drop__col {
  appearance: none; border: 0; margin: 0; padding: 0; background: transparent; border-radius: 10px;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.g-drop__col:focus, .g-drop__col:focus-visible { outline: none; box-shadow: none; } /* the ring is on the current block */
.g-drop__board:has(.g-drop__col:focus-visible) .g-drop__current .g-drop__face { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- game-over panel, over the board ---------- */
.g-drop__panel { inset: 0; align-content: center; padding: var(--s5); }
.g-drop__panel[hidden] { display: none; }
.g-drop__over { justify-items: stretch; text-align: left; }
.g-drop__over .fig dd { font-size: 24px; }
.g-drop__over .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--s3); }
.g-drop__over h2:focus { outline: none; }
.g-drop__over p { font-size: 15px; font-weight: 500; font-stretch: 100%; margin-top: var(--s3); }

/* ---------- below the board: the spawn window (D8), statistics and settings ---------- */
.g-drop__window { text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.g-drop__tools { display: flex; justify-content: center; gap: var(--s2); }

/* ---------- dialogs ---------- */
.g-drop__dlg .fig dd { font-size: 22px; }
.g-drop__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s3); }
.g-drop__reset { margin-top: var(--s5); }
.g-drop__reset p { font-weight: 600; }
.g-drop__settings { display: grid; gap: var(--s3); }
.g-drop__choice { border: 0; padding: 0; margin: 0; }
.g-drop__choice legend { font-weight: 600; padding: 0; }
.g-drop__choice label { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; }
.g-drop__choice input { flex: none; width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }

/* ---------- text below the game ---------- */
.g-drop__about { max-width: 62ch; margin-top: var(--s6); }
.g-drop__about h2 { margin: var(--s6) 0 var(--s3); }
.g-drop__about h2:first-child { margin-top: 0; }
.g-drop__about ol { padding-left: 1.25em; margin: var(--s3) 0; }
.g-drop__about li + li { margin-top: 6px; }
.g-drop__keys { border-collapse: collapse; font-size: 15px; }
.g-drop__keys th, .g-drop__keys td { text-align: left; padding: 6px var(--s4) 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.g-drop__keys th { font-weight: 600; white-space: nowrap; }
