:root {
  --ink: #15183A;
  --ink-2: #222657;
  --ink-3: #30366F;
  --cream: #FFF7D6;
  --paper: #F7F2D8;
  --yellow: #FFD447;
  --orange: #FFB72B;
  --coral: #FF4D6D;
  --red: #E92847;
  --mint: #2CE6C8;
  --blue: #55B7FF;
  --green: #65F27A;
  --shadow: #090B22;
  --shadow-soft: #101334;
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --pad: clamp(10px, 2.2vmin, 24px);
  --gap: clamp(8px, 1.6vmin, 18px);
  font-family: 'Oxanium', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

input {
  user-select: text;
  -webkit-user-select: text;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: calc(var(--pad) + env(safe-area-inset-top)) calc(var(--pad) + env(safe-area-inset-right)) calc(var(--pad) + env(safe-area-inset-bottom)) calc(var(--pad) + env(safe-area-inset-left));
  overflow: hidden;
  background: var(--ink);
}

.screen::before,
.screen::after {
  content: '';
  position: absolute;
  z-index: 0;
  width: clamp(120px, 24vmin, 280px);
  height: clamp(120px, 24vmin, 280px);
  border-radius: 999px;
  background: var(--ink-2);
}

.screen::before {
  left: calc(-1 * clamp(40px, 8vmin, 120px));
  top: calc(-1 * clamp(40px, 8vmin, 120px));
}

.screen::after {
  right: calc(-1 * clamp(50px, 8vmin, 120px));
  bottom: calc(-1 * clamp(50px, 8vmin, 120px));
  background: var(--ink-3);
}

.menu-board,
.game-grid,
.gameover-board {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  height: 100%;
  margin: 0 auto;
}

.panel,
.brand-card,
.play-card,
.game-hud,
.timer-card,
.gameover-card,
.reason-card,
.modal-card {
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 0 var(--shadow);
}

.panel-dark {
  background: var(--ink-2);
  color: var(--cream);
  border-color: var(--cream);
}

.brand-card {
  background: var(--yellow);
  box-shadow: 0 14px 0 var(--shadow);
  padding: clamp(18px, 3vmin, 42px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.brand-card::after {
  content: '';
  position: absolute;
  right: clamp(18px, 4vmin, 54px);
  top: clamp(18px, 4vmin, 54px);
  width: clamp(34px, 7vmin, 88px);
  height: clamp(34px, 7vmin, 88px);
  border-radius: 24px;
  background: var(--coral);
  border: 4px solid var(--ink);
  box-shadow: 0 8px 0 var(--shadow-soft);
  transform: rotate(10deg);
}

.brand-kicker {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: clamp(.76rem, 1.8vmin, 1rem);
  margin-bottom: clamp(6px, 1.2vmin, 14px);
}

.logo {
  margin: 0;
  font-size: clamp(4rem, 12vmin, 9.3rem);
  line-height: .78;
  letter-spacing: -.08em;
  font-weight: 800;
  color: var(--ink);
  text-shadow: 0 7px 0 var(--orange);
}

.tagline {
  margin: clamp(14px, 2.2vmin, 24px) 0 0;
  font-size: clamp(1.02rem, 2.2vmin, 1.65rem);
  line-height: 1.15;
  font-weight: 800;
  max-width: 16em;
}

.menu-board {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(260px, .82fr) minmax(260px, .82fr);
  grid-template-rows: minmax(0, .98fr) minmax(0, 1.02fr);
  gap: var(--gap);
}

.menu-board .brand-card {
  grid-row: 1 / span 2;
}

.player-card,
.how-card,
.leader-card {
  padding: clamp(14px, 2.4vmin, 26px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-title {
  margin: 0 0 clamp(8px, 1.4vmin, 14px);
  font-size: clamp(1rem, 2.1vmin, 1.35rem);
  line-height: 1;
  letter-spacing: .02em;
  font-weight: 800;
  text-transform: uppercase;
}

.username-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.input-wrap {
  position: relative;
}

.game-input,
.username-input {
  width: 100%;
  appearance: none;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: inset 0 -5px 0 #E9DFAF;
  outline: none;
  font-weight: 800;
  letter-spacing: .04em;
}

.username-input {
  height: clamp(50px, 7.5vmin, 64px);
  padding: 0 16px;
  font-size: clamp(1rem, 2.6vmin, 1.3rem);
}

.game-input:focus,
.username-input:focus {
  border-color: var(--blue);
  box-shadow: inset 0 -5px 0 #E9DFAF, 0 0 0 4px var(--ink);
}

.btn {
  min-height: 48px;
  padding: 0 clamp(14px, 2.4vmin, 24px);
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: var(--mint);
  color: var(--ink);
  box-shadow: 0 7px 0 var(--shadow);
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: transform 90ms ease, box-shadow 90ms ease, background-color 140ms ease;
}

.btn:active,
.btn.is-pressed {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--shadow);
}

.btn:focus-visible {
  outline: 4px solid var(--cream);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--coral);
  color: var(--cream);
}

.btn-yellow {
  background: var(--yellow);
}

.btn-quiet {
  background: var(--paper);
}

.btn-small {
  min-height: 40px;
  padding: 0 12px;
  border-width: 3px;
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--shadow);
  font-size: .88rem;
}

.btn:disabled {
  background: #9EA0B8;
  color: #515575;
  box-shadow: 0 5px 0 var(--shadow-soft);
  transform: none;
}

.play-btn {
  width: 100%;
  min-height: clamp(58px, 9vmin, 82px);
  margin-top: clamp(12px, 2vmin, 18px);
  font-size: clamp(1.2rem, 3vmin, 1.75rem);
  border-radius: 22px;
}

.form-note,
.status-line {
  min-height: 22px;
  margin-top: 10px;
  font-size: clamp(.78rem, 1.55vmin, .94rem);
  font-weight: 700;
  color: var(--ink-3);
}

.status-line.is-good {
  color: #0A7A54;
}

.status-line.is-bad {
  color: var(--red);
}

.how-list {
  display: grid;
  gap: clamp(8px, 1.25vmin, 14px);
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 800;
  font-size: clamp(.86rem, 1.7vmin, 1.04rem);
  line-height: 1.15;
}

.how-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.badge {
  display: grid;
  place-items: center;
  width: clamp(28px, 4vmin, 38px);
  height: clamp(28px, 4vmin, 38px);
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: 0 4px 0 var(--shadow-soft);
  color: var(--ink);
  font-size: .88em;
}

.leader-card {
  overflow: hidden;
}

.leader-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.leader-date {
  font-size: .75rem;
  font-weight: 800;
  color: var(--ink-3);
  white-space: nowrap;
}

.board-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: hidden;
}

.board-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: clamp(32px, 4.5vmin, 42px);
  padding: 0 10px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 0 4px 0 #D9CFA4;
  font-weight: 800;
}

