/* ==========================================================================
   Solve 8 Words Online — style.css
   Design tokens, themes, layout, boards, keyboard, modals, animations
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font-stack: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Light theme — Octordle-inspired mint */
  --bg: #eef7f0;
  --bg-elevated: #ffffff;
  --bg-subtle: #e3f0e6;
  --text: #202124;
  --text-muted: #5f6368;
  --border: #c5dcc9;
  --border-strong: #8fb89a;

  --accent: #1e8e3e;
  --accent-soft: rgba(30, 142, 62, 0.12);

  --correct: #538d4e;
  --present: #b59f3b;
  --absent: #787c7e;
  --tile-fg-feedback: #ffffff;

  --key-bg: #202124;
  --key-fg: #e6f4ea;

  --shadow-sm: 0 1px 3px rgba(32, 33, 36, 0.08);
  --shadow-lg: 0 18px 50px rgba(32, 33, 36, 0.18);

  --radius: 12px;
  --radius-sm: 7px;

  --header-h: 56px;
  --anim-flip: 380ms;
  --ease-pop: cubic-bezier(0.2, 1.4, 0.4, 1);
}

[data-theme="dark"] {
  --bg: #12161c;
  --bg-elevated: #181e27;
  --bg-subtle: #1f2732;
  --text: #e8eaf0;
  --text-muted: #97a0b0;
  --border: #2d3848;
  --border-strong: #424a5c;

  --accent: #81c995;
  --accent-soft: rgba(129, 201, 149, 0.16);

  --correct: #538d4e;
  --present: #b59f3b;
  --absent: #3c4250;
  --tile-fg-feedback: #ffffff;

  --key-bg: #2b3140;
  --key-fg: #e8eaf0;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
}

/* High contrast: orange / blue palette (color-blind friendly) */
[data-contrast="high"] {
  --correct: #e66100;
  --present: #1c6fd6;
}
[data-contrast="high"][data-theme="dark"] {
  --correct: #f5793a;
  --present: #549fff;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 200ms ease, color 200ms ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px; left: 12px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
  text-decoration: none;
  transition: top 150ms ease;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 32px; height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  overflow: hidden;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }

.brand-name {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border-radius: 999px;
  padding: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.mode-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background-color 160ms ease, color 160ms ease;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background-color 140ms ease, color 140ms ease;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* Theme toggle shows the icon of the mode you'd switch to */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Status bar ---------- */
.status-bar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.status-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 14px 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  position: relative;
}

.puzzle-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.status-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}
.status-chip svg { width: 16px; height: 16px; fill: currentColor; }

.text-btn {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background-color 140ms ease;
}
.text-btn:hover { background: var(--accent-soft); }

.progress-track {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: transparent;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--correct), color-mix(in srgb, var(--correct) 55%, var(--accent)));
  border-radius: 0 3px 3px 0;
  transition: width 450ms var(--ease-pop);
}

/* ---------- Game area / boards ---------- */
.game-area {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 10px 18px;
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
}

@media (min-width: 700px) {
  .boards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 16px; }
  .game-area { padding: 20px 16px 26px; }
}

.board {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 250ms ease, box-shadow 250ms ease, opacity 250ms ease;
}

.board.is-solved {
  border-color: var(--correct);
  box-shadow: 0 0 0 1px var(--correct), 0 4px 18px color-mix(in srgb, var(--correct) 25%, transparent);
}
.board.is-solved .board-grid { opacity: 0.85; }

.board-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.board-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.board-solved-badge {
  display: none;
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--correct);
  letter-spacing: 0.03em;
}
.board.is-solved .board-solved-badge { display: inline; }

