:root {
  color-scheme: light;
  --visible-height: 100vh;
  --ui-font: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --logo-font: "Nabla", "Fredoka", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --ink: #182026;
  --muted: #66737f;
  --line: #c9d2da;
  --panel: #f5f7f8;
  --paper: #ffffff;
  --black: #111820;
  --given: #d8f0df;
  --active: #fff1b8;
  --bad: #f8d7da;
  --good: #dcecfb;
  --accent: #cf6b35;
  --accent-strong: #7b3df0;
  --coin: #ffb84d;
  --mint: #3ebc8a;
  --berry: #e75d8e;
  --sky: #49a7d9;
  --page-bg: linear-gradient(135deg, #f7f6f1, #dfddd4);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-soft: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(18, 20, 22, 0.18);
  --glass-shadow: rgba(18, 20, 22, 0.15);
}

body[data-theme="editorial-light"] {
  --ui-font: "Libre Baskerville", Georgia, serif;
  --logo-font: "Libre Baskerville", Georgia, serif;
  --ink: #111111;
  --muted: #5f5f5f;
  --line: rgba(0, 0, 0, 0.24);
  --panel: rgba(255, 255, 255, 0.86);
  --paper: #ffffff;
  --black: #050505;
  --given: #eeeeee;
  --active: #f4f0da;
  --bad: #ead8d6;
  --good: #e4e9e2;
  --accent: #111111;
  --accent-strong: #111111;
  --coin: #b58a2a;
  --mint: #536f5a;
  --berry: #7b4a58;
  --sky: #5a6970;
  --page-bg: linear-gradient(180deg, #fbfbf8, #e6e4dc);
}

body[data-theme="editorial-dark"] {
  color-scheme: dark;
  --ui-font: "Merriweather", Georgia, serif;
  --logo-font: "Merriweather", Georgia, serif;
  --ink: #f4f1e8;
  --muted: #aaa79e;
  --line: rgba(244, 241, 232, 0.22);
  --panel: rgba(18, 18, 17, 0.78);
  --paper: #1d1d1b;
  --black: #050505;
  --given: #33332f;
  --active: #403c2d;
  --bad: #4a2c2c;
  --good: #2f3a32;
  --accent: #e0d8bd;
  --accent-strong: #ffffff;
  --coin: #d1aa52;
  --mint: #8daf90;
  --berry: #c17b88;
  --sky: #9bb3bd;
  --page-bg: linear-gradient(135deg, #060606, #23231f);
  --glass: rgba(22, 22, 20, 0.66);
  --glass-strong: rgba(24, 24, 22, 0.88);
  --glass-soft: rgba(30, 30, 27, 0.42);
  --glass-border: rgba(235, 230, 214, 0.18);
  --glass-shadow: rgba(0, 0, 0, 0.45);
}

body[data-theme="rosewater"] {
  --ui-font: "Quicksand", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Playfair Display", Georgia, serif;
  --ink: #37252b;
  --muted: #8a6870;
  --line: rgba(150, 95, 108, 0.28);
  --panel: rgba(255, 246, 246, 0.8);
  --paper: #fffafb;
  --black: #21181c;
  --given: #f4dfe6;
  --active: #fff0be;
  --bad: #f2c7cb;
  --good: #e5ead6;
  --accent: #c95f82;
  --accent-strong: #8d3155;
  --coin: #d69b4d;
  --mint: #80a96e;
  --berry: #d8518a;
  --sky: #79a8c7;
  --page-bg: linear-gradient(135deg, #fff3f4, #f1dce8);
}

body[data-theme="violet-hour"] {
  color-scheme: dark;
  --ui-font: "Outfit", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Fraunces", Georgia, serif;
  --ink: #f6eaff;
  --muted: #bfaed1;
  --line: rgba(213, 180, 255, 0.28);
  --panel: rgba(35, 22, 52, 0.78);
  --paper: #2d203f;
  --black: #08050f;
  --given: #493763;
  --active: #5b3e6c;
  --bad: #5e2f45;
  --good: #334d4d;
  --accent: #d99cff;
  --accent-strong: #ffe28a;
  --coin: #ffd36b;
  --mint: #8ee5c5;
  --berry: #f088bd;
  --sky: #9cc7ff;
  --page-bg: linear-gradient(135deg, #0b0713, #38214f);
  --glass: rgba(35, 22, 52, 0.58);
  --glass-strong: rgba(39, 25, 58, 0.82);
  --glass-soft: rgba(45, 28, 66, 0.42);
  --glass-border: rgba(213, 180, 255, 0.24);
  --glass-shadow: rgba(0, 0, 0, 0.48);
}

body[data-theme="meadow"] {
  --ui-font: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Fraunces", Georgia, serif;
  --ink: #1c3024;
  --muted: #5e7567;
  --line: rgba(67, 116, 83, 0.25);
  --panel: rgba(244, 251, 239, 0.82);
  --paper: #fbfff7;
  --black: #102017;
  --given: #dcefd6;
  --active: #fff1b7;
  --bad: #f1d6cf;
  --good: #d9eadc;
  --accent: #4d8b5d;
  --accent-strong: #2e663d;
  --coin: #d6a34d;
  --mint: #55b77e;
  --berry: #c85d78;
  --sky: #67a9c9;
  --page-bg: linear-gradient(135deg, #eef8e7, #dcecd4);
}

body[data-theme="harbour"] {
  --ui-font: "Space Grotesk", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Playfair Display", Georgia, serif;
  --ink: #052b3a;
  --muted: #346f7d;
  --line: rgba(0, 121, 149, 0.34);
  --panel: #e1f7fa;
  --paper: #f4feff;
  --black: #031822;
  --given: #c3e8ed;
  --active: #b3f0ee;
  --bad: #ead4d2;
  --good: #d2f3f7;
  --accent: #0089a4;
  --accent-strong: #004f67;
  --coin: #d59d34;
  --mint: #00a78f;
  --berry: #bf4d76;
  --sky: #00a8d8;
  --page-bg: #d5f2f6;
  --glass: rgba(225, 247, 250, 0.88);
  --glass-strong: #f4feff;
  --glass-soft: rgba(195, 232, 237, 0.62);
  --glass-border: rgba(0, 121, 149, 0.3);
  --glass-shadow: rgba(5, 43, 58, 0.16);
}

body[data-theme="clubhouse"] {
  --ui-font: "Space Grotesk", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Merriweather", Georgia, serif;
  --ink: #14230f;
  --muted: #475d3c;
  --line: rgba(41, 95, 38, 0.38);
  --panel: #eef2d5;
  --paper: #fbf8dc;
  --black: #071205;
  --given: #cfdf9d;
  --active: #f6d34f;
  --bad: #ead0c2;
  --good: #d9e6b3;
  --accent: #2f6f2f;
  --accent-strong: #19501d;
  --coin: #f0c52e;
  --mint: #477b2e;
  --berry: #8d3b29;
  --sky: #41687d;
  --page-bg: #d7cf8d;
  --glass: rgba(238, 242, 213, 0.88);
  --glass-strong: #fbf8dc;
  --glass-soft: rgba(207, 223, 157, 0.5);
  --glass-border: rgba(41, 95, 38, 0.32);
  --glass-shadow: rgba(20, 35, 15, 0.18);
}

body[data-theme="graphite"] {
  color-scheme: dark;
  --ui-font: "Space Grotesk", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Space Grotesk", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --ink: #f0f2f4;
  --muted: #a2aab2;
  --line: rgba(230, 237, 243, 0.18);
  --panel: rgba(25, 29, 33, 0.8);
  --paper: #20262b;
  --black: #05080a;
  --given: #303a3f;
  --active: #3b3728;
  --bad: #4a2d32;
  --good: #2d3a37;
  --accent: #b9c3cc;
  --accent-strong: #ffffff;
  --coin: #d2a84b;
  --mint: #84b998;
  --berry: #c9788d;
  --sky: #86b8d0;
  --page-bg: linear-gradient(135deg, #080b0e, #2a3036);
  --glass: rgba(28, 32, 36, 0.64);
  --glass-strong: rgba(31, 36, 41, 0.86);
  --glass-soft: rgba(38, 44, 50, 0.42);
  --glass-border: rgba(230, 237, 243, 0.16);
  --glass-shadow: rgba(0, 0, 0, 0.5);
}

body[data-theme="mint-cream"] {
  --ui-font: "Quicksand", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Fredoka", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --ink: #23312e;
  --muted: #66817b;
  --line: rgba(88, 148, 134, 0.26);
  --panel: rgba(246, 255, 250, 0.82);
  --paper: #fbfffd;
  --black: #12211d;
  --given: #d9f1e5;
  --active: #fff3ba;
  --bad: #f2d5d4;
  --good: #d8ede6;
  --accent: #42a584;
  --accent-strong: #28735b;
  --coin: #d1a646;
  --mint: #45b98a;
  --berry: #c75e8a;
  --sky: #69b5cc;
  --page-bg: linear-gradient(135deg, #f4fff8, #dff3ea);
}

body[data-theme="newsprint"] {
  --ui-font: "Libre Baskerville", Georgia, serif;
  --logo-font: "Merriweather", Georgia, serif;
  --ink: #0f0f0f;
  --muted: #555555;
  --line: rgba(0, 0, 0, 0.3);
  --panel: #f4f4f1;
  --paper: #ffffff;
  --black: #060606;
  --given: #ececec;
  --active: #dedede;
  --bad: #d9d9d9;
  --good: #eeeeee;
  --accent: #111111;
  --accent-strong: #000000;
  --coin: #707070;
  --mint: #454545;
  --berry: #555555;
  --sky: #666666;
  --page-bg: #ededeb;
  --glass: #f4f4f1;
  --glass-strong: #ffffff;
  --glass-soft: #eeeeeb;
  --glass-border: rgba(0, 0, 0, 0.28);
  --glass-shadow: rgba(0, 0, 0, 0.08);
}

body[data-theme="midnight"] {
  color-scheme: dark;
  --ui-font: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Merriweather", Georgia, serif;
  --ink: #f5f5f6;
  --muted: #b8b8c0;
  --line: rgba(255, 255, 255, 0.22);
  --panel: #18191d;
  --paper: #23242a;
  --black: #000000;
  --given: #34363c;
  --active: #38314d;
  --bad: #513333;
  --good: #363f39;
  --accent: #8b7cff;
  --accent-strong: #ffffff;
  --coin: #a99eff;
  --mint: #c9c9ce;
  --berry: #d0d0d4;
  --sky: #b6b6c0;
  --page-bg: #0a0a0d;
  --glass: #17181b;
  --glass-strong: #202127;
  --glass-soft: #24252a;
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: rgba(0, 0, 0, 0.32);
}

body[data-theme="retro-8bit"] {
  --ui-font: "Pixelify Sans", "Space Grotesk", "Courier New", monospace;
  --logo-font: "Pixelify Sans", "Space Grotesk", "Courier New", monospace;
  --ink: #fff2aa;
  --muted: #9ed5ff;
  --line: #ffd21f;
  --panel: #15277f;
  --paper: #1d3baa;
  --black: #050817;
  --given: #133f65;
  --active: #ffd21f;
  --bad: #e23a3a;
  --good: #00a878;
  --accent: #00b7eb;
  --accent-strong: #ffd21f;
  --coin: #ffd21f;
  --mint: #00a878;
  --berry: #e64ea6;
  --sky: #00b7eb;
  --page-bg: #0b1552;
  --glass: #15277f;
  --glass-strong: #1d3baa;
  --glass-soft: #101f66;
  --glass-border: #ffda3a;
  --glass-shadow: rgba(0, 0, 0, 0.22);
}

body[data-theme="royal-arcade"] {
  color-scheme: dark;
  --ui-font: "Outfit", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --logo-font: "Nabla", "Fredoka", "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --ink: #fff0c8;
  --muted: #d2b792;
  --line: rgba(255, 186, 99, 0.42);
  --panel: rgba(38, 20, 40, 0.68);
  --paper: #24182a;
  --black: #07050b;
  --given: #523d25;
  --active: #482646;
  --bad: #5b2630;
  --good: #2d3a3b;
  --accent: #ff934f;
  --accent-strong: #ffd064;
  --coin: #ffcf5a;
  --mint: #72dfb2;
  --berry: #f075b8;
  --sky: #7fd5e7;
  --page-bg: linear-gradient(135deg, #09030d, #2c1437);
  --glass: rgba(28, 14, 32, 0.58);
  --glass-strong: rgba(36, 18, 39, 0.78);
  --glass-soft: rgba(44, 21, 50, 0.4);
  --glass-border: rgba(255, 202, 102, 0.36);
  --glass-shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: var(--visible-height);
  overflow: hidden;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--ui-font);
}

.mobile-screen-message {
  display: none !important;
}

.mobile-gamebar,
.mobile-drawer-close {
  display: none;
}

.app {
  width: min(1500px, calc(100vw - 20px));
  height: var(--visible-height);
  margin: 0 auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand-logo {
  position: relative;
  display: inline-grid;
  gap: 0;
  width: 100%;
  margin: 0 0 3px;
  padding-top: 6px;
  color: var(--ink);
  font-family: "Fraunces", "Playfair Display", Georgia, serif;
  line-height: 0.86;
  letter-spacing: 0;
}

.brand-logo span {
  width: max-content;
  transform: rotate(-8deg) translateX(3px);
  color: var(--accent);
  font-family: "Outfit", var(--ui-font);
  font-size: clamp(12px, 1.25vw, 16px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-logo strong {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  max-width: 100%;
  font-size: clamp(25px, 2.35vw, 31px);
  font-weight: 900;
  white-space: nowrap;
}

.brand-logo small {
  display: inline-block;
  margin-bottom: 0.08em;
  color: var(--accent-strong);
  font-family: "Outfit", var(--ui-font);
  font-size: 0.34em;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

h1 {
  margin: 0;
  font-family: var(--logo-font);
  font-size: clamp(29px, 3vw, 36px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.95;
  filter: drop-shadow(0 4px 0 rgba(91, 55, 24, 0.25));
}

body[data-theme="editorial-light"] h1,
body[data-theme="editorial-dark"] h1,
body[data-theme="graphite"] h1 {
  color: var(--ink);
  font-weight: 900;
  filter: none;
}

p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 14px);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.actions button:last-child {
  grid-column: 1 / -1;
}

.actions button[aria-pressed="true"] {
  border-color: rgba(255, 214, 107, 0.78);
  background: linear-gradient(180deg, rgba(255, 214, 107, 0.34), rgba(216, 131, 62, 0.28));
  color: var(--accent-strong);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 44%, var(--line));
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 94%, white), color-mix(in srgb, var(--paper) 82%, var(--coin)));
  color: var(--ink);
  padding: 0 8px;
  font-family: var(--ui-font);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(123, 61, 240, 0.08), 0 4px 10px rgba(31, 50, 59, 0.07);
}

body[data-theme="bedtime"] button,
body[data-theme="arcade"] button,
body[data-theme="retro-8bit"] button {
  border-color: #6d5138;
  background: linear-gradient(180deg, #2a1d14, #1d130d);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(216, 131, 62, 0.12), 0 4px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

body[data-theme="bedtime"] button:hover,
body[data-theme="arcade"] button:hover,
body[data-theme="retro-8bit"] button:hover {
  border-color: var(--accent);
  color: #ffd09a;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

body[data-theme="retro-8bit"] *,
body[data-theme="retro-8bit"] *::before,
body[data-theme="retro-8bit"] *::after {
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

body[data-theme="retro-8bit"] button,
body[data-theme="retro-8bit"] .cell,
body[data-theme="retro-8bit"] .panel,
body[data-theme="retro-8bit"] .board-wrap,
body[data-theme="retro-8bit"] .letter-tile {
  background-image: none !important;
  border-width: 2px;
}

body[data-theme="newsprint"] .board-wrap,
body[data-theme="newsprint"] .panel,
body[data-theme="newsprint"] .brand-card,
body[data-theme="newsprint"] .welcome-card,
body[data-theme="newsprint"] .info-card,
body[data-theme="midnight"] .board-wrap,
body[data-theme="midnight"] .panel,
body[data-theme="midnight"] .brand-card,
body[data-theme="midnight"] .welcome-card,
body[data-theme="midnight"] .info-card,
body[data-theme="retro-8bit"] .brand-card,
body[data-theme="retro-8bit"] .welcome-card,
body[data-theme="retro-8bit"] .info-card {
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body[data-theme="newsprint"] .info-modal,
body[data-theme="midnight"] .info-modal,
body[data-theme="retro-8bit"] .info-modal {
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body[data-theme="newsprint"] .info-card,
body[data-theme="newsprint"] .welcome-card {
  background: var(--glass-strong);
  color: var(--ink);
  border-color: var(--glass-border);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

body[data-theme="midnight"] .info-card,
body[data-theme="midnight"] .welcome-card {
  background: var(--glass-strong);
  color: var(--ink);
  border-color: var(--glass-border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

body[data-theme="retro-8bit"] .info-card,
body[data-theme="retro-8bit"] .welcome-card {
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: rgba(255, 184, 77, 0.24);
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1;
}

.progress-panel {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: rgba(10, 12, 15, 0.42);
  box-shadow: none;
}

.progress-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(10, 12, 15, 0.18);
}

.progress-panel > * {
  position: relative;
  z-index: 1;
}

.progress-panel .progress-copy,
.progress-panel .progress-track {
  width: min(520px, calc(100vw - 44px));
}

.progress-panel .progress-copy {
  margin: 0 0 10px;
  padding: 15px 16px 0;
  border: 1px solid #b8c7cf;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--glass-strong);
}

.progress-panel .progress-track {
  height: 14px;
  padding: 0 16px 16px;
  border: 1px solid #b8c7cf;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--glass-strong);
  box-shadow: 0 18px 46px rgba(31, 50, 59, 0.28);
}

body[data-theme="bedtime"] .progress-panel {
  border-color: #5b432d;
  background: #1f150f;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.progress-panel[hidden] {
  display: none;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  color: #40515d;
  font-size: 14px;
  font-weight: 720;
}

.progress-copy strong {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7ec;
}

body[data-theme="bedtime"] .progress-track {
  background: #3a2a1d;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #315f72, #6d9c88);
  transition: width 420ms ease;
}

body[data-theme="bedtime"] .progress-bar {
  background: linear-gradient(90deg, #9b642f, #d19a58);
}

.progress-panel.failed .progress-bar {
  background: #a84d54;
}

.workspace {
  display: grid;
  grid-template-columns: clamp(238px, 20vw, 275px) minmax(0, 1fr) clamp(172px, 15vw, 210px);
  gap: 8px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.board-wrap,
.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: 0 18px 46px var(--glass-shadow);
}

.brand-card {
  position: relative;
  overflow: hidden;
  padding: 10px 11px 11px;
  margin-bottom: 9px;
  border: 1px solid rgba(255, 184, 77, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 184, 77, 0.3), rgba(73, 167, 217, 0.16)),
    var(--glass-soft);
}

body[data-theme="bedtime"] .brand-card {
  background:
    linear-gradient(135deg, rgba(216, 131, 62, 0.18), rgba(146, 196, 125, 0.08)),
    #21160f;
  border-color: #6d5138;
}

.brand-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -38px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(231, 93, 142, 0.24), transparent 68%);
}

.brand-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.starter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(62, 188, 138, 0.46);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(62, 188, 138, 0.24), rgba(255, 184, 77, 0.18));
}

body[data-theme="bedtime"] .starter-card {
  border-color: rgba(146, 196, 125, 0.34);
  background: linear-gradient(135deg, rgba(146, 196, 125, 0.12), rgba(216, 131, 62, 0.12));
}

.starter-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.starter-card strong {
  color: var(--mint);
  font-family: var(--ui-font);
  font-size: 19px;
  letter-spacing: 0.03em;
}

.daily-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
}

.daily-badge span,
.daily-badge strong {
  display: inline-grid;
  place-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.daily-badge span {
  background: rgba(73, 167, 217, 0.18);
  color: var(--accent-strong);
}

.daily-badge strong {
  background: rgba(255, 184, 77, 0.26);
  color: var(--accent);
}

.profile-card {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
}

.profile-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.profile-card input,
.theme-card select {
  width: 100%;
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-soft);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-weight: 800;
  outline: none;
}

body[data-theme="bedtime"] .profile-card input,
body[data-theme="bedtime"] .theme-card select,
body[data-theme="arcade"] .profile-card input,
body[data-theme="arcade"] .theme-card select {
  border-color: #5b432d;
  background: rgba(33, 22, 15, 0.68);
  color: var(--ink);
}

.theme-card {
  display: block;
  align-items: center;
}

.theme-card select {
  min-height: 29px;
  padding: 0 28px 0 9px;
  cursor: pointer;
}

.rank-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid rgba(123, 61, 240, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(123, 61, 240, 0.16), rgba(255, 184, 77, 0.16)), var(--glass-soft);
  background-size: 260% 260%;
  cursor: pointer;
}

.rank-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 48%, white);
  outline-offset: 2px;
}

.rank-emblem {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 184, 77, 0.85);
  border-radius: 11px;
  background:
    linear-gradient(145deg, rgba(255, 184, 77, 0.45), rgba(123, 61, 240, 0.18)),
    #2a1d14;
  color: #fff4d8;
  font-family: var(--logo-font);
  font-size: 21px;
  font-weight: 400;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 8px 18px rgba(123, 61, 240, 0.16);
}

.rank-emblem[data-rank="silver"] {
  border-color: #d4dde6;
  background: linear-gradient(145deg, #eef3f8, #8fa2b3);
  color: #24313a;
}

.rank-emblem[data-rank="gold"] {
  border-color: #ffd66b;
  background: linear-gradient(145deg, #ffe58b, #c88422);
}

.rank-emblem[data-rank="platinum"] {
  border-color: #bde8ff;
  background: linear-gradient(145deg, #e9fbff, #68a9c8);
  color: #14303c;
}

.rank-emblem[data-rank="diamond"] {
  border-color: #98efff;
  background: linear-gradient(145deg, #d8fbff, #4aa4d8);
  color: #0e334f;
}

.rank-emblem[data-rank="crimson"] {
  border-color: #ff8aa8;
  background: linear-gradient(145deg, #ffb2c4, #b91f47);
}

.rank-emblem[data-rank="iridescent"] {
  border-color: #f7d6ff;
  background: linear-gradient(145deg, #85fff1, #b978ff 48%, #ffd166);
  color: #21143a;
}

.rank-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.rank-card span {
  color: var(--accent-strong);
  font-family: var(--ui-font);
  font-size: 15px;
  font-weight: 700;
}

.rank-card strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rank-card em {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 184, 77, 0.24);
  color: var(--accent);
  font-style: normal;
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
}

.streak-card {
  display: grid;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid rgba(62, 188, 138, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(62, 188, 138, 0.14), rgba(255, 184, 77, 0.14)), var(--glass-soft);
}

body[data-theme="bedtime"] .streak-card {
  border-color: #5b432d;
  background: linear-gradient(135deg, rgba(146, 196, 125, 0.1), rgba(216, 131, 62, 0.1)), #21160f;
}

.streak-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.streak-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.streak-card strong {
  color: var(--accent-strong);
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 900;
}

.streak-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 115, 127, 0.18);
}

.streak-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--coin));
  transition: width 320ms ease;
}

.streak-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
}

body[data-theme="bedtime"] .board-wrap,
body[data-theme="bedtime"] .panel,
body[data-theme="arcade"] .board-wrap,
body[data-theme="arcade"] .panel {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

.board-wrap {
  padding: 8px 8px 10px;
  display: grid;
  grid-template-columns: clamp(70px, 6.4vw, 86px) minmax(0, auto);
  grid-template-rows: 1fr;
  gap: 8px;
  place-items: center;
  align-content: center;
  min-height: 0;
  height: 100%;
  position: relative;
}

.board-viewport {
  order: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.board-wrap.discard-ready::after {
  content: "Drop outside to remove";
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 4;
  translate: -50% 0;
  padding: 5px 10px;
  border: 1px solid rgba(255, 214, 107, 0.72);
  border-radius: 999px;
  background: rgba(27, 18, 13, 0.9);
  color: #ffe2a8;
  font-size: 11px;
  font-weight: 900;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  aspect-ratio: 1;
  width: auto;
  height: min(calc(var(--visible-height) - 28px), calc(100vw - 610px));
  max-width: 100%;
  border: 2px solid var(--black);
  background: var(--black);
  gap: 1px;
}

.letter-tray {
  order: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  max-height: 100%;
  padding: 5px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  border-radius: 10px;
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

body[data-theme="bedtime"] .letter-tray {
  border-color: #5b432d;
  background: var(--glass-strong);
}

.letter-tile {
  display: grid;
  gap: 0;
  min-height: clamp(27px, 4.5vh, 36px);
  padding: 2px 0 3px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 850;
  touch-action: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, opacity 140ms ease, filter 140ms ease;
}

.letter-tile strong {
  font-family: var(--ui-font);
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1;
}

.letter-tile span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.letter-tile.spent {
  opacity: 0.38;
  filter: saturate(0.35);
  transform: none;
}

.letter-tile.spent:hover {
  opacity: 0.58;
}

.letter-tile:hover,
.letter-tile.dragging,
.letter-tile.selected,
.cell.dragging-letter {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(31, 50, 59, 0.16);
}

.letter-tile.selected {
  background:
    linear-gradient(180deg, rgba(255, 214, 107, 0.46), rgba(255, 184, 77, 0.24)),
    var(--glass-strong);
}

.board.tap-letter-active .cell:not(.black):not(.given) {
  cursor: pointer;
}

body[data-theme="bedtime"] .letter-tile:hover,
body[data-theme="bedtime"] .letter-tile.dragging,
body[data-theme="bedtime"] .cell.dragging-letter,
body[data-theme="arcade"] .letter-tile:hover,
body[data-theme="arcade"] .letter-tile.dragging,
body[data-theme="arcade"] .cell.dragging-letter {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--paper);
  min-width: 0;
  min-height: 0;
}

.cell[draggable="true"] {
  cursor: grab;
}

.cell[draggable="true"]:active {
  cursor: grabbing;
}

.cell.tentative:not(.bad) {
  box-shadow: inset 0 0 0 1px rgba(216, 160, 79, 0.24);
}

.cell.locked {
  cursor: default;
  background: color-mix(in srgb, var(--given) 66%, var(--paper));
  box-shadow: inset 0 0 0 1px rgba(255, 214, 107, 0.5);
}

.cell.locked::before {
  content: "";
  position: absolute;
  right: clamp(3px, 0.55vh, 5px);
  bottom: clamp(3px, 0.55vh, 5px);
  width: clamp(5px, 0.9vh, 8px);
  height: clamp(5px, 0.9vh, 8px);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 214, 107, 0.48);
  opacity: 0.82;
}

.cell.lock-pop {
  animation: tileLockPop 780ms cubic-bezier(0.2, 1.15, 0.24, 1) both;
}

.cell.god-mode .god-letter {
  position: absolute;
  right: 4px;
  bottom: 3px;
  z-index: 1;
  color: #57a96f;
  opacity: 0.58;
  font-size: clamp(10px, min(1.25vw, 1.65vh), 17px);
  font-weight: 900;
  pointer-events: none;
}

.cell.black {
  background: var(--black);
}

.cell.given {
  background: var(--given);
}

.cell.starter {
  background: linear-gradient(135deg, rgba(62, 188, 138, 0.28), rgba(255, 184, 77, 0.2)), var(--paper);
}

body[data-theme="bedtime"] .cell.starter {
  background: linear-gradient(135deg, rgba(146, 196, 125, 0.14), rgba(216, 131, 62, 0.14)), var(--paper);
}

.cell.active {
  background: var(--active);
}

.cell.bad {
  background: var(--bad);
}

.cell.dud-fade {
  animation: dudFade 1900ms ease-out both;
}

.cell.good {
  background: var(--good);
}

.cell.hover-match {
  background: color-mix(in srgb, var(--active) 72%, var(--paper));
  box-shadow: inset 0 0 0 2px rgba(255, 214, 107, 0.7);
}

.cell.word-complete {
  position: relative;
  z-index: 2;
  outline: 3px solid rgba(255, 214, 107, 0.98);
  outline-offset: -4px;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 212, 0.75), 0 0 18px rgba(255, 214, 107, 0.58);
  animation: wordCompletePulse 2600ms cubic-bezier(0.2, 1.1, 0.25, 1) forwards;
}

.cell.word-complete .entry {
  animation: wordLetterShimmer 1500ms ease-in-out both;
}

.spark {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  pointer-events: none;
  background: #d8a04f;
  animation: sparkPop 680ms ease-out forwards;
}

.discard-puff {
  position: absolute;
  z-index: 5;
  width: clamp(9px, 1.2vw, 15px);
  height: clamp(9px, 1.2vw, 15px);
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98), rgba(205, 199, 188, 0.72) 58%, rgba(154, 142, 123, 0));
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.42);
  animation: discardPuff 680ms cubic-bezier(0.18, 0.88, 0.24, 1) forwards;
}

.cell.word-complete::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 3px;
  border: 1px solid rgba(255, 245, 196, 0.55);
  pointer-events: none;
  animation: tileGoldRing 900ms ease-in-out 2 alternate;
}

.word-spark {
  width: 7px;
  height: 7px;
  background: #ffd66b;
  box-shadow: 0 0 12px rgba(255, 214, 107, 0.7);
}

.cell.letter-glow,
.cell.word-complete,
.key-row.letter-glow {
  animation: letterGlow 1200ms ease-out;
}

.cell.solve-drop {
  animation: solveTileDrop 420ms cubic-bezier(0.22, 1.24, 0.28, 1) both;
}

.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.celebration-overlay.show {
  opacity: 1;
}

.celebration-overlay[hidden] {
  display: none;
}

.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vh, 26px);
  background: rgba(10, 12, 15, 0.56);
  opacity: 0;
  transition: opacity 180ms ease;
}

.welcome-modal.show {
  opacity: 1;
}

.welcome-modal[hidden] {
  display: none;
}

.mobile-help-modal {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: none;
  place-items: end center;
  padding: 14px;
  background: linear-gradient(180deg, rgba(10, 12, 15, 0.12), rgba(10, 12, 15, 0.52));
  opacity: 0;
  transition: opacity 160ms ease;
}

.mobile-help-modal.show {
  opacity: 1;
}

.mobile-help-modal[hidden] {
  display: none;
}

.mobile-help-card {
  width: min(410px, 100%);
  padding: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.mobile-help-card h2 {
  margin: 5px 0 12px;
  font-family: "Fraunces", "Playfair Display", Georgia, serif;
  font-size: 30px;
  line-height: 1;
}

.mobile-help-steps {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.mobile-help-steps div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-soft);
}

.mobile-help-steps strong {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 950;
}

.mobile-help-steps span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.mobile-help-card button {
  width: 100%;
  min-height: 48px;
}

.welcome-card {
  width: min(560px, 100%);
  padding: clamp(20px, 3.4vw, 30px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 58%),
    var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  transform: translateY(12px) scale(0.98);
  transition: transform 220ms cubic-bezier(0.2, 1.1, 0.24, 1);
}

.welcome-modal.show .welcome-card {
  transform: translateY(0) scale(1);
}

.welcome-card h2 {
  margin: 6px 0 4px;
  font-family: "Fraunces", "Playfair Display", Georgia, serif;
  font-size: clamp(28px, 5.2vw, 52px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.welcome-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 18px;
}

.welcome-grid div {
  display: grid;
  gap: 3px;
  min-height: 72px;
  padding: 11px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-soft);
}

.welcome-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-grid strong {
  align-self: end;
  color: var(--accent-strong);
  font-family: "Outfit", var(--ui-font);
  font-size: clamp(19px, 3vw, 30px);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.play-now-button {
  width: 100%;
  min-height: 58px;
  margin-top: 24px;
  border-color: color-mix(in srgb, var(--accent-strong) 64%, #ffffff);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff4bd, #f3c252 54%, #c98824);
  color: #14120c;
  font-family: "Outfit", var(--ui-font);
  font-size: 19px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(80, 48, 11, 0.26), 0 12px 28px color-mix(in srgb, var(--accent) 26%, transparent);
}

.celebration-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0.8em, auto) minmax(92px, auto) auto;
  align-content: center;
  width: min(860px, calc(100vw - 48px));
  min-height: min(430px, calc(100vh - 48px));
  padding: 44px 34px 28px;
  border: 2px solid rgba(216, 160, 79, 0.86);
  border-radius: 16px;
  background: rgba(27, 18, 13, 0.94);
  color: #f4d7a8;
  text-align: center;
  box-shadow: 0 0 0 8px rgba(216, 160, 79, 0.08), 0 24px 70px rgba(0, 0, 0, 0.44);
  pointer-events: auto;
}

.celebration-skip {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  min-width: 78px;
  min-height: 44px;
  padding: 6px 13px;
  border-color: rgba(255, 214, 107, 0.48);
  background: rgba(255, 244, 216, 0.12);
  color: #ffe2a8;
  font-family: var(--ui-font);
  font-size: 15px;
  font-weight: 900;
  text-transform: none;
}

.celebration-card span {
  display: block;
  color: #d7a25f;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.celebration-card strong {
  display: block;
  margin-top: 6px;
  color: #ffe2a8;
  font-family: var(--logo-font);
  font-size: clamp(42px, 7vw, 92px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-shadow: none;
}

.celebration-card strong.counting {
  min-height: 0.95em;
}

.celebration-card p {
  margin: 12px auto 0;
  width: min(680px, 100%);
  min-height: 92px;
  color: #f0c992;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 700;
  line-height: 1.2;
}

.word-pos {
  display: inline-grid;
  place-items: center;
  margin: 0 8px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 214, 107, 0.16);
  color: #ffe2a8;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.celebration-card p small {
  display: block;
  margin-top: 8px;
  color: #d7a25f;
  font-size: 14px;
  font-weight: 850;
}

.payout-lines {
  display: grid;
  gap: 7px;
  max-width: 420px;
  margin: 12px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 184, 77, 0.35);
  border-radius: 10px;
  background: rgba(255, 184, 77, 0.08);
  text-align: left;
}

