/* WORD STRIKE — NYT Games–style visual system: light-first, bold sans
   type, rounded tile/pill components, restrained color-coded feedback.
   Same structure/selectors as before; this is a full visual reskin. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-raised: #f7f7f8;
  --surface-sunken: #edeef0;

  --line: #d3d6da;
  --line-soft: #e6e7ea;

  --ink: #1a1a1b;
  --ink-soft: #565758;
  --ink-faint: #8a8d91;
  --ink-on-accent: #ffffff;

  --accent: #2f6f4f;
  --accent-strong: #1f5138;
  --accent-soft: #e3f2ea;

  --live: #d1453b;
  --live-strong: #a8352d;
  --live-soft: #fbe6e4;

  --hot: #c77c1f;
  --hot-strong: #9c6117;
  --hot-soft: #faecd6;

  --dead: #878a8d;
  --dead-strong: #6b6e71;
  --dead-soft: #eceded;

  --font-display: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(17, 17, 18, 0.06);
  --shadow-md: 0 8px 24px rgba(17, 17, 18, 0.10);
  --shadow-lg: 0 16px 40px rgba(17, 17, 18, 0.16);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121213;
    --surface: #1a1a1b;
    --surface-raised: #232324;
    --surface-sunken: #0e0e0f;

    --line: #3a3a3c;
    --line-soft: #2b2b2d;

    --ink: #f4f4f5;
    --ink-soft: #b3b5b7;
    --ink-faint: #838688;
    --ink-on-accent: #0c0c0d;

    --accent: #5bc48c;
    --accent-strong: #7ed4a6;
    --accent-soft: rgba(91, 196, 140, 0.16);

    --live: #ef6f66;
    --live-strong: #f5897f;
    --live-soft: rgba(239, 111, 102, 0.16);

    --hot: #e3a44e;
    --hot-strong: #eab86f;
    --hot-soft: rgba(227, 164, 78, 0.16);

    --dead: #9a9c9f;
    --dead-strong: #b3b5b7;
    --dead-soft: rgba(154, 156, 159, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100%;
  overscroll-behavior-y: contain;
}

body {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button, select {
  font-family: inherit;
  color: inherit;
}

#app {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom));
}
.screen.active { display: block; }

/* No decorative animated background — NYT games keep the canvas flat and quiet. */
.scanline-bg { display: none; }

/* ---------- Typography ---------- */

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: clamp(2.1rem, 9vw, 3.2rem);
  color: var(--ink);
  text-align: center;
  margin: 2.25rem 0 0.35rem;
}

.tagline {
  text-align: center;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0 0 2rem;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8em 1.2em;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--ink-soft); }
.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn-secondary:hover { background: var(--surface-raised); }
.btn-danger {
  background: var(--surface);
  border-color: var(--live);
  color: var(--live);
}
.btn-danger:hover { background: var(--live-soft); }
.btn-large { width: 100%; padding: 1em; font-size: 1.05rem; }
.btn-small { font-size: 0.78rem; padding: 0.6em 0.7em; min-height: 38px; }
.btn-icon-text { width: 100%; margin-top: 0.5rem; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-raised); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Start screen ---------- */

.start-inner { position: relative; z-index: 1; }