.board-row .rank {
  color: var(--coral);
}

.board-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-empty {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 3px dashed var(--ink-3);
  border-radius: 14px;
  font-weight: 800;
  color: var(--ink-3);
  text-align: center;
  padding: 10px;
}

.game-grid {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: var(--gap);
}

.game-hud {
  min-height: 74px;
  padding: clamp(8px, 1.4vmin, 14px);
  display: grid;
  grid-template-columns: minmax(126px, auto) repeat(3, minmax(92px, 1fr)) auto;
  gap: clamp(6px, 1.2vmin, 12px);
  align-items: center;
  background: var(--yellow);
}

.mini-brand {
  font-weight: 800;
  font-size: clamp(1.15rem, 2.8vmin, 2rem);
  letter-spacing: -.05em;
  text-shadow: 0 3px 0 var(--orange);
  white-space: nowrap;
}

.stat-box {
  min-width: 0;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--cream);
  box-shadow: 0 5px 0 var(--shadow-soft);
  padding: 7px 10px;
  text-align: center;
}

.stat-label {
  display: block;
  color: var(--ink-3);
  font-weight: 800;
  font-size: clamp(.62rem, 1.25vmin, .78rem);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-value {
  display: block;
  font-size: clamp(1.2rem, 3vmin, 2rem);
  font-weight: 800;
  line-height: 1;
}

.timer-card {
  padding: clamp(8px, 1.4vmin, 14px);
  background: var(--ink-2);
  color: var(--cream);
  border-color: var(--cream);
  box-shadow: 0 8px 0 var(--shadow);
}

.timer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.timer-number {
  font-size: clamp(1.05rem, 2.6vmin, 1.55rem);
  color: var(--yellow);
}

.timer-track {
  height: clamp(18px, 3.3vmin, 28px);
  border: 4px solid var(--cream);
  border-radius: 999px;
  background: var(--shadow);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--green);
  border-radius: 999px;
  transform-origin: left center;
  transition: background-color 160ms ease;
}

.timer-fill.is-warning {
  background: var(--yellow);
}

.timer-fill.is-danger {
  background: var(--coral);
}