.payout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

.completion-tally .payout-row {
  animation: payoutRowReveal 520ms cubic-bezier(0.2, 1.12, 0.28, 1) forwards;
  animation-delay: var(--delay);
}

.payout-lines span,
.payout-lines strong {
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1.1;
}

.payout-lines strong {
  color: #ffe2a8;
  text-align: right;
}

.payout-row.ultimate-row {
  border: 1px solid rgba(255, 214, 107, 0.42);
  border-radius: 8px;
  padding: 8px 10px;
  background: linear-gradient(90deg, rgba(255, 214, 107, 0.18), rgba(240, 117, 184, 0.12));
  box-shadow: 0 0 18px rgba(255, 214, 107, 0.16);
}

.payout-row.ultimate-row span,
.payout-row.ultimate-row strong {
  color: #fff3bd;
}

.celebration-card small {
  display: block;
  margin-top: 10px;
  color: #d7a25f;
  font-size: 13px;
  font-weight: 900;
}

.celebration-card em {
  display: inline-grid;
  place-items: center;
  min-width: 74px;
  min-height: 36px;
  margin-top: 16px;
  border-radius: 999px;
  background: #d89f4f;
  color: #1b120d;
  font-style: normal;
  font-family: var(--logo-font);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 5, 3, 0.62);
}