.start-actions {
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.select-difficulty {
  width: 100%;
  padding: 0.8em;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.start-row { display: flex; gap: 0.6rem; }
.start-row .btn { flex: 1; }

.resume-banner {
  max-width: 380px;
  margin: 0 auto 1.5rem;
  padding: 1rem;
  border: 1.5px solid var(--hot);
  border-radius: var(--radius-md);
  background: var(--hot-soft);
  text-align: center;
}
.resume-text {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--hot-strong);
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
}
.resume-actions { display: flex; gap: 0.6rem; }
.resume-actions .btn { flex: 1; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */

.hud { margin-bottom: 0.75rem; }
.hud-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.strikes {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1rem;
}
.strikes-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.strikes-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
}
.strikes--warning .strikes-value { color: var(--hot); animation: pulse-warning 1.1s ease-in-out infinite; }
.strikes--final .strikes-value { color: var(--live); animation: pulse-warning 0.6s ease-in-out infinite; }
@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.strikes--last-stand {
  background: var(--live-soft);
  border-color: var(--live);
}
.strikes--last-stand .strikes-label {
  color: var(--live-strong);
  animation: pulse-warning 0.5s ease-in-out infinite;
}
.strikes--last-stand .strikes-value {
  color: var(--live);
  animation: pulse-warning 0.5s ease-in-out infinite;
}

.score {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
#score-value { color: var(--ink); font-weight: 800; }

.target-line {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 0.4rem;
  border-radius: var(--radius-md);
}

/* ---------- Word progress ---------- */

.word-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.75rem 0;
  max-height: 22vh;
  overflow-y: auto;
}
.word-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.word-row-label { width: 4.5em; flex-shrink: 0; letter-spacing: 0.04em; }
.word-row-letters { display: flex; gap: 3px; flex-wrap: wrap; }
.letter-box {
  width: 1.6em;
  height: 1.7em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-faint);
  font-weight: 800;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.letter-box--filled { color: var(--ink-on-accent); border-color: var(--accent); background: var(--accent); }
.letter-box--pop { animation: box-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes box-pop {
  0% { transform: scale(0.55); }
  65% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.word-row--complete { color: var(--accent); }
.word-row--complete .word-row-label { color: var(--accent); }

/* ---------- Grid ---------- */

.grid-wrap { margin-bottom: 0.75rem; }
.grid-cols-row { display: flex; }
.grid-corner { width: clamp(20px, 5.5vw, 28px); flex-shrink: 0; }
.grid-labels-row {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
}
.grid-with-rows { display: flex; }
.grid-labels-col {
  width: clamp(20px, 5.5vw, 28px);
  flex-shrink: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
}
.grid-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(0.65rem, 2vw, 0.8rem);
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  aspect-ratio: 1 / 1;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 0;
  perspective: 500px;
}

.cell {
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.75rem, 3.2vw, 1.1rem);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color 100ms ease, border-color 100ms ease, transform 100ms ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  padding: 0;
}
.cell:disabled { cursor: default; }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 2; }

.cell-letter {
  line-height: 1;
  pointer-events: none;
}
.cell-letter--multi {
  font-size: 0.6em;
  letter-spacing: 0.01em;
}
.cell-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.4em;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
}

.cell--unknown:not(:disabled):hover { border-color: var(--ink-faint); }

.cell--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  transform: scale(1.04);
}

.cell--dead {
  background: var(--dead-soft);
  color: var(--dead-strong);
  border-color: var(--dead);
}
.cell--hot {
  background: var(--hot);
  color: var(--ink-on-accent);
  border-color: var(--hot);
}
.cell--live {
  background: var(--live);
  color: #ffffff;
  border-color: var(--live);
}
.cell--exact {
  background: var(--accent);
  color: var(--ink-on-accent);
  border-color: var(--accent);
}
.cell--revealed-loss {
  background: var(--surface-sunken);
  color: var(--ink-faint);
  border-style: dashed;
}
.cell--region-hint {
  box-shadow: inset 0 0 0 2px var(--hot);
}

.cell--word-complete { animation: word-flash 0.55s ease; z-index: 3; }
@keyframes word-flash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent); }
  35% { transform: scale(1.18); box-shadow: 0 0 0 6px var(--accent-soft); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* Every reveal flips like a tile turning over — the letter/color is already
   correct underneath (applied via the base .cell--state class before this
   animation is triggered); the flip is purely the reveal motion. Each
   outcome gets a distinct follow-through so the four results stay easy to
   tell apart at a glance, not just by color. */
.cell--flash-exact { animation: cell-flip-exact 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 2; }
@keyframes cell-flip-exact {
  0% { transform: rotateX(0deg) scale(1); }
  45% { transform: rotateX(90deg) scale(1); }
  55% { transform: rotateX(90deg) scale(1); }
  80% { transform: rotateX(0deg) scale(1.16); }
  100% { transform: rotateX(0deg) scale(1); }
}

.cell--flash-live { animation: cell-flip-live 0.55s ease; z-index: 2; }
@keyframes cell-flip-live {
  0% { transform: rotateX(0deg) translateX(0); }
  45% { transform: rotateX(90deg) translateX(0); }
  55% { transform: rotateX(90deg) translateX(0); }
  66% { transform: rotateX(0deg) translateX(-4px); }
  78% { transform: rotateX(0deg) translateX(4px); }
  90% { transform: rotateX(0deg) translateX(-2px); }
  100% { transform: rotateX(0deg) translateX(0); }
}

.cell--flash-hot { animation: cell-flip-hot 0.55s ease; z-index: 2; }
@keyframes cell-flip-hot {
  0% { transform: rotateX(0deg); box-shadow: 0 0 0 0 var(--hot); }
  45% { transform: rotateX(90deg); }
  55% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); box-shadow: 0 0 0 9px rgba(199, 124, 31, 0); }
}

