:root {
  --font-display: "Bree Serif", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --espresso: #2a1207;
  --dark-roast: #3d1b08;
  --mocha: #6d3511;
  --roast: #8e4f1a;
  --caramel: #d9822b;
  --caramel-soft: #efad5b;
  --latte: #f6dfb7;
  --latte-2: #f2c987;
  --cream: #fff3d7;
  --foam: #fffaf0;
  --blue: #7896aa;
  --blue-soft: #d7e4eb;
  --rose-foam: #f3b17e;
  --ink-soft: #7a614d;
  --line: rgba(86, 42, 13, 0.18);

  --board-border: #6a4a33;
  --cell-light: #f4f1ea;
  --cell-dark: #ddd2c4;
  --cell-letter: #cfe2ec;
  --cell-word: #f0c27a;
  --cell-start: #e8a88d;
  --tile-face: #f7d85e;
  --tile-face-2: #efc64b;
  --tile-border: #7d5422;
  --tile-shadow: rgba(67, 31, 8, 0.14);

  --shadow: 0 18px 38px rgba(67, 31, 8, 0.14);
  --shadow-small: 0 8px 18px rgba(67, 31, 8, 0.11);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; background: var(--latte); }
body {
  min-height: 100%;
  padding: 18px 14px 56px;
  color: var(--espresso);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 250, 240, 0.78), transparent 18rem),
    radial-gradient(circle at 92% 8%, rgba(120, 150, 170, 0.22), transparent 20rem),
    radial-gradient(circle at 10% 60%, rgba(217, 130, 43, 0.18), transparent 24rem),
    linear-gradient(180deg, #f8dfb1 0%, #f4cf97 47%, #edc181 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(90deg, rgba(90, 42, 15, 0.20) 1px, transparent 1px),
    linear-gradient(0deg, rgba(90, 42, 15, 0.20) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 46%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 46%);
}

button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.58; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, .board-cell:focus-visible, .rack-tile:focus-visible {
  outline: 3px solid rgba(120, 150, 170, 0.45);
  outline-offset: 3px;
}

.hidden { display: none !important; }
.app-shell { position: relative; z-index: 1; width: min(100%, 1120px); margin: 0 auto; }

.setup-warning,
.login-overlay {
  min-height: calc(100vh - 78px);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
}