.info-modal[hidden] {
  display: none;
}

.info-card {
  position: relative;
  width: min(780px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 184, 77, 0.52);
  border-radius: 14px;
  background: rgba(27, 18, 13, 0.92);
  color: #ffe2a8;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.rules-card {
  width: min(980px, calc(100vw - 32px));
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 22px;
}

.info-card h2 {
  margin: 4px 42px 14px 0;
  font-family: var(--logo-font);
  font-size: clamp(28px, 4.35vw, 50px);
  font-weight: 400;
  line-height: 0.95;
  white-space: nowrap;
}

.info-card h3 {
  margin: 0 0 8px;
  color: #ffd28b;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.info-card p {
  color: #f0c992;
  font-size: 14px;
  line-height: 1.35;
}

.rules-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rules-columns section,
.score-save-card,
.leaderboard-panel {
  padding: 13px;
  border: 1px solid rgba(255, 184, 77, 0.28);
  border-radius: 10px;
  background: rgba(255, 184, 77, 0.08);
}

.score-save-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: center;
  margin-top: 14px;
}

.score-save-card h3 {
  grid-column: 1 / -1;
}

.score-save-card p {
  margin: 0;
}

.score-save-card button {
  min-width: 210px;
}

.login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.login-form h3,
.leaderboard-panel h3 {
  grid-column: 1 / -1;
}