.play-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2vmin, 22px);
  padding: clamp(14px, 2.8vmin, 34px);
  background: var(--paper);
  overflow: hidden;
}

.forbidden-label {
  text-align: center;
  color: var(--ink-3);
  font-size: clamp(.9rem, 2vmin, 1.25rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.forbidden-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vmin, 22px);
  min-height: 0;
}

.letter-card {
  display: grid;
  place-items: center;
  width: clamp(62px, 16vmin, 156px);
  height: clamp(70px, 19vmin, 176px);
  border: clamp(4px, .8vmin, 7px) solid var(--ink);
  border-radius: clamp(18px, 4vmin, 36px);
  background: var(--coral);
  color: var(--cream);
  box-shadow: 0 clamp(7px, 1.5vmin, 14px) 0 var(--shadow);
  font-size: clamp(2.4rem, 12vmin, 8.4rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  will-change: transform;
}

.letter-card:nth-child(2) { background: var(--orange); color: var(--ink); }
.letter-card:nth-child(3) { background: var(--blue); color: var(--ink); }
.letter-card:nth-child(4) { background: var(--mint); color: var(--ink); }

.word-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(8px, 1.6vmin, 16px);
  align-items: end;
}

.game-input {
  height: clamp(62px, 10vmin, 92px);
  padding: 0 clamp(14px, 2.4vmin, 26px);
  font-size: clamp(1.45rem, 5.2vmin, 3.1rem);
  text-transform: uppercase;
}

.submit-btn {
  min-height: clamp(62px, 10vmin, 92px);
  min-width: clamp(86px, 17vmin, 168px);
  font-size: clamp(1rem, 2.4vmin, 1.35rem);
}

.input-hint {
  grid-column: 1 / -1;
  min-height: 20px;
  margin-top: -4px;
  color: var(--ink-3);
  font-size: clamp(.74rem, 1.55vmin, .92rem);
  font-weight: 700;
  text-align: center;
}

.screen-flash {
  animation: screenFlash 260ms ease;
}

.success-pop .letter-card {
  animation: letterPop 280ms cubic-bezier(.2, 1.4, .3, 1);
}

.shake {
  animation: shake 360ms ease;
}

.gameover-board {
  display: grid;
  place-items: center;
}

.gameover-card {
  width: min(1040px, 100%);
  max-height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--yellow);
}

.gameover-head {
  padding: clamp(14px, 2.3vmin, 24px);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-bottom: 4px solid var(--ink);
}

.gameover-title {
  margin: 0;
  font-size: clamp(2rem, 6vmin, 5rem);
  line-height: .9;
  font-weight: 800;
  letter-spacing: -.05em;
  text-shadow: 0 5px 0 var(--orange);
}

.run-score {
  min-width: clamp(120px, 20vmin, 190px);
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 7px 0 var(--shadow-soft);
  padding: 10px 14px;
  text-align: center;
}

.run-score span {
  display: block;
  color: var(--ink-3);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.run-score strong {
  display: block;
  font-size: clamp(2rem, 5vmin, 4rem);
  line-height: 1;
  font-weight: 800;
}

.gameover-body {
  min-height: 0;
  overflow: auto;
  padding: clamp(12px, 2vmin, 22px);
  scrollbar-width: thin;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.6vmin, 16px);
}

.summary-tile,
.reason-card {
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 6px 0 var(--shadow-soft);
  padding: clamp(12px, 2vmin, 20px);
}

.summary-tile h3,
.reason-card h3 {
  margin: 0 0 8px;
  font-size: clamp(.95rem, 2vmin, 1.2rem);
  font-weight: 800;
  text-transform: uppercase;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  font-weight: 800;
  color: var(--ink-3);
}

.summary-line strong {
  color: var(--ink);
}

.reason-card {
  margin-top: clamp(10px, 1.6vmin, 16px);
  background: var(--ink-2);
  color: var(--cream);
  border-color: var(--cream);
}

.reason-card h3,
.reason-text {
  color: var(--cream);
}

.reason-text {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1rem, 2.3vmin, 1.45rem);
}

.highlight-word {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: clamp(1.65rem, 5vmin, 3.3rem);
  line-height: 1;
  font-weight: 800;
}

.highlight-word span {
  display: inline-grid;
  place-items: center;
  min-width: .72em;
}

.highlight-word .bad-letter {
  color: var(--cream);
  background: var(--red);
  border: 3px solid var(--cream);
  border-radius: 10px;
  padding: 2px 5px;
}

