/* ── Play (#/play) ───────────────────────────────────────────────
 * The five games, drawn with My kanji's pieces (style.css): the section is
 * a .mk, the list a .mk-list of hairline rows, the switches .seg, the keys
 * the review's .rv-kbd. Nothing here declares a colour: every one is a
 * token from base.css or style.css's :root. A right answer is lit with the
 * Collection's tile wash; a wrong one is dashed in the danger tone, and both
 * carry a mark and words, never colour alone. Nothing is fixed to the
 * viewport, because an embedded Yomu is as tall as its page (CLAUDE.md). */

.pl-games { margin-top: var(--space-4); }
.pl-games .pl-game {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.pl-game-name { font-size: var(--text-base); font-weight: 600; }
.pl-state { color: var(--text-secondary); }
.pl-start { min-width: 6rem; }

.pl-q { display: flex; flex-direction: column; gap: var(--space-3); }
.pl-prompt { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-2) 0; border-radius: var(--radius-sm); }
.pl-prompt:focus { outline: none; }
.pl-prompt:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }
.pl-prompt > * { flex: 0 1 auto; }
.pl-ask { font-size: var(--text-lg); line-height: 1.4; width: 100%; }
/* Hear it beside a short question, not on a line of its own. */
.pl-ask:has(+ .pl-hear) { width: auto; }
.pl-romaji-big { font-size: 1.75rem; font-weight: 700; letter-spacing: 0.02em; }
.pl-meaning { font-size: var(--text-lg); line-height: 1.4; overflow-wrap: anywhere; }
.pl-meaning [lang="ja"], .pl-name [lang="ja"] { font-size: 1.5rem; }
.pl-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }
.pl-name [lang="ja"] { font-size: 2.5rem; line-height: 1.2; }
.pl-word { font-size: 2.5rem; line-height: 1.3; width: 100%; }
.pl-word .pl-twin { background: var(--surface-2); color: inherit; box-shadow: inset 0 -3px 0 var(--text-secondary); padding: 0 2px; border-radius: 2px; }
.pl-romaji { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.pl-opts {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}
.pl-opts--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pl-opts--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pl-opt {
  position: relative;
  display: grid; place-items: center;
  width: 100%; min-height: 5.5rem;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  transition: background-color var(--dur), border-color var(--dur);
}
.pl-opts--wide .pl-opt { min-height: 3.5rem; }
.pl-opt:active { transform: none; }
.pl-opt .rv-kbd { position: absolute; left: 6px; top: 6px; }
.pl-ch { font-size: 2.75rem; line-height: 1; }
.pl-opt-text { font-size: var(--text-base); font-weight: 600; overflow-wrap: anywhere; text-align: center; }
@media (hover: hover) {
  .pl-opt:not([aria-disabled="true"]):hover { background: var(--surface-2); }
}
.pl-opt[aria-disabled="true"] { cursor: default; }
.pl-opt.is-right, .pl-cell.is-right { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent-bright) 55%, transparent); }
.pl-opt.is-wrong, .pl-cell.is-wrong { border-style: dashed; border-color: var(--danger-text); }
.pl-tag { position: absolute; right: 6px; top: 4px; font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); }

/* The feedback: the mark and Next on one row, the reasons under them. Next
 * comes last in the markup (the reading and tab order) and is drawn on the
 * mark's row, so the way on is never the line that falls below what a
 * host's sheet shows (CLAUDE.md, "An embedded frame is as tall as its page"). */
.pl-feedback {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-1) var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm); line-height: 1.55;
}
.pl-feedback > .pl-mark { grid-column: 1; grid-row: 1; }
.pl-feedback > .mk-actions { grid-column: 2; grid-row: 1; margin-top: 0; }
.pl-feedback > .pl-why { grid-column: 1 / -1; }
/* A found grid's feedback stands where its prompt stood, above the grid. */
.pl-feedback--top { padding-top: 0; padding-bottom: var(--space-3); border-top: 0; border-bottom: 1px solid var(--border-subtle); }
.pl-feedback:focus { outline: none; }
.pl-feedback:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }
.pl-mark { font-size: var(--text-base); font-weight: 600; }
.pl-why { overflow-wrap: anywhere; }
.pl-why [lang="ja"], .pl-kline [lang="ja"] { font-size: var(--text-base); }
.pl-kch { font-size: 1.375rem !important; }
.pl-kline { display: inline; }
.pl-wword { font-size: 1.25rem !important; }