.login-form input {
  min-height: 34px;
  border: 1px solid rgba(255, 184, 77, 0.42);
  border-radius: 8px;
  background: rgba(7, 5, 3, 0.55);
  color: #ffe2a8;
  padding: 0 10px;
  font: inherit;
  font-weight: 800;
}

.legal-check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: #f0c992;
  font-size: 13px;
  font-weight: 850;
}

.legal-check input {
  width: 18px;
  min-height: 18px;
  accent-color: #ffd66b;
}

.link-button {
  justify-self: start;
  min-height: 34px;
  border-color: rgba(255, 214, 107, 0.46);
  background: rgba(255, 184, 77, 0.12);
  color: #ffe2a8;
  text-transform: none;
}

.login-form p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
}

.profile-modal-card {
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 56px);
  overflow: visible;
  padding: 18px 22px;
}

.profile-tabs-shell {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-tabs-shell.login-only,
.profile-tabs-shell.account-form-only {
  grid-template-columns: minmax(0, 1fr);
}

.profile-tabs-shell.login-only .profile-tabs,
.profile-tabs-shell.account-form-only .profile-tabs {
  display: none;
}

.profile-tabs-shell.login-only .profile-tab-content,
.profile-tabs-shell.account-form-only .profile-tab-content {
  max-width: 680px;
}

.profile-tabs {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 0;
}

.profile-tab {
  justify-content: start;
  min-height: 48px;
  padding: 0 16px;
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
  color: var(--ink);
  text-transform: none;
}

.profile-tab.active {
  border-color: color-mix(in srgb, var(--accent-strong) 58%, var(--line));
  background: var(--glass-strong);
  color: var(--ink);
}

.profile-tab-content {
  min-width: 0;
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.active {
  display: block;
}

.rank-modal-card {
  width: min(680px, calc(100vw - 32px));
}

.rank-tier-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.rank-progress-card {
  display: grid;
  grid-template-columns: 48px repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  margin: 14px 0 16px;
  padding: 12px;
  border: 1px solid rgba(255, 214, 107, 0.52);
  border-radius: 10px;
  background: rgba(255, 184, 77, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 216, 0.08);
}

.rank-progress-card span {
  display: block;
  color: #d7a25f;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rank-progress-card strong {
  display: block;
  margin-top: 2px;
  color: #ffe2a8;
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1;
}

.rank-progress-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  font-size: 26px;
}

.rank-progress-track {
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 244, 216, 0.15);
}