.gameover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: clamp(12px, 2vmin, 22px);
  border-top: 4px solid var(--ink);
  background: var(--orange);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  min-width: min(420px, calc(100vw - 28px));
  transform: translate(-50%, 150%);
  border: 4px solid var(--cream);
  border-radius: 18px;
  background: var(--ink-2);
  color: var(--cream);
  box-shadow: 0 8px 0 var(--shadow);
  padding: 14px 18px;
  text-align: center;
  font-weight: 800;
  transition: transform 180ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: var(--pad);
  background: #15183A;
}

.modal-root.is-open {
  display: grid;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(720px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--paper);
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 4px solid var(--ink);
  background: var(--yellow);
}

.modal-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 4vmin, 2.6rem);
  font-weight: 800;
  letter-spacing: -.04em;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-body .leader-card {
  box-shadow: none;
}

.noscript-card {
  position: fixed;
  inset: 20px;
  z-index: 100;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--yellow);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 28px;
  font-family: system-ui, sans-serif;
}

@keyframes letterPop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-12px) scale(1.06) rotate(-2deg); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-10px); }
  36% { transform: translateX(9px); }
  54% { transform: translateX(-7px); }
  72% { transform: translateX(5px); }
}

@keyframes screenFlash {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
  100% { filter: brightness(1); }
}