/* Odd one out: a square grid of one character, as wide as fits. */
.pl-status { font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.pl-live { min-height: 1.5em; font-size: var(--text-sm); color: var(--text-secondary); }
.pl-grid {
  display: grid; gap: var(--space-2);
  width: 100%; max-width: 30rem;
}
.pl-grid[data-size="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pl-grid[data-size="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pl-grid[data-size="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pl-cell {
  display: grid; place-items: center;
  aspect-ratio: 1; width: 100%;
  padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary);
  font: inherit; font-size: 1.75rem; line-height: 1;
  cursor: pointer;
}
.pl-grid[data-size="6"] .pl-cell { font-size: 1.5rem; }
.pl-cell:active { transform: none; }
.pl-cell[aria-disabled="true"] { cursor: default; }
@media (hover: hover) {
  .pl-cell:not([aria-disabled="true"]):hover { background: var(--surface-2); }
}
.pl-last { color: var(--text-secondary); }

/* Where are the spaces?: the line, then the line again as a board of
 * places (render-spaces.js). A character is 28px wide and a place's button
 * 44px, pulled 14px over the character on each side, so the places stand
 * 44px apart and their targets tile the line with no gap and no overlap; the
 * board's right padding holds the last button's reach, so a full row never
 * runs past the screen. A place marked is a solid bar; once checked a found
 * one keeps it with a wash, a missed one is dashed in the accent and an extra
 * one dashed in the danger tone, each with a mark and words, never colour
 * alone. */
.sp-tier { width: 100%; }
.sp-line { width: 100%; font-size: 1.5rem; line-height: 1.4; overflow-wrap: anywhere; }
.sp-board {
  display: flex; flex-wrap: wrap; align-items: center;
  row-gap: var(--space-1);
  padding: var(--space-1) 14px var(--space-1) 0;
  font-family: var(--ja);
}
.sp-unit { display: inline-flex; align-items: center; }
.sp-ch {
  display: inline-grid; place-items: center;
  width: 28px; height: 56px;
  font-size: 1.625rem; line-height: 1;
  pointer-events: none;
}
.sp-slot {
  position: relative; z-index: 1;
  flex: none;
  width: 44px; height: 56px;
  margin: 0 -14px;
  padding: 0;
  border: 0; background: transparent; color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sp-slot:active { transform: none; }
.sp-slot::after {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 4px; bottom: 4px;
  border-radius: 4px;
  pointer-events: none;
}
.sp-bar {
  position: absolute; left: 50%; top: 8px; bottom: 18px;
  transform: translateX(-50%);
  border-left: 2px dotted var(--border-strong);
  pointer-events: none;
}
@media (hover: hover) {
  .sp-board:not(.is-done) .sp-slot:hover .sp-bar { border-left-color: var(--text-secondary); }
}
.sp-slot[aria-pressed="true"] .sp-bar { border-left: 4px solid var(--accent-bright); border-radius: 2px; }
.sp-slot:focus { outline: none; }
.sp-slot:focus-visible::after { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.sp-board.is-done .sp-slot { cursor: default; }
.sp-slot.is-found::after { background: var(--accent-wash); }
.sp-slot.is-missed .sp-bar { border-left: 3px dashed var(--accent-bright); }
.sp-slot.is-extra .sp-bar { border-left: 3px dashed var(--danger-text); }
.sp-tag {
  position: absolute; left: 50%; bottom: 2px;
  transform: translateX(-50%);
  font-family: var(--font); font-size: 0.75rem; font-weight: 700; line-height: 1;
  pointer-events: none;
}
.sp-actions { margin-top: 0; }
.sp-why-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--accent-bright) 55%, transparent);
  border-radius: 999px;
  background: var(--accent-wash);
  font-size: var(--text-xs); font-weight: 600;
}
.sp-why-tag.is-missed { background: transparent; border-style: dashed; }
.sp-why-tag.is-extra { background: transparent; border-style: dashed; border-color: var(--danger-text); }
.sp-meaning { color: var(--text-secondary); }
/* A line with its spaces drawn: a width and a hairline, never a typed space. */
.sp-spaced { font-size: 1.375rem; line-height: 1.5; overflow-wrap: anywhere; }
.sp-gap {
  display: inline-block;
  width: 0.6em; height: 1em;
  vertical-align: -0.12em;
  background: linear-gradient(var(--text-muted), var(--text-muted)) center / 1px 100% no-repeat;
}
.sp-again {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* The result. */
.pl-score { font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-new { font-weight: 700; }
.pl-mix {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.pl-mix-pair { font-size: 1.5rem; letter-spacing: 0.15em; }
.pl-mix-kanji { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; font-size: var(--text-sm); }
.pl-mix-one { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }

@media (pointer: coarse) {
  .pl-opt, .pl-cell { min-width: 44px; min-height: 44px; }
  .pl-start { min-height: 44px; }
}

/* A phone, or a host's sheet (a frame some 400px wide at any screen size):
 * a question, its options and its feedback, or a grid and its feedback,
 * fit in what a 390x844 sheet shows. WebKit lets no frame scroll its host
 * (events-play.js reveal), so this is the only thing that keeps them in
 * view there. Cells and options stay 44px or more, and the four spellings
 * stay two by two: one under another, a long name's feedback fell below. */
@media (max-width: 600px) {
  .pl-q.mk-sec { margin-top: var(--space-4); }
  .pl-q { gap: var(--space-2); }
  .pl-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .pl-opts--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pl-opt { min-height: 3.5rem; padding: var(--space-2); }
  .pl-opts--wide .pl-opt { min-height: 3rem; }
  .pl-ch { font-size: 2.25rem; }
  .pl-grid { gap: 6px; }
  .pl-grid[data-size="4"] { max-width: calc(4 * 3.5rem + 3 * 6px); }
  .pl-grid[data-size="5"] { max-width: calc(5 * 3.25rem + 4 * 6px); }
  .pl-grid[data-size="6"] { gap: 4px; max-width: calc(6 * 3rem + 5 * 4px); }
  .pl-word, .pl-name [lang="ja"] { font-size: 2rem; }
}

/* The embed bar: My kanji and Play together on the left, Open in Yomu on the right. */
.embed-bar .pl-open { margin-right: auto; }