.rank-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d89f4f, #ffe2a8);
}

.rank-tier {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 244, 216, 0.13);
}

.rank-tier.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.rank-tier:not(.reached) {
  opacity: 0.7;
}

.rank-tier-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 22px;
}

.rank-tier strong,
.rank-tier small {
  display: block;
}

.rank-tier small {
  color: var(--muted);
  font-weight: 800;
}

.rank-tier-track {
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
}

.rank-tier-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.profile-state-card {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.profile-state-card[hidden] {
  display: none;
}

.profile-state-card h3 {
  margin: 0;
}

.profile-state-card p {
  margin: 0;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.profile-stat {
  display: grid;
  gap: 5px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.profile-stat span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-stat strong {
  align-self: end;
  color: var(--ink);
  font-family: "Outfit", var(--ui-font);
  font-size: 24px;
  font-weight: 900;
}

.profile-login-form {
  display: grid;
  gap: 10px;
}

.profile-login-form[hidden] {
  display: none;
}

.profile-form-head,
.profile-form-grid,
.profile-consent-box,
.profile-form-actions,
.profile-login-form > p {
  grid-column: 1 / -1;
}

.profile-form-head {
  display: grid;
  gap: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.profile-form-head h3 {
  margin: 0;
}

.profile-form-head p {
  margin: 0;
  color: var(--muted);
}

.profile-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 16px;
  align-items: end;
}

.profile-login-form :is(#profileDisplayNameField, #profilePasswordConfirmField, #profileAgeRow, #profileConsentBox, #profileLegalOpen)[hidden] {
  display: none;
}

.profile-tabs-shell.login-only .profile-form-grid {
  grid-template-columns: 1fr;
}

.profile-tabs-shell.login-only .profile-form-actions {
  grid-template-columns: 1fr;
}

.profile-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.profile-field span {
  display: inline-block;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--glass-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 42px;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--paper) 90%, var(--active));
  color: var(--ink);
}

.profile-field input::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.profile-age-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  align-items: end;
}