@media (orientation: landscape) and (max-height: 620px) {
  .screen {
    --pad: clamp(8px, 1.4vmin, 14px);
    --gap: clamp(7px, 1.2vmin, 12px);
  }

  .menu-board {
    grid-template-columns: minmax(260px, .9fr) minmax(280px, 1fr) minmax(240px, .82fr);
    grid-template-rows: 1fr 1fr;
  }

  .brand-card {
    padding: 18px;
  }

  .logo {
    font-size: clamp(3rem, 12vmin, 5.8rem);
  }

  .tagline {
    font-size: clamp(.9rem, 2.8vmin, 1.25rem);
  }

  .player-card,
  .how-card,
  .leader-card {
    padding: 12px;
  }

  .game-grid {
    grid-template-columns: minmax(280px, .76fr) minmax(360px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .game-hud {
    grid-column: 1 / -1;
    min-height: 58px;
    grid-template-columns: minmax(110px, auto) repeat(3, minmax(80px, 1fr)) auto;
  }

  .timer-card {
    grid-row: 2;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .play-card {
    grid-column: 2;
    grid-row: 2;
    padding: 14px;
  }

  .letter-card {
    width: clamp(56px, 14vmin, 112px);
    height: clamp(64px, 16vmin, 126px);
    font-size: clamp(2.2rem, 10vmin, 5.2rem);
  }

  .game-input,
  .submit-btn {
    height: clamp(56px, 13vmin, 74px);
    min-height: clamp(56px, 13vmin, 74px);
  }
}

@media (max-width: 860px) and (orientation: portrait) {
  .screen {
    --pad: clamp(8px, 2.4vw, 16px);
    --gap: clamp(8px, 2vw, 12px);
  }

  .menu-board {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .menu-board .brand-card {
    grid-row: auto;
  }

  .brand-card {
    padding: clamp(14px, 4vw, 22px);
    min-height: 116px;
  }

  .brand-card::after {
    width: 38px;
    height: 38px;
    border-radius: 14px;
  }

  .brand-kicker {
    font-size: .72rem;
    margin-bottom: 5px;
  }

  .logo {
    font-size: clamp(3.3rem, 16vw, 5.2rem);
  }

  .tagline {
    margin-top: 8px;
    font-size: clamp(.88rem, 4vw, 1.15rem);
  }

  .player-card,
  .how-card,
  .leader-card {
    padding: clamp(10px, 3vw, 14px);
    box-shadow: 0 6px 0 var(--shadow);
  }

  .username-row {
    grid-template-columns: 1fr;
  }

  .username-input,
  .btn {
    min-height: 46px;
  }

  .play-btn {
    min-height: 56px;
    margin-top: 8px;
  }

  .how-list {
    grid-template-columns: 1fr;
    gap: 7px;
    font-size: .82rem;
  }

  .badge {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }

  .menu-board .leader-card {
    min-height: 0;
  }

  .menu-board .leader-card:nth-of-type(4),
  .menu-board .leader-card:nth-of-type(5) {
    display: none;
  }

  .mobile-leaders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    min-height: 0;
  }

  .mobile-leaders .leader-card {
    display: flex;
  }

  .board-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    min-height: 31px;
    font-size: .78rem;
    padding: 0 7px;
  }

  .leader-date {
    display: none;
  }

  .game-grid {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .game-hud {
    min-height: 0;
    grid-template-columns: 1fr 1fr 1fr auto;
    grid-template-areas:
      "brand brand brand board"
      "score best time board";
    padding: 8px;
    gap: 7px;
  }

  .mini-brand { grid-area: brand; text-align: left; }
  .score-stat { grid-area: score; }
  .best-stat { grid-area: best; }
  .time-stat { grid-area: time; }
  .hud-board-btn { grid-area: board; align-self: stretch; min-width: 54px; padding: 0 8px; }

  .stat-box {
    padding: 5px 6px;
    border-width: 3px;
    border-radius: 13px;
  }

  .stat-value {
    font-size: clamp(1rem, 6vw, 1.45rem);
  }

  .stat-label {
    font-size: .56rem;
  }

  .timer-card {
    padding: 8px;
    box-shadow: 0 6px 0 var(--shadow);
  }

  .timer-top {
    margin-bottom: 5px;
    font-size: .78rem;
  }

  .timer-track {
    height: 19px;
    border-width: 3px;
  }

  .play-card {
    padding: clamp(10px, 3vw, 16px);
    gap: clamp(8px, 2.2vw, 12px);
    box-shadow: 0 7px 0 var(--shadow);
  }

  .forbidden-row {
    gap: clamp(6px, 2vw, 10px);
  }

  .letter-card {
    width: clamp(58px, 20vw, 88px);
    height: clamp(68px, 24vw, 104px);
    font-size: clamp(2.6rem, 14vw, 4.3rem);
    border-radius: 18px;
  }

  .word-form {
    grid-template-columns: 1fr;
  }

  .game-input,
  .submit-btn {
    height: clamp(58px, 15vw, 74px);
    min-height: clamp(58px, 15vw, 74px);
  }

  .game-input {
    text-align: center;
    font-size: clamp(1.6rem, 8vw, 2.4rem);
  }

  .submit-btn {
    width: 100%;
  }

  .summary-grid,
  .modal-body {
    grid-template-columns: 1fr;
  }

  .gameover-head {
    align-items: stretch;
  }

  .gameover-title {
    font-size: clamp(2rem, 11vw, 3.4rem);
  }

  .run-score {
    min-width: 112px;
    padding: 8px 10px;
  }

  .gameover-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 700px) and (orientation: portrait) {
  .screen {
    --pad: 7px;
    --gap: 7px;
  }

  .brand-card {
    min-height: 92px;
    padding: 10px 14px;
  }

  .brand-kicker {
    display: none;
  }

  .logo {
    font-size: clamp(2.8rem, 14vw, 4.2rem);
  }

  .tagline {
    font-size: .82rem;
    margin-top: 5px;
  }

  .card-title {
    margin-bottom: 6px;
    font-size: .88rem;
  }

  .form-note,
  .status-line,
  .input-hint {
    font-size: .68rem;
    min-height: 16px;
    margin-top: 5px;
  }

  .how-list {
    font-size: .72rem;
  }

  .how-list li:last-child {
    display: none;
  }

  .leader-card .board-row:nth-child(n+4) {
    display: none;
  }

  .letter-card {
    height: clamp(58px, 20vw, 88px);
  }
}

@media (min-width: 861px) {
  .mobile-leaders {
    display: contents;
  }
}

.mobile-leaders {
  display: none;
}

@media (max-width: 860px) and (orientation: portrait) {
  .desktop-leader {
    display: none;
  }

  .mobile-leaders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    min-height: 0;
  }
}

@media (max-width: 420px) and (orientation: portrait) {
  .mobile-leaders {
    grid-template-columns: 1fr;
  }

  .mobile-leaders .leader-card:nth-child(2) {
    display: none;
  }
}

.prefs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.toggle-btn {
  min-height: 36px;
  border: 3px solid var(--ink);
  border-radius: 13px;
  background: var(--cream);
  color: var(--ink-3);
  box-shadow: 0 4px 0 var(--shadow-soft);
  font-size: clamp(.7rem, 1.5vmin, .85rem);
  font-weight: 800;
  text-transform: uppercase;
}

.toggle-btn.is-on {
  background: var(--mint);
  color: var(--ink);
}

.loading-chip,
.restored-pill {
  display: inline-grid;
  place-items: center;
  margin-top: 8px;
  margin-right: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-weight: 800;
  text-transform: uppercase;
  font-size: .78rem;
}

.restored-pill {
  background: var(--blue);
}

.desktop-leader,
.desktop-leader .leader-card {
  min-height: 0;
  height: 100%;
}