.cell--flash-dead { animation: cell-flip-dead 0.4s ease; z-index: 2; }
@keyframes cell-flip-dead {
  0% { transform: rotateX(0deg); }
  45% { transform: rotateX(90deg); }
  55% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

/* ---------- Status message ---------- */

.status-message {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 0.92rem;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: status-pop 220ms ease;
}
@keyframes status-pop {
  0% { transform: scale(0.94) translateY(-2px); opacity: 0.5; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.status-message--exact { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent); }
.status-message--live { color: var(--live-strong); background: var(--live-soft); border-color: var(--live); }
.status-message--live-strike { color: var(--hot-strong); background: var(--hot-soft); border-color: var(--hot); }
.status-message--hot { color: var(--hot-strong); background: var(--hot-soft); border-color: var(--hot); }
.status-message--dead { color: var(--ink-soft); }
.status-message--blocked-duplicate { color: var(--hot-strong); background: var(--hot-soft); border-color: var(--hot); }
.status-message--last-stand {
  color: #ffffff;
  background: var(--live);
  border-color: var(--live);
  animation: pulse-warning 0.6s ease-in-out infinite;
  font-weight: 800;
}

.eliminated-line {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--live);
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}

/* ---------- Letter rack ---------- */

.alphabet {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 0.75rem;
}
.alphabet--inactive { opacity: 0.45; }

.letter-btn {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.85rem, 4vw, 1.15rem);
  cursor: pointer;
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  transition: transform 80ms ease;
  animation: key-pop 240ms ease backwards;
  animation-delay: calc(var(--key-i, 0) * 12ms);
}
@keyframes key-pop {
  0% { opacity: 0; transform: scale(0.8) translateY(3px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.letter-btn:disabled { cursor: not-allowed; }
.letter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.letter-btn:not(:disabled):active { background: var(--ink); color: var(--bg); transform: scale(0.9); }
.letter-btn--eliminated {
  color: var(--live);
  background: var(--live-soft);
  text-decoration: line-through;
  opacity: 0.7;
  box-shadow: none;
}

/* ---------- Bottom controls & shot log ---------- */

.bottom-controls { display: flex; gap: 0.5rem; }
.bottom-controls .btn { flex: 1; }

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 720px;
  margin: 0 auto;
  max-height: 55vh;
  background: var(--surface);
  border-top: 1.5px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  border-bottom: 1.5px solid var(--line-soft);
}
.shot-log-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1.1rem;
  overflow-y: auto;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
}
.shot-log-entry {
  display: grid;
  grid-template-columns: 2.2em 3em 2em 1fr;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.shot-log-entry--exact { color: var(--accent-strong); }
.shot-log-entry--live { color: var(--live-strong); }
.shot-log-entry--hot { color: var(--hot-strong); }

/* ---------- Letter radar ---------- */

.radar-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem 1.1rem;
  overflow-y: auto;
}
.radar-hint {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 30em;
}
.radar-svg {
  width: min(72vw, 260px);
  height: min(72vw, 260px);
  flex-shrink: 0;
  overflow: visible;
}
.radar-ring-circle {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-dasharray: 2 4;
}
.radar-ring--complete .radar-ring-circle {
  stroke: var(--accent);
  stroke-dasharray: none;
  stroke-width: 2;
}
.radar-ring-label {
  fill: var(--ink-faint);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.03em;
}
.radar-crosshair line {
  stroke: var(--line-soft);
  stroke-width: 1;
}
.radar-center-dot {
  fill: var(--line);
}
.radar-mark-dot {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1.5;
}
.radar-mark--lit .radar-mark-dot {
  fill: var(--accent);
  stroke: var(--accent);
}
.radar-mark--lit {
  animation: radar-ping 0.4s ease;
}
@keyframes radar-ping {
  0% { transform-origin: center; opacity: 0.3; }
  60% { opacity: 1; }
  100% { opacity: 1; }
}
.radar-mark-letter {
  fill: var(--ink-on-accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
}

.radar-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.radar-legend-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.radar-legend-length { flex-shrink: 0; color: var(--ink); font-weight: 800; }
.radar-legend-detail { text-align: right; }
.radar-legend-item--complete { color: var(--accent-strong); }
.radar-legend-item--complete .radar-legend-length { color: var(--accent); }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.overlay-panel {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}
.overlay-panel--small { max-width: 340px; }
.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.01em;
  border-bottom: 1.5px solid var(--line-soft);
  color: var(--ink);
}
.overlay-body { padding: 1.1rem 1.25rem; font-size: 0.92rem; line-height: 1.55; }
.overlay-body p { color: var(--ink-soft); }
.overlay-actions {
  display: flex;
  gap: 0.6rem;
  padding: 1.1rem 1.25rem;
  border-top: 1.5px solid var(--line-soft);
}
.overlay-actions .btn { flex: 1; }
.overlay > .btn-primary { margin: 0 1.25rem 1.25rem; }

.outcome-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.9rem; margin: 1rem 0; align-items: start; }
.outcome-list dd { margin: 0; color: var(--ink-soft); }
.outcome-tag {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-pill);
  align-self: start;
  white-space: nowrap;
}
.outcome-tag--exact { background: var(--accent); color: var(--ink-on-accent); }
.outcome-tag--live { background: var(--live); color: #ffffff; }
.outcome-tag--hot { background: var(--hot); color: var(--ink-on-accent); }
.outcome-tag--dead { background: var(--dead-soft); color: var(--dead-strong); }

.stat-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.stat-row strong { color: var(--ink); font-weight: 800; }

.result-subtitle {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent-strong);
}
.result-words { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 1rem 0; }
.result-word {
  font-family: var(--font-display);
  font-weight: 800;
  padding: 0.45em 0.8em;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink-faint);
}
.result-word--found { color: var(--ink-on-accent); border-color: var(--accent); background: var(--accent); }
.overlay--defeat .result-subtitle { color: var(--live-strong); }