.mini-link {
  min-width: 82px;
  min-height: 42px;
}

.profile-consent-box {
  display: grid;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.profile-form-actions {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(240px, 1fr);
  gap: 10px;
  align-items: center;
}

.profile-login-form button {
  min-height: 42px;
}

.profile-login-form button[type="submit"] {
  justify-self: stretch;
}

#profileMessage {
  margin: -2px 0 0;
  color: var(--muted);
}

@media (max-height: 820px) {
  .profile-modal-card {
    overflow: auto;
  }
}

.mini-card {
  width: min(460px, calc(100vw - 32px));
}

.mini-card h2 {
  white-space: normal;
}

@media (max-width: 720px) {
  .profile-tabs-shell {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .profile-tabs {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-login-form,
  .profile-form-grid,
  .profile-form-actions,
  .profile-age-row {
    grid-template-columns: 1fr;
  }
}

.legal-modal {
  z-index: 42;
}

.legal-card {
  width: min(720px, calc(100vw - 32px));
}

.legal-scroll {
  max-height: min(56vh, 460px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 184, 77, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 214, 107, 0.08), transparent),
    rgba(7, 5, 3, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.legal-scroll h3 {
  margin-top: 16px;
}

.legal-scroll h3:first-child {
  margin-top: 0;
}

.legal-accept-button {
  margin-top: 14px;
}

.leaderboard-panel {
  margin-top: 14px;
}

.leaderboard-list {
  display: grid;
  gap: 6px;
}

.leader-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(7, 5, 3, 0.28);
}

.leader-row span,
.leader-row em {
  color: #d7a25f;
  font-style: normal;
  font-weight: 900;
}

.leader-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-row.player-row {
  border: 1px solid rgba(255, 214, 107, 0.52);
  background: rgba(255, 184, 77, 0.16);
  cursor: pointer;
}

.leaderboard-profile-button {
  margin: 0 0 8px;
}

.num {
  position: absolute;
  top: clamp(2px, 0.45vh, 4px);
  left: clamp(3px, 0.55vh, 5px);
  font-size: clamp(7px, min(1vw, 1.25vh), 12px);
  line-height: 1;
  color: #51606a;
  font-weight: 700;
}

body[data-theme="bedtime"] .num {
  color: #9f815d;
}

.entry {
  width: 100%;
  height: 100%;
  border: 0;
  padding: clamp(5px, 1vh, 9px) 2px clamp(8px, 1.45vh, 13px);
  background: transparent;
  color: var(--ink);
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(13px, min(2.15vw, 2.9vh), 28px);
  font-weight: 760;
  line-height: 0.95;
  outline: none;
}

.key-letter {
  user-select: none;
  pointer-events: none;
  caret-color: transparent;
}

.entry[value]:not([value=""]) {
  cursor: grab;
}

.entry[draggable="true"] {
  cursor: grab;
}

.entry[draggable="true"]:active {
  cursor: grabbing;
}

.entry[readonly] {
  cursor: default;
}

body[data-theme="bedtime"] .entry,
body[data-theme="bedtime"] .key-letter,
body[data-theme="arcade"] .entry,
body[data-theme="arcade"] .key-letter {
  color: #f1d9b2;
}

.entry:disabled {
  opacity: 1;
  -webkit-text-fill-color: var(--ink);
}

body[data-theme="bedtime"] .entry:disabled,
body[data-theme="arcade"] .entry:disabled {
  -webkit-text-fill-color: #f1d9b2;
}

.panel {
  padding: 10px;
  max-height: 100%;
  overflow: hidden;
}

.status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.score-card {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.score-card h2 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.score-total {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  min-height: 43px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 184, 77, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 184, 77, 0.28), rgba(62, 188, 138, 0.12)),
    var(--glass-soft);
  background-size: 260% 260%;
}

.score-current {
  border-color: rgba(123, 61, 240, 0.34);
  background:
    linear-gradient(160deg, rgba(123, 61, 240, 0.2), rgba(231, 93, 142, 0.12)),
    var(--glass-soft);
}

.rank-card::after,
.score-total::after {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 12%, rgba(255, 255, 255, 0.62) 34%, transparent 48%);
  opacity: 0.42;
  transform: translateX(-120%);
}

.score-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.score-total strong {
  font-family: var(--ui-font);
  color: var(--accent-strong);
  font-size: clamp(17px, 1.8vw, 22px);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 184, 77, 0.2);
}

.score-total.score-pulse {
  animation: scorePulse 760ms cubic-bezier(0.2, 1.1, 0.24, 1);
}

.rank-card.reward-glow {
  animation: scorePulse 760ms cubic-bezier(0.2, 1.1, 0.24, 1);
}

.score-total.score-pulse strong {
  color: var(--coin);
  text-shadow: 0 0 14px rgba(255, 214, 107, 0.55), 0 2px 0 rgba(91, 55, 24, 0.26);
}

.point-pop {
  position: absolute;
  right: 4px;
  top: 22px;
  z-index: 4;
  padding: 5px 9px;
  border: 1px solid rgba(255, 184, 77, 0.8);
  border-radius: 999px;
  background: rgba(27, 18, 13, 0.92);
  color: #ffe2a8;
  font-family: var(--logo-font);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(123, 61, 240, 0.2), 0 0 18px rgba(255, 184, 77, 0.28);
  filter: drop-shadow(0 3px 0 rgba(91, 55, 24, 0.55));
  pointer-events: none;
  animation: pointFloat 1150ms cubic-bezier(0.2, 1.1, 0.28, 1) forwards;
}

.point-swish {
  position: fixed;
  z-index: 25;
  translate: -50% -50%;
  padding: 7px 11px;
  border: 1px solid rgba(255, 184, 77, 0.86);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7ac, #d89f4f);
  color: #1b120d;
  font-family: var(--logo-font);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  filter: drop-shadow(0 5px 0 rgba(91, 55, 24, 0.45));
  pointer-events: none;
  animation: pointSwish 980ms cubic-bezier(0.22, 0.9, 0.24, 1) forwards;
}

body[data-theme="bedtime"] .point-pop {
  background: linear-gradient(180deg, #f4c06d, #b87939);
  color: #1b120d;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
}

.new-options,
.library,
.key-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.new-options,
.library {
  display: none;
}

.key-section {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.new-options h2,
.library h2,
.key-section h2 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.new-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.new-options h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.new-options label {
  display: grid;
  gap: 5px;
  color: #40515d;
  font-size: 12px;
  font-weight: 720;
}

body[data-theme="bedtime"] .new-options label,
body[data-theme="bedtime"] .rules,
body[data-theme="bedtime"] .report-row {
  color: #b99b73;
}

.new-options select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 8px;
  font: inherit;
}

body[data-theme="bedtime"] .new-options select {
  border-color: #5b432d;
  background: #251a13;
  color: var(--ink);
}

.library {
  margin-top: 12px;
}

.puzzle-list {
  display: grid;
  gap: 7px;
}

.puzzle-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 7px 9px;
  text-align: left;
  border-color: var(--line);
  background: var(--panel);
}