.hint-chip {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board.is-solved .hint-chip { display: none; }

.board-grid {
  display: grid;
  grid-template-rows: repeat(13, 1fr);
  gap: 4px;
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

/* ---------- Tiles ---------- */
.tile {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: clamp(0.8rem, 3.4vw, 1.25rem);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  user-select: none;
  transition: transform 90ms ease, border-color 140ms ease, background-color 140ms ease;
}

@media (min-width: 700px) {
  .tile { font-size: clamp(0.9rem, 1.6vw, 1.2rem); border-radius: 8px; }
}

.tile.is-filled {
  border-color: var(--border-strong);
  animation: tile-pop 110ms var(--ease-pop);
}

.tile.is-correct, .tile.is-present, .tile.is-absent {
  border-color: transparent;
  color: var(--tile-fg-feedback);
}
.tile.is-correct { background: var(--correct); }
.tile.is-present { background: var(--present); }
.tile.is-absent  { background: var(--absent); }

.tile.is-reveal { animation: tile-flip var(--anim-flip) ease both; }

.board-row.is-shake { animation: row-shake 480ms ease; }

@keyframes tile-pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes tile-flip {
  0% { transform: rotateX(0); }
  49% { transform: rotateX(90deg); }
  51% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

@keyframes row-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
  50% { transform: translateX(-3px); }
}

@keyframes board-win {
  0% { transform: scale(1); }
  45% { transform: scale(1.035); }
  100% { transform: scale(1); }
}
.board.is-won-anim { animation: board-win 500ms var(--ease-pop); }

/* ---------- Keyboard ---------- */
.keyboard {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 0 auto 6px;
  max-width: 560px;
}
.kb-row:last-child { margin-bottom: 0; }

.key {
  position: relative;
  flex: 1 1 0;
  max-width: 46px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--key-bg);
  color: var(--key-fg);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  overflow: hidden;
  transition: filter 120ms ease, transform 80ms ease;
}
.key:hover { filter: brightness(1.07); }
.key:active { transform: scale(0.93); }
[data-keyanim="on"] .key.is-pressed { animation: key-press 140ms ease; }

@keyframes key-press {
  0% { transform: scale(1); }
  50% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

.key--wide {
  flex: 1.6 1 0;
  max-width: 72px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.key svg { width: 22px; height: 22px; fill: currentColor; }

/* 8 mini-cells per key: one per board */
.key-segs {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  pointer-events: none;
}
.key-seg { background: transparent; transition: background-color 250ms ease; }
.key-seg.is-correct { background: var(--correct); }
.key-seg.is-present { background: var(--present); }
.key-seg.is-absent  { background: color-mix(in srgb, var(--absent) 58%, var(--key-bg)); }

.key-label {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.key.is-all-absent .key-label { opacity: 0.55; text-shadow: none; }

@media (min-width: 700px) {
  .key { height: 56px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + 54px);
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  animation: toast-in 200ms var(--ease-pop);
  max-width: min(90vw, 420px);
  text-align: center;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal[hidden] { display: none; }

@media (min-width: 560px) {
  .modal { align-items: center; padding: 24px; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 180ms ease;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(86dvh, 720px);
  background: var(--bg-elevated);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: sheet-up 260ms var(--ease-pop);
}

@media (min-width: 560px) {
  .modal-card { border-radius: 18px; animation: card-in 220ms var(--ease-pop); }
}

.modal-card--small { max-width: 420px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes card-in { from { transform: scale(0.94) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}
.modal-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }

.modal-body {
  padding: 4px 20px 24px;
  overflow-y: auto;
  line-height: 1.55;
}
.modal-body h3 { font-size: 0.98rem; margin: 20px 0 8px; }
.modal-body p { margin: 8px 0; font-size: 0.94rem; }

/* Example tiles in help modal */
.example-row { display: flex; gap: 5px; margin: 12px 0 4px; }
.ex-tile {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--bg);
}
.ex-tile.is-correct { background: var(--correct); border-color: transparent; color: #fff; }
.ex-tile.is-present { background: var(--present); border-color: transparent; color: #fff; }
.ex-tile.is-absent  { background: var(--absent); border-color: transparent; color: #fff; }

.hl-green  { color: var(--correct); }
.hl-yellow { color: var(--present); }
.hl-gray   { color: var(--absent); }
[data-theme="dark"] .hl-gray { color: var(--text-muted); }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 14px;
}

.stat {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Settings ---------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.setting-name { display: block; font-weight: 600; font-size: 0.95rem; }
.setting-desc { display: block; font-size: 0.8rem; color: var(--text-muted); }

.switch {
  flex: 0 0 auto;
  width: 50px; height: 29px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background-color 180ms ease;
}
.switch[aria-checked="true"] { background: var(--correct); }
.switch-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 180ms var(--ease-pop);
}
.switch[aria-checked="true"] .switch-knob { transform: translateX(21px); }

.settings-subhead {
  margin: 22px 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.modes-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.mode-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  text-align: left;
  font-size: 0.88rem;
}
.mode-item.is-active { border-color: var(--correct); background: color-mix(in srgb, var(--correct) 9%, var(--bg-elevated)); }
.mode-item .mode-name { font-weight: 700; }
.mode-item .mode-meta { font-size: 0.72rem; color: var(--text-muted); }
.mode-item:disabled { opacity: 0.6; cursor: not-allowed; }

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-subtle);
}
.plan-badge {
  display: inline-block;
  background: var(--correct);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Hint modal ---------- */
.big-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  transition: border-color 140ms ease, background-color 140ms ease, transform 90ms ease;
}
.big-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.big-btn:active { transform: scale(0.985); }
.big-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.big-btn-title { font-weight: 700; font-size: 0.98rem; }
.big-btn-desc { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Result modal ---------- */
.result-summary { font-size: 1.05rem; font-weight: 600; }

.result-words {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 14px 0 18px;
}

.result-word {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.95rem;
}
.result-word.is-solved { border-color: var(--correct); color: var(--correct); }
.result-word .rw-guess { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0; }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.primary-btn, .secondary-btn {
  flex: 1 1 140px;
  padding: 13px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: filter 140ms ease, transform 90ms ease;
}
.primary-btn { background: var(--correct); color: #fff; }
.secondary-btn { background: var(--bg-subtle); border: 1px solid var(--border); }
.primary-btn:hover, .secondary-btn:hover { filter: brightness(1.07); }
.primary-btn:active, .secondary-btn:active { transform: scale(0.98); }

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: 10px 16px 14px;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.app-footer p { margin: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .brand-name { font-size: 0.95rem; }
  .brand-sub { display: none; }
  .header-inner { padding: 0 6px; gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .mode-tab { padding: 6px 12px; font-size: 0.82rem; }
  .key { height: 50px; }
  .app-footer { display: none; }
}

@media (max-width: 360px) {
  .mode-tabs { padding: 3px; }
  .mode-tab { padding: 5px 9px; font-size: 0.78rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

[data-motion="reduce"] *,
[data-motion="reduce"] *::before,
[data-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ---------- Mode strip & menu panel ---------- */
.modes-strip {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.modes-strip::-webkit-scrollbar { display: none; }
.modes-strip-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  min-width: min-content;
}
.mode-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease, transform 90ms ease;
}
.mode-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.mode-chip:active { transform: scale(0.97); }
.mode-chip.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.menu-panel[hidden] { display: none; }
.menu-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.menu-panel-brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 0;
}
.menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 28px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.menu-intro {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.menu-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 18px 0 10px;
}
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.92rem;
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.menu-list-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.menu-list-item.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  cursor: default;
}
.menu-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-item-text strong { font-size: 0.95rem; }
.menu-item-meta { font-size: 0.76rem; color: var(--text-muted); font-weight: 500; }
.menu-list-item .chevron { width: 18px; height: 18px; fill: var(--text-muted); flex-shrink: 0; }

html.is-embedded, html.is-embedded body { min-height: 100%; height: 100%; }
html.is-embedded body { overflow: hidden; }
html.is-embedded .game-area { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
html.is-embedded .keyboard { position: relative; flex-shrink: 0; }
html.is-embedded .modes-strip { flex-shrink: 0; }
html.is-embedded .app-footer { display: none; }

@media (max-width: 480px) {
  .modes-strip-inner { padding: 6px 8px; }
  .mode-chip { padding: 6px 11px; font-size: 0.72rem; }
  .header-actions { gap: 0; }
}