.setup-warning-card,
.login-card,
.panel,
.game-message,
.action-tray,
.rack-panel,
.result-card,
.waiting-card {
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(255, 239, 216, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.setup-warning-card {
  width: min(100%, 720px);
  padding: clamp(18px, 4vw, 30px);
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: center;
}

.setup-warning-icon {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: var(--shadow-small);
}

.setup-warning-card h1,
.login-card h1 {
  color: var(--espresso);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin-top: 10px;
}

.setup-warning-card p:not(.eyebrow),
.login-copy,
.helper-text,
.signed-in-label {
  color: var(--ink-soft);
  line-height: 1.5;
  font-weight: 750;
}

.setup-warning-card p:not(.eyebrow) { margin-top: 10px; }
.login-card { width: min(100%, 480px); padding: clamp(22px, 6vw, 38px); text-align: center; }
.app-logo { display: block; height: auto; object-fit: contain; }
.login-logo { width: min(82vw, 360px); max-height: none; margin: 0 auto 10px; }
.login-copy { margin: 14px 0 22px; }

.app-pill,
.section-kicker,
.eyebrow {
  color: var(--roast);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.app-pill {
  display: inline-flex;
  padding: 8px 12px;
  background: rgba(217, 130, 43, 0.13);
  border: 1px solid rgba(217, 130, 43, 0.16);
  border-radius: 999px;
}

.form-stack,
.setup-grid {
  display: grid;
  gap: 14px;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field { display: grid; gap: 8px; text-align: left; }
.field span { font-size: 0.9rem; font-weight: 900; color: var(--espresso); }

input, select {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  color: var(--espresso);
  background: linear-gradient(180deg, #fffaf5, #fff2e7);
  border: 2px solid rgba(90, 42, 15, 0.16);
  border-radius: var(--radius-sm);
  font-weight: 800;
}

select {
  padding-right: 44px;
  background:
    linear-gradient(45deg, transparent 50%, var(--roast) 50%),
    linear-gradient(135deg, var(--roast) 50%, transparent 50%),
    linear-gradient(180deg, #fffaf5, #fff2e7);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%, 0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  appearance: none;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
  min-height: 52px;
  padding: 13px 17px;
  border: none;
  border-radius: 18px;
  font-weight: 950;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.primary-btn { color: var(--foam); background: linear-gradient(180deg, var(--caramel), var(--mocha)); box-shadow: 0 10px 20px rgba(67,31,8,0.20); }
.secondary-btn { color: var(--espresso); background: linear-gradient(180deg, var(--foam), #fae5ca); border: 1px solid rgba(90, 42, 15, 0.18); }
.danger-btn { color: #fff5f3; background: linear-gradient(180deg, #c05d4d, #a44338); }
.ghost-btn { color: var(--espresso); background: rgba(255, 250, 240, 0.74); border: 1px solid rgba(90, 42, 15, 0.16); }
.small-btn { min-height: 38px; padding: 9px 12px; border-radius: 999px; font-size: 0.82rem; }
.full-width { grid-column: 1 / -1; width: 100%; }
.error-message { color: #9b3f35; font-weight: 900; text-align: left; }

.app-brand-header {
  position: relative;
  overflow: hidden;
  width: min(100%, 920px);
  margin: 0 auto 18px;
  padding: 6px 10px 18px;
  text-align: center;
}

.app-brand-header::before {
  content: "";
  position: absolute;
  inset: 24px 8% 0;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(255, 248, 242, 0.78), rgba(255, 248, 242, 0.28) 45%, transparent 72%);
  pointer-events: none;
}

.hero-topline {
  position: relative;
  z-index: 2;
  width: min(100%, 760px);
  margin: 0 auto 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.hero-brand { position: relative; z-index: 2; display: flex; justify-content: center; align-items: center; margin: 2px auto 4px; }
.hero-logo { width: min(88vw, 440px); max-height: none; margin: 0 auto; }
.bean-divider {
  position: relative;
  z-index: 2;
  width: min(360px, 70vw);
  margin: 4px auto 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--caramel);
}
.bean-divider span { height: 2px; background: linear-gradient(90deg, transparent, rgba(217, 130, 43, 0.55), transparent); }
.bean-divider b { color: var(--blue); font-size: 0.55rem; }
.signed-in-label { position: relative; z-index: 2; margin-top: 8px; text-align: center; font-size: 0.95rem; }

.lobby-layout,
.game-layout,
.side-column,
.leaderboard-list,
.game-card-list,
.matchup-list,
.info-list {
  display: grid;
  gap: 18px;
}

.panel { padding: 20px; }
.section-heading,
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.section-heading.compact { margin-bottom: 12px; }
h2, h3, .turn-card strong, .player-strip-label, .game-card-title, .matchup-title, .leaderboard-name, .info-label, .word-chip strong, .score-points {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
}
h2 { margin-top: 3px; color: var(--espresso); font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.05; }
h3 { color: var(--espresso); font-size: 1.22rem; }
.section-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 auto; background: linear-gradient(180deg, rgba(217, 130, 43, 0.22), rgba(217, 130, 43, 0.10)); border: 1px solid rgba(217, 130, 43, 0.16); border-radius: 18px; font-size: 1.65rem; }
.two-col { grid-template-columns: 1fr; }
.helper-text { margin-top: 14px; font-size: 0.95rem; }

.panel[data-empty="true"] { padding: 14px 20px; }
.panel[data-empty="true"] .section-heading { margin-bottom: 4px; }
.panel[data-empty="true"] h2 { font-size: 1rem; letter-spacing: -0.02em; }
.panel[data-empty="true"] .section-kicker { display: none; }

.game-card,
.matchup-row,
.leaderboard-row,
.info-row,
.word-chip {
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.72), rgba(255, 239, 216, 0.72));
  border: 1px solid rgba(90, 42, 15, 0.14);
  border-radius: 16px;
}

.game-card,
.matchup-row { display: grid; gap: 12px; padding: 14px; }
.game-card-top,
.matchup-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.game-card-title,
.matchup-title { color: var(--espresso); font-size: 1.16rem; line-height: 1.15; }
.game-card-meta,
.matchup-meta,
.leaderboard-record,
.info-value,
.empty-list { margin-top: 4px; color: var(--ink-soft); font-size: 0.9rem; font-weight: 800; line-height: 1.35; }
.game-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.game-card-actions button { flex: 1 1 120px; min-height: 44px; padding: 10px 12px; font-size: 0.9rem; }
.result-pill,
.record-pill,
.status-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.result-pill { color: var(--foam); background: var(--mocha); }
.result-pill.waiting { color: #8d5a1d; background: #f9ecd7; }
.result-pill.active { color: #2f6c45; background: #e6f4ea; }
.result-pill.your-turn { color: var(--foam); background: linear-gradient(180deg, var(--caramel), var(--mocha)); }
.result-pill.completed, .record-pill, .status-pill { color: var(--mocha); background: #f5e4cf; border: 1px solid rgba(217, 130, 43, 0.18); }
.game-card.your-turn-game { background: linear-gradient(180deg, #fff9f0, #ffe2b0); border-color: rgba(217, 130, 43, 0.35); box-shadow: 0 10px 22px rgba(107, 52, 17, 0.11), inset 0 0 0 1px rgba(217, 130, 43, 0.18); }
.leaderboard-row,
.info-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 13px; }

.game-layout { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr); align-items: start; }
.game-panel { overflow: hidden; padding: 16px; }
.game-header { margin-bottom: 10px; }
.game-header-actions { display: flex; align-items: center; gap: 8px; }
.inline-code-btn { display: inline-flex; align-items: center; min-height: auto; padding: 4px 8px; color: var(--mocha); background: #f8e4cc; border: 1px solid rgba(217, 130, 43, 0.20); border-radius: 999px; font-weight: 950; cursor: pointer; }
.turn-card { min-width: 128px; padding: 9px 12px; text-align: right; background: linear-gradient(180deg, #fff8ed, #f8e0c0); border: 1px solid rgba(90, 42, 15, 0.14); border-radius: 18px; box-shadow: var(--shadow-small); }
.turn-card span { display: block; color: var(--ink-soft); font-size: 0.69rem; font-weight: 950; text-transform: uppercase; letter-spacing: 0.10em; }
.turn-card strong { display: block; margin-top: 2px; color: var(--espresso); font-size: 1.12rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.waiting-card,
.result-card { width: min(100%, 720px); margin: 0 auto 10px; padding: 16px; text-align: center; border-radius: 20px; }
.waiting-card { display: grid; gap: 8px; background: #fff4df; border-color: rgba(217, 130, 43, 0.24); }
.waiting-card span,
.result-message { color: var(--ink-soft); font-weight: 800; line-height: 1.45; }
.code-card { min-height: 64px; color: var(--espresso); background: #fffaf2; border: 2px dashed rgba(217, 130, 43, 0.42); border-radius: 16px; font-size: 2rem; font-weight: 950; letter-spacing: 0.16em; cursor: pointer; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.score-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(100%, 720px); margin: 0 auto 8px; }
.score-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 18px; background: linear-gradient(180deg, rgba(255,250,240,0.78), rgba(255,239,216,0.78)); border: 1px solid rgba(90, 42, 15, 0.14); }
.score-card.active { background: linear-gradient(180deg, #fff6de, #ffd999); border-color: rgba(217, 130, 43, 0.42); box-shadow: inset 0 0 0 1px rgba(217, 130, 43, 0.16); }
.score-name { display: block; color: var(--espresso); font-weight: 950; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-meta { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 0.72rem; font-weight: 850; }
.score-points { color: var(--mocha); font-size: 1.25rem; white-space: nowrap; }

.board-wrap { width: min(100%, 720px); margin: 0 auto; overflow: hidden; border-radius: 22px; box-shadow: var(--shadow); }
.player-strip { display: grid; gap: 5px; min-height: 42px; padding: 9px 13px; color: var(--espresso); background: linear-gradient(180deg, #fffaf5, #fff1e5); border: 1px solid var(--line); font-weight: 900; }
.opponent-strip { border-radius: 22px 22px 0 0; }
.bottom-strip { border-radius: 0 0 22px 22px; }
.player-strip-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.player-strip-label { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-strip-score { color: var(--ink-soft); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }

.board-scroll { width: 100%; overflow: auto; background: #8a6a52; -webkit-overflow-scrolling: touch; }
.word-board { display: grid; grid-template-columns: repeat(15, 1fr); grid-template-rows: repeat(15, 1fr); width: 100%; aspect-ratio: 1 / 1; min-width: 0; border: 5px solid var(--board-border); gap: 2px; background: var(--board-border); touch-action: manipulation; }
body.board-zoomed .word-board { width: 900px; max-width: none; }
.board-cell { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: var(--cell-light); color: var(--espresso); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(90, 42, 15, 0.06); }
.board-cell.dark { background: var(--cell-light); }
.board-cell.bean { background: var(--cell-letter); }
.board-cell.mug { background: var(--cell-word); }
.board-cell.start { background: var(--cell-start); }
.board-cell:not(.occupied):hover { filter: brightness(1.05); }
.board-cell.pending { box-shadow: inset 0 0 0 3px rgba(120, 150, 170, 0.60); }
.cell-label { position: absolute; inset: auto 2px 2px 2px; color: rgba(42, 18, 7, 0.62); font-size: clamp(0.38rem, 1vw, 0.52rem); font-weight: 950; line-height: 1; text-align: center; text-transform: uppercase; letter-spacing: 0.02em; pointer-events: none; }

.tile-face { width: 84%; height: 84%; display: grid; place-items: center; position: relative; border-radius: 6px; background: linear-gradient(180deg, var(--tile-face), var(--tile-face-2)); border: 2.5px solid var(--tile-border); color: #2a1207; box-shadow: 0 2px 0 rgba(67,31,8,0.22), 0 4px 8px var(--tile-shadow); font-family: var(--font-ui); font-weight: 950; font-size: clamp(0.92rem, 2.9vw, 1.42rem); letter-spacing: 0.01em; line-height: 1; user-select: none; }
.tile-face .tile-value { position: absolute; right: 4px; bottom: 3px; color: rgba(42, 18, 7, 0.82); font-family: var(--font-ui); font-size: 0.5rem; font-weight: 950; }
.board-cell.occupied { background: #f8f5ee; }

.rack-panel { width: min(100%, 720px); margin: 10px auto 0; padding: 12px; border-radius: 20px; }
.rack-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bag-count { color: var(--ink-soft); font-size: 0.84rem; font-weight: 850; white-space: nowrap; }
.tile-rack { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.rack-tile { aspect-ratio: 1 / 1.06; min-width: 0; border: 2.5px solid var(--tile-border); border-radius: 11px; background: linear-gradient(180deg, var(--tile-face), var(--tile-face-2)); color: #2a1207; box-shadow: 0 3px 0 rgba(67,31,8,0.22), 0 8px 14px var(--tile-shadow); font-family: var(--font-ui); font-weight: 950; font-size: clamp(1.18rem, 5vw, 1.78rem); letter-spacing: 0.01em; position: relative; transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease; }
.rack-tile.selected { outline: 3px solid var(--blue); outline-offset: 2px; transform: translateY(-3px); border-color: var(--dark-roast); box-shadow: 0 4px 0 rgba(67,31,8,0.24), 0 14px 24px rgba(67,31,8,0.18); }
.rack-tile .tile-value { position: absolute; right: 8px; bottom: 6px; font-family: var(--font-ui); font-size: 0.62rem; font-weight: 950; color: rgba(42,18,7,0.72); }

.action-tray { width: min(100%, 720px); margin: 10px auto 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 20px; }
.brew-preview { min-width: 0; padding: 8px 10px; border-radius: 15px; background: rgba(255,250,240,0.62); border: 1px solid rgba(90,42,15,0.10); }
.brew-preview span { display: block; color: var(--ink-soft); font-size: 0.68rem; font-weight: 950; text-transform: uppercase; letter-spacing: 0.12em; }
.brew-preview strong { display: block; color: var(--espresso); font-size: 0.96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-buttons { display: flex; gap: 7px; }
.action-buttons button { min-height: 44px; padding: 10px 12px; border-radius: 14px; }
.game-message { width: min(100%, 720px); min-height: 45px; margin: 10px auto 0; padding: 12px 13px; color: var(--espresso); border-radius: 16px; font-weight: 800; line-height: 1.35; }
.game-message.good { color: #355f3b; background: #edf7e8; }
.game-message.warn { color: #7c4b18; background: #fff2cf; }
.game-message.bad { color: #8d3140; background: #ffe9ee; }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 720px); margin: 10px auto 0; }

.formed-words { display: grid; gap: 8px; }
.word-chip { display: flex; justify-content: space-between; gap: 8px; padding: 11px 12px; }
.word-chip strong { color: var(--espresso); letter-spacing: 0.04em; }
.word-chip span { color: var(--ink-soft); font-weight: 850; }
.legend-list { display: grid; gap: 10px; }
.legend-row { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; color: var(--ink-soft); font-size: 0.92rem; }
.legend-row strong { display: block; color: var(--espresso); }
.legend-row small { display: block; margin-top: 2px; color: var(--ink-soft); font-weight: 750; line-height: 1.3; }
.legend-swatch { width: 34px; height: 34px; border-radius: 11px; border: 1px solid rgba(90,42,15,0.14); }
.legend-swatch.start { background: var(--cell-start); }
.legend-swatch.bean { background: var(--cell-letter); }
.legend-swatch.mug { background: var(--cell-word); }
.turn-history { list-style: none; display: grid; gap: 9px; max-height: min(420px, 55vh); overflow: auto; }
.turn-history li { padding: 10px 12px; color: var(--ink-soft); background: linear-gradient(180deg, rgba(255,250,240,0.70), rgba(255,239,216,0.70)); border: 1px solid rgba(90,42,15,0.12); border-radius: 13px; font-weight: 800; }
.turn-history li strong { display: block; color: var(--espresso); margin-bottom: 2px; }

body.in-game { padding-top: 8px; scroll-behavior: auto; }
body.in-game .app-brand-header { display: none; }
body.in-game main { margin-top: 0; }

@media (min-width: 720px) {
  body { padding: 28px 22px 72px; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .lobby-layout { grid-template-columns: 1fr 1fr; }
  .games-list-panel, .matchup-panel, .leaderboard-panel { grid-column: 1 / -1; }
}

@media (min-width: 980px) {
  .game-panel { position: sticky; top: 18px; }
  .lobby-layout { grid-template-columns: 1fr 1fr minmax(280px, 0.8fr); align-items: start; }
  .games-list-panel, .matchup-panel, .leaderboard-panel { grid-column: auto; }
}

@media (max-width: 880px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body.in-game { padding: max(6px, env(safe-area-inset-top)) 0 28px; }
  body.in-game .app-shell { width: 100%; margin: 0; }
  body.in-game .game-layout { display: block; width: 100%; gap: 0; }
  body.in-game .game-panel { width: 100%; padding: 8px 8px 18px; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; background: rgba(255, 250, 240, 0.96); }
  body.in-game .game-header { width: min(calc(100vw - 16px), 720px); margin: 0 auto 8px; padding: 0 2px; align-items: center; }
  body.in-game .game-header h2 { font-size: 1.65rem; }
  body.in-game .section-kicker { font-size: 0.66rem; letter-spacing: 0.12em; }
  body.in-game .turn-card { min-width: 104px; padding: 8px 9px; border-radius: 16px; }
  body.in-game .turn-card span { font-size: 0.62rem; }
  body.in-game .turn-card strong { font-size: 0.92rem; max-width: 92px; }
  body.in-game #zoom-board-btn { min-height: 36px; padding: 8px 10px; }
  body.in-game .score-bar, body.in-game .waiting-card, body.in-game .result-card, body.in-game .board-wrap, body.in-game .rack-panel, body.in-game .action-tray, body.in-game .game-message, body.in-game .game-actions, body.in-game .side-column { width: min(calc(100vw - 16px), 720px); }
  body.in-game .board-wrap { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); border-radius: 0; }
  body.in-game .word-board { border-left-width: 0; border-right-width: 0; border-top-width: 5px; border-bottom-width: 5px; gap: 1px; }
  body.in-game .opponent-strip, body.in-game .bottom-strip { border-radius: 0; padding-left: 18px; padding-right: 18px; }
  body.in-game .player-strip { min-height: 34px; padding-top: 7px; padding-bottom: 7px; }
  body.in-game .player-strip-label { font-size: 0.98rem; }
  body.in-game .player-strip-score { font-size: 0.70rem; }
  body.in-game .cell-label { display: none; }
  body.in-game .tile-face { width: 90%; height: 90%; border-radius: 4px; font-family: var(--font-ui); font-weight: 950; font-size: clamp(0.72rem, 4vw, 1.08rem); }
  body.in-game .tile-face .tile-value { display: none; }
  body.board-zoomed .word-board { width: min(900px, 235vw); }
  body.in-game .rack-panel { padding: 10px; }
  body.in-game .tile-rack { gap: 6px; }
  body.in-game .rack-tile { border-radius: 11px; }
  body.in-game .rack-tile .tile-value { right: 6px; bottom: 5px; font-size: 0.54rem; }
  body.in-game .action-tray { grid-template-columns: 1fr; }
  body.in-game .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  body.in-game .game-actions { position: sticky; bottom: 8px; z-index: 20; margin-top: 10px; padding: 8px; border-radius: 18px; background: rgba(247, 225, 190, 0.88); box-shadow: 0 12px 32px rgba(67,31,8,0.18); backdrop-filter: blur(12px); }
  .side-column { grid-template-columns: 1fr; width: min(calc(100vw - 16px), 720px); margin: 14px auto 0; }
  .side-column .panel { border-radius: 22px; padding: 14px; box-shadow: var(--shadow-small); }
  .result-actions, .login-actions { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { padding-left: 10px; padding-right: 10px; }
  .hero-logo { width: min(92vw, 360px); }
  .login-logo { width: min(84vw, 320px); }
  .setup-warning-card { grid-template-columns: 1fr; text-align: center; }
  .setup-warning-icon { margin: 0 auto; }
  .score-bar { grid-template-columns: 1fr; }
  body.in-game .score-bar { grid-template-columns: 1fr 1fr; }
  body.in-game .score-card { padding: 8px 9px; }
  body.in-game .score-points { font-size: 1.02rem; }
  body.in-game .score-name { font-size: 0.78rem; }
  body.in-game .score-meta { display: none; }
  .game-header-actions { gap: 6px; }
  .game-actions { grid-template-columns: 1fr; }
}