.puzzle-item.active {
  border-color: var(--accent);
  background: #e7f0ed;
}

body[data-theme="bedtime"] .puzzle-item.active {
  border-color: var(--accent);
  background: #302215;
}

.puzzle-item strong {
  color: var(--ink);
  font-size: 13px;
}

.puzzle-item span,
.library-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.site-count {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0 -5px 2px;
  color: color-mix(in srgb, var(--muted) 48%, transparent);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.site-profile-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.site-lock-icon {
  font-size: 8px;
  line-height: 1;
  opacity: 0.62;
}

.rules {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: #40515d;
  font-size: 13px;
}

.rule {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.key-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--glass-soft);
  overflow: hidden;
}

.key-number {
  display: grid;
  place-items: center;
  height: 100%;
  background: rgba(255, 184, 77, 0.18);
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

body[data-theme="bedtime"] .key-number,
body[data-theme="arcade"] .key-number {
  background: #342416;
  color: #d4af7a;
}

.key-letter {
  border: 0;
  min-width: 0;
  height: 100%;
  background: transparent;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  font-size: 16px;
  font-weight: 760;
  outline: none;
}

.key-row.given {
  background: var(--given);
}

.key-row:not(.given) {
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.key-row:not(.given):hover {
  border-color: var(--line);
  box-shadow: none;
}

.staging-tools {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 45;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 14px 32px var(--glass-shadow);
}

.staging-tools[hidden] {
  display: none;
}

.staging-tools strong {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.template-dot {
  color: #97a6af;
  font-size: 14px;
  font-weight: 800;
}

.report-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: #40515d;
  font-size: 14px;
}

.report-row strong {
  color: var(--ink);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: var(--visible-height);
  }

  .actions {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .board-wrap {
    order: -3;
  }

  .board {
    height: auto;
    width: min(100%, calc(var(--visible-height) - 340px), calc(100vw - 32px));
  }

  .board-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .letter-tray {
    order: 2;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    width: min(100%, 760px);
  }

  .panel {
    order: -1;
    max-height: none;
  }

  .left-panel {
    order: -2;
  }

  .right-panel {
    order: -1;
  }

  .key-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (min-width: 901px) and (max-width: 1180px) {
  .app {
    width: calc(100vw - 12px);
    padding: 6px 0;
  }

  .workspace {
    grid-template-columns: clamp(198px, 21vw, 230px) minmax(0, 1fr) clamp(132px, 13vw, 158px);
    gap: 6px;
  }

  .board-wrap {
    grid-template-columns: clamp(52px, 5.2vw, 64px) minmax(0, auto);
    gap: 6px;
    padding: 6px;
  }

  .board {
    height: min(calc(var(--visible-height) - 20px), calc(100vw - 448px));
  }

  .panel {
    padding: 8px;
  }

  .brand-logo strong {
    font-size: clamp(22px, 2.35vw, 28px);
  }

  .actions {
    gap: 5px;
  }

  button {
    min-height: 30px;
    padding: 0 6px;
    font-size: 12px;
  }

  .right-panel .status {
    display: grid;
    gap: 4px;
    font-size: 12px;
  }

  .key-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .key-row {
    min-height: 25px;
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .key-letter {
    min-height: 25px;
    font-size: 12px;
  }

  .key-number {
    font-size: 11px;
  }

  .right-panel {
    overflow: auto;
  }
}

@keyframes letterGlow {
  0% {
    box-shadow: inset 0 0 0 0 rgba(216, 160, 79, 0);
  }
  30% {
    box-shadow: inset 0 0 0 3px rgba(216, 160, 79, 0.9), 0 0 18px rgba(216, 160, 79, 0.45);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(216, 160, 79, 0);
  }
}

@keyframes solveTileDrop {
  0% {
    transform: translateY(-11px) scale(0.88);
    filter: brightness(1.22);
  }
  68% {
    transform: translateY(2px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes dudFade {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: saturate(1.2);
  }
  55% {
    transform: scale(0.98);
    opacity: 0.72;
    filter: saturate(0.8);
  }
  100% {
    transform: scale(0.94);
    opacity: 0.28;
    filter: saturate(0.45);
  }
}

@keyframes wordCompletePulse {
  0% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(255, 214, 107, 0), 0 0 0 rgba(255, 214, 107, 0);
    filter: brightness(1);
  }
  22% {
    transform: scale(1.055);
    box-shadow: inset 0 0 0 3px rgba(255, 214, 107, 0.95), 0 0 20px rgba(255, 214, 107, 0.58);
    filter: brightness(1.26);
  }
  62% {
    transform: scale(1.018);
    box-shadow: inset 0 0 0 2px rgba(255, 214, 107, 0.72), 0 0 14px rgba(255, 214, 107, 0.34);
    filter: brightness(1.12);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(255, 214, 107, 0), 0 0 0 rgba(255, 214, 107, 0);
    filter: brightness(1);
  }
}

@keyframes tileLockPop {
  0% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow: inset 0 0 0 1px rgba(255, 214, 107, 0.35), 0 0 0 rgba(255, 214, 107, 0);
  }
  35% {
    transform: scale(1.09);
    filter: brightness(1.28);
    box-shadow: inset 0 0 0 3px rgba(255, 214, 107, 0.95), 0 0 22px rgba(255, 214, 107, 0.68);
  }
  58% {
    transform: scale(0.98);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes wordLetterShimmer {
  0%, 100% {
    text-shadow: none;
  }
  42% {
    text-shadow: 0 0 10px rgba(255, 214, 107, 0.82), 0 2px 0 rgba(91, 55, 24, 0.35);
  }
}

@keyframes sparkPop {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3);
  }
}

@keyframes discardPuff {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.5);
    filter: blur(0);
  }
  58% {
    opacity: 0.82;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.9);
    filter: blur(1.5px);
  }
}

@keyframes tileGoldRing {
  from {
    opacity: 0.35;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1.02);
  }
}

@keyframes pointFloat {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.8);
  }
  18% {
    opacity: 1;
    transform: translateY(-4px) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translateY(-46px) scale(0.98);
  }
}

@keyframes scorePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 214, 107, 0);
  }
  42% {
    transform: scale(1.045);
    box-shadow: 0 0 18px rgba(255, 214, 107, 0.38);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 214, 107, 0);
  }
}

@keyframes pointSwish {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.7) rotate(-4deg);
  }
  14% {
    opacity: 1;
    transform: translate(-24px, -20px) scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--tx) - var(--sx)), calc(var(--ty) - var(--sy))) scale(0.34) rotate(9deg);
  }
}

@keyframes payoutRowReveal {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    filter: brightness(0.82);
  }
  58% {
    opacity: 1;
    transform: translateY(-3px) scale(1.03);
    filter: brightness(1.22);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

body[data-motion="reduced"] *,
body[data-motion="reduced"] *::before,
body[data-motion="reduced"] *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

body[data-motion="reduced"] .spark,
body[data-motion="reduced"] .point-swish,
body[data-motion="reduced"] .discard-puff {
  display: none !important;
}

body[data-motion="reduced"] .board-wrap,
body[data-motion="reduced"] .panel,
body[data-motion="reduced"] .brand-card,
body[data-motion="reduced"] .info-modal,
body[data-motion="reduced"] .welcome-modal {
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body[data-theme="editorial-dark"] button,
body[data-theme="violet-hour"] button,
body[data-theme="graphite"] button,
body[data-theme="royal-arcade"] button {
  border-color: var(--glass-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 72%, white), color-mix(in srgb, var(--paper) 90%, black));
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.06), 0 4px 10px rgba(0, 0, 0, 0.22);
}

body[data-theme="editorial-dark"] button:hover,
body[data-theme="violet-hour"] button:hover,
body[data-theme="graphite"] button:hover,
body[data-theme="royal-arcade"] button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