.region-hint-banner {
  position: fixed;
  top: calc(1rem + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--hot);
  color: var(--ink-on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  z-index: 60;
  font-size: 0.8rem;
}

.debug-panel {
  position: fixed;
  top: var(--safe-top);
  right: 0;
  max-width: 260px;
  max-height: 32vh;
  overflow-y: auto;
  background: rgba(26, 26, 27, 0.92);
  color: #d7f7e6;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.6rem;
  padding: 0.5rem;
  z-index: 100;
  border-bottom-left-radius: 8px;
  pointer-events: auto;
}
.debug-panel button {
  margin-top: 0.3rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.65rem;
  background: #2a2a2c;
  color: #d7f7e6;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.3em 0.5em;
  cursor: pointer;
}

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  #app { max-width: 900px; }
  .screen.active {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
    align-items: start;
  }
  #screen-game.active { display: grid; }
  .hud, .status-message, .eliminated-line, .alphabet, .bottom-controls { grid-column: 1; }
  .word-progress { grid-column: 2; grid-row: 1 / span 5; max-height: none; }
  .grid-wrap { grid-column: 1; }
}

@media (min-width: 640px) {
  #screen-start.active { display: block; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
.reduce-motion * {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ---------- Small-width safety ---------- */

@media (max-width: 360px) {
  .logo { font-size: 1.85rem; }
  .btn { font-size: 0.85rem; }
}