body[data-theme="editorial-dark"] .progress-panel,
body[data-theme="violet-hour"] .progress-panel,
body[data-theme="graphite"] .progress-panel,
body[data-theme="royal-arcade"] .progress-panel,
body[data-theme="editorial-dark"] .board-wrap,
body[data-theme="editorial-dark"] .panel,
body[data-theme="violet-hour"] .board-wrap,
body[data-theme="violet-hour"] .panel,
body[data-theme="graphite"] .board-wrap,
body[data-theme="graphite"] .panel,
body[data-theme="royal-arcade"] .board-wrap,
body[data-theme="royal-arcade"] .panel {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

body[data-theme="editorial-dark"] .profile-card input,
body[data-theme="editorial-dark"] .theme-card select,
body[data-theme="violet-hour"] .profile-card input,
body[data-theme="violet-hour"] .theme-card select,
body[data-theme="graphite"] .profile-card input,
body[data-theme="graphite"] .theme-card select,
body[data-theme="royal-arcade"] .profile-card input,
body[data-theme="royal-arcade"] .theme-card select,
body[data-theme="editorial-dark"] .entry,
body[data-theme="editorial-dark"] .key-letter,
body[data-theme="violet-hour"] .entry,
body[data-theme="violet-hour"] .key-letter,
body[data-theme="graphite"] .entry,
body[data-theme="graphite"] .key-letter,
body[data-theme="royal-arcade"] .entry,
body[data-theme="royal-arcade"] .key-letter {
  color: var(--ink);
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

body[data-theme="editorial-dark"] .entry:disabled,
body[data-theme="violet-hour"] .entry:disabled,
body[data-theme="graphite"] .entry:disabled,
body[data-theme="royal-arcade"] .entry:disabled {
  -webkit-text-fill-color: var(--ink);
}

body[data-theme="editorial-dark"] .num,
body[data-theme="violet-hour"] .num,
body[data-theme="graphite"] .num,
body[data-theme="royal-arcade"] .num,
body[data-theme="editorial-dark"] .key-number,
body[data-theme="violet-hour"] .key-number,
body[data-theme="graphite"] .key-number,
body[data-theme="royal-arcade"] .key-number {
  color: var(--muted);
}

body[data-theme="editorial-dark"] .letter-tile:hover,
body[data-theme="editorial-dark"] .letter-tile.dragging,
body[data-theme="editorial-dark"] .cell.dragging-letter,
body[data-theme="violet-hour"] .letter-tile:hover,
body[data-theme="violet-hour"] .letter-tile.dragging,
body[data-theme="violet-hour"] .cell.dragging-letter,
body[data-theme="graphite"] .letter-tile:hover,
body[data-theme="graphite"] .letter-tile.dragging,
body[data-theme="graphite"] .cell.dragging-letter,
body[data-theme="royal-arcade"] .letter-tile:hover,
body[data-theme="royal-arcade"] .letter-tile.dragging,
body[data-theme="royal-arcade"] .cell.dragging-letter {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

@media (max-width: 560px) {
  .app {
    width: min(100vw - 14px, 1180px);
    padding-top: 10px;
    padding-bottom: 10px;
  }

  h1 {
    font-size: 28px;
  }

  .board-wrap,
  .panel {
    padding: 8px;
  }

  .new-options {
    grid-template-columns: 1fr;
  }

  .board {
    width: min(100%, calc(100vw - 30px));
  }

  .key-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
  }

  .app {
    display: flex;
    width: 100vw;
    height: var(--visible-height);
    padding: 8px 8px 70px;
    overflow: hidden;
  }

  .mobile-screen-message {
    display: none !important;
  }

  .mobile-gamebar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 28;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 7px;
    border: 1px solid color-mix(in srgb, var(--line) 78%, var(--ink));
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 34px rgba(18, 20, 22, 0.28);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .mobile-gamebar button {
    min-height: 42px;
    background: var(--paper);
    gap: 5px;
    font-size: 17px;
    line-height: 1;
  }

  body.mobile-settings-open::before,
  body.mobile-letters-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 24;
    background: rgba(8, 8, 8, 0.58);
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    height: 100%;
    min-height: 0;
  }

  .board-wrap {
    order: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    align-content: start;
    align-items: start;
    justify-items: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 8px 8px 88px;
    overflow: visible;
  }

  .board-viewport {
    order: 0;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: var(--paper);
    touch-action: none;
    cursor: grab;
  }

  .board {
    width: min(calc(100vw - 34px), calc(var(--visible-height) - 160px));
    height: auto;
    max-height: calc(var(--visible-height) - 158px);
    will-change: transform;
  }

  .letter-tray {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(74px + max(8px, env(safe-area-inset-bottom)));
    z-index: 27;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 3px;
    width: auto;
    max-width: none;
    padding: 5px;
    border-color: color-mix(in srgb, var(--line) 76%, var(--ink));
    background: var(--paper);
    box-shadow: 0 8px 24px rgba(18, 20, 22, 0.26);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .letter-tile {
    min-height: 31px;
    padding: 2px 1px 3px;
    background: var(--paper);
    gap: 1px;
    border-radius: 8px;
    overflow: hidden;
  }

  .letter-tile strong {
    font-size: 14px;
    line-height: 0.95;
  }

  .letter-tile span {
    font-size: 8px;
    line-height: 0.95;
    white-space: nowrap;
  }

  .num {
    top: 2px;
    left: 3px;
    font-size: 7px;
    line-height: 1;
  }

  .entry {
    padding: 10px 2px 3px;
    font-size: 15px;
    line-height: 1;
  }

  .panel {
    position: fixed;
    top: 8px;
    bottom: calc(64px + max(8px, env(safe-area-inset-bottom)));
    z-index: 26;
    width: min(320px, calc(100vw - 44px));
    max-height: none;
    overflow: auto;
    padding: 12px;
    border-color: color-mix(in srgb, var(--line) 76%, var(--ink));
    background: var(--paper);
    box-shadow: 0 18px 48px rgba(18, 20, 22, 0.34);
    transition: transform 180ms ease;
  }

  .left-panel {
    left: 8px;
    transform: translateX(calc(-100% - 18px));
  }

  .right-panel {
    right: 8px;
    transform: translateX(calc(100% + 18px));
  }

  body.mobile-settings-open .left-panel,
  body.mobile-letters-open .right-panel {
    transform: translateX(0);
  }

  .mobile-drawer-close {
    position: sticky;
    top: 0;
    z-index: 2;
    display: inline-flex;
    float: right;
    min-width: 34px;
    min-height: 34px;
    margin: -4px -4px 6px 8px;
    padding: 0;
  }

  .brand-logo strong {
    font-size: 26px;
  }

  .welcome-modal {
    padding: 12px;
    background: rgba(10, 12, 15, 0.7);
  }

  .mobile-help-modal {
    display: grid;
    padding-bottom: calc(146px + env(safe-area-inset-bottom));
    background: rgba(10, 12, 15, 0.7);
  }

  .mobile-help-card {
    padding: 16px;
    background: var(--paper);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  }

  .welcome-card {
    max-height: calc(var(--visible-height) - 24px);
    overflow: auto;
    background: var(--paper);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  }

  .welcome-grid {
    gap: 8px;
  }

  .welcome-grid div {
    min-width: 0;
    padding: 10px 8px;
    background: color-mix(in srgb, var(--paper) 92%, var(--panel));
  }

  .welcome-grid span {
    font-size: 10px;
  }

  .welcome-grid strong {
    font-size: clamp(16px, 4.6vw, 24px);
    overflow-wrap: normal;
    word-break: normal;
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .key-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-count {
    margin-bottom: 2px;
  }

  .staging-tools {
    top: 8px;
    right: 8px;
    bottom: auto;
    z-index: 23;
    transform: scale(0.86);
    transform-origin: top right;
  }

  body.mobile-settings-open .staging-tools,
  body.mobile-letters-open .staging-tools {
    display: none;
  }
}

@media print {
  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .actions,
  .panel {
    display: none;
  }

  .workspace {
    display: block;
  }

  .board-wrap {
    box-shadow: none;
    border: 0;
  }
}

.left-panel .new-options,
.left-panel .library {
  display: none !important;
}
