:root {
  color-scheme: light;
  --ink: #243447;
  --muted: #5d6b7a;
  --paper: #f7fbf4;
  --paper-strong: #ffffff;
  --line: #d5e3df;
  --brand: #1f8a84;
  --brand-dark: #176e69;
  --brand-soft: #dff5f2;
  --accent: #f0b429;
  --accent-soft: #fff6d9;
  --coral: #ef7a5a;
  --coral-soft: #ffe8e1;
  --sun: #f0b429;
  --blue: #4a90c8;
  --blue-soft: #e5f1fa;
  --good: #2f9e6b;
  --good-soft: #e3f7ec;
  --bad: #d4544a;
  --bad-soft: #fdeceb;
  --shadow-sm: 0 4px 14px rgba(36, 52, 71, 0.06);
  --shadow-md: 0 12px 32px rgba(36, 52, 71, 0.09);
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --font-display: "Baloo 2", "Nunito", "Segoe UI Rounded", system-ui, sans-serif;
  --font-ui: "Source Sans 3", "Source Sans Pro", "Segoe UI", sans-serif;
  --font: var(--font-ui);
  --content: 1040px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eef7fb;
  font-family: var(--font-ui);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 12% 8%, rgba(240, 180, 41, 0.22), transparent 36%),
    radial-gradient(ellipse at 88% 4%, rgba(31, 138, 132, 0.16), transparent 40%),
    radial-gradient(ellipse at 70% 90%, rgba(74, 144, 200, 0.12), transparent 42%),
    linear-gradient(165deg, #eef7fb 0%, #f7fbf4 48%, #eef6f2 100%);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
label[for],
input[type="checkbox"] {
  cursor: pointer;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid rgba(31, 138, 132, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#app {
  min-height: 100vh;
}

.screen {
  width: min(100%, var(--content));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 40px) 48px;
  animation: screen-in 280ms ease-out both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: none;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-name {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hub-screen .app-bar .brand-name {
  font-size: 17px;
}

.bar-actions,
.action-row,
.result-actions,
.game-actions,
.utility-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 22px;
  border: 2px solid var(--brand);
  border-radius: 14px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 3px 0 var(--brand-dark);
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--brand-dark);
  transform: translateY(2px);
}

.btn:disabled {
  border-color: #c5d4d1;
  color: #7a8b88;
  background: #e4eeeb;
  box-shadow: none;
}

.btn-secondary {
  border-color: #c9d9d5;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 3px 0 #d7e3df;
}

.btn-secondary:hover:not(:disabled) {
  background: #f4faf8;
}

.btn-danger {
  border-color: var(--bad);
  color: var(--bad);
  background: #fff;
  box-shadow: none;
}

.btn-quiet {
  min-height: 40px;
  padding: 6px 8px;
  border-color: transparent;
  color: var(--brand-dark);
  background: transparent;
  box-shadow: none;
  font-weight: 700;
  text-decoration: none;
}

.btn-quiet:hover:not(:disabled) {
  color: var(--brand);
  background: var(--brand-soft);
}

.btn-icon {
  width: 48px;
  min-width: 48px;
  padding: 0;
  font-size: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 { font-size: clamp(34px, 7vw, 58px); }
h2 { font-size: clamp(24px, 4vw, 34px); }
h3 { font-size: 21px; }

.lede {
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

.panel {
  border: 1px solid rgba(197, 216, 211, 0.7);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

/* Welcome */
.welcome-screen {
  display: grid;
  place-items: center;
  padding-top: clamp(18px, 5vh, 52px);
}

.welcome-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.9fr);
  width: min(100%, 940px);
  overflow: hidden;
}

.welcome-story {
  position: relative;
  padding: clamp(30px, 5vw, 56px);
  background:
    radial-gradient(circle at 18% 85%, rgba(240, 180, 41, 0.28), transparent 14rem),
    linear-gradient(145deg, #e5f8f4, #eef6ff 70%);
  overflow: hidden;
}

.welcome-story::before {
  content: "Aa Bb";
  position: absolute;
  right: -2%;
  bottom: 4%;
  font-family: var(--font-display);
  font-size: clamp(64px, 14vw, 120px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: rgba(31, 138, 132, 0.12);
  pointer-events: none;
  user-select: none;
}

.welcome-story::after {
  content: none;
}

.welcome-brand {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 62px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  animation: brand-settle 480ms ease-out both;
}

.welcome-story .lede {
  position: relative;
  z-index: 1;
}

@keyframes brand-settle {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes cta-bounce {
  0% { transform: translateY(6px); opacity: 0.6; }
  60% { transform: translateY(-2px); }
  100% { transform: none; opacity: 1; }
}

.welcome-form {
  padding: clamp(26px, 4vw, 44px);
  background: var(--paper-strong);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.field label,
.field-label {
  color: var(--ink);
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid #c9d9d5;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9ebcbb;
}

.age-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.age-btn,
.segmented button {
  min-height: 44px;
  border: 2px solid #c9d9d5;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.age-btn[aria-pressed="true"],
.segmented button[aria-pressed="true"] {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.privacy-note {
  display: flex;
  gap: 9px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Hub — brand-first sunny stage */
.hub-ritual {
  position: relative;
  display: block;
  margin-bottom: 28px;
  padding: clamp(24px, 4vw, 40px) clamp(18px, 3vw, 28px);
  border: 1px solid rgba(197, 216, 211, 0.65);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 92% 12%, rgba(240, 180, 41, 0.2), transparent 12rem),
    radial-gradient(circle at 8% 80%, rgba(31, 138, 132, 0.12), transparent 14rem),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.hub-ritual::before {
  content: "W O R D";
  position: absolute;
  right: -4%;
  top: 18%;
  font-family: var(--font-display);
  font-size: clamp(72px, 16vw, 160px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.08em;
  color: rgba(31, 138, 132, 0.08);
  pointer-events: none;
  user-select: none;
}

.lexicon-hero {
  position: relative;
  z-index: 1;
  max-width: 38rem;
}

.lexicon-hero .brand-hero {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 68px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  animation: brand-settle 480ms ease-out both;
}

.lexicon-hero .hero-support {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 18px);
  max-width: 34rem;
}

.ritual-actions .btn {
  animation: cta-bounce 520ms ease-out 120ms both;
}

.daily-badge,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ritual-actions {
  margin-top: 4px;
}

.ritual-meta {
  margin: 14px 0 0;
  font-size: 14px;
}

.ritual-week {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  max-width: 300px;
}

.ritual-day {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ritual-day i {
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  transition: background 280ms ease, border-color 280ms ease, transform 280ms ease;
}

.ritual-day.done i {
  border-color: var(--brand);
  background: var(--brand);
  animation: dot-fill 360ms ease both;
}

.ritual-day.today i {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ritual-day small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@keyframes dot-fill {
  from { transform: scale(0.5); opacity: 0.3; }
  to { transform: scale(1); opacity: 1; }
}

.pace-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
}

.pace-strip strong {
  color: var(--ink);
  font-weight: 700;
}

.rank-pill,
.rank-banner {
  font-family: var(--font-display);
  font-weight: 700;
}

.rank-pop {
  animation: rankPop 0.55s ease;
}

@keyframes rankPop {
  0% { transform: scale(0.88); opacity: 0.2; }
  60% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

.learn-card .learn-example {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-style: italic;
}

.copy-status {
  margin-top: 14px;
  text-align: center;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
}

.stat-num {
  display: block;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mastery-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid #cfe0db;
  border-radius: 999px;
  background: #e8f1ee;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #4ab8a8);
  transition: width 420ms ease;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 36px 0 14px;
}

.section-head h2,
.section-head p {
  margin-bottom: 0;
}

.section-head h2 {
  font-size: clamp(22px, 3.5vw, 28px);
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.game-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px 18px;
  min-height: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.game-card:hover {
  border-color: rgba(31, 138, 132, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.game-card.featured {
  grid-column: auto;
}

.game-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0;
  border-radius: 14px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.game-card:nth-child(2n) .game-symbol {
  color: #b56a18;
  background: var(--accent-soft);
}

.game-card:nth-child(3n) .game-symbol {
  color: #2f6fa8;
  background: var(--blue-soft);
}

.game-card:nth-child(4n) .game-symbol {
  color: #c45a3e;
  background: var(--coral-soft);
}

.game-card-body {
  min-width: 0;
}

.game-card h3 {
  margin-bottom: 2px;
  font-size: 22px;
}

.game-card p {
  flex: none;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-card .game-actions {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.game-card .game-actions .btn:first-child {
  flex: 0 0 auto;
}

.achievements {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.8);
}

.achievement.locked {
  opacity: 0.55;
  filter: none;
}

.achievement-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #b56a18;
  font-size: 14px;
}

.achievement strong,
.achievement small {
  display: block;
}

.achievement strong {
  font-family: var(--font-ui);
  font-weight: 700;
}

.achievement small {
  color: var(--muted);
}

.hub-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* Mode intro and settings */
.narrow {
  width: min(100%, 740px);
  margin-inline: auto;
}

.intro-card,
.settings-card,
.help-card {
  padding: clamp(24px, 4vw, 44px);
}

.intro-symbol {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 16px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.rule-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}

.rule-list .rule-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 800;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5faf8;
}

.option-grid .field {
  margin: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row.compact {
  align-self: stretch;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.setting-copy strong,
.setting-copy small {
  display: block;
}

.setting-copy small {
  margin-top: 3px;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 52px;
  width: 52px;
  height: 32px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  width: 100%;
  border: 2px solid #aebdbc;
  border-radius: 999px;
  background: #d9e4e1;
  transition: 160ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: 160ms ease;
}

.switch input:checked + .switch-track {
  border-color: var(--brand);
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid rgba(31, 138, 132, 0.45);
  outline-offset: 3px;
}

.help-mode {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.help-mode:last-child { border: 0; }
.help-mode h3 { margin-bottom: 6px; }
.help-mode p { margin-bottom: 0; color: var(--muted); }

.data-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.import-label input { display: none; }

/* Gameplay */
.game-screen {
  width: min(100%, 940px);
}

.game-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.game-title-wrap {
  min-width: 0;
}

.game-title-wrap strong,
.game-title-wrap span {
  display: block;
}

.game-title-wrap strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-title-wrap span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.game-shell {
  overflow: hidden;
}

.round-progress {
  height: 6px;
  background: #e4ecea;
}

.round-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #57b8a9);
  transition: width 260ms ease;
}

.game-body {
  min-height: 520px;
  padding: clamp(22px, 4vw, 48px);
  text-align: center;
}

.question-kicker {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: clamp(18px, 2.8vw, 23px);
  font-weight: 700;
  line-height: 1.35;
}

.word {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.game-header .word {
  margin: 0;
}

.speak-btn,
.hint-btn {
  min-height: 42px;
  padding: 8px 14px;
  border: 2px solid #c8d7d5;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 700;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 740px;
  margin: 0 auto;
}

.choice {
  position: relative;
  min-height: 74px;
  padding: 14px 16px 14px 48px;
  border: 2px solid #d5dfde;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 0 #e0e7e6;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  transition: 140ms ease;
}

.choice::before {
  content: attr(data-key);
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: var(--muted);
  background: #f0f4f3;
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}

.choice:hover:not(:disabled) {
  border-color: #83aaa6;
  background: #f8fcfb;
  transform: translateY(-1px);
}

.choice.correct {
  border-color: var(--good);
  color: #165c37;
  background: var(--good-soft);
  box-shadow: 0 3px 0 #b9dec4;
}

.choice.correct::before { content: "✓"; color: #fff; background: var(--good); }

.choice.wrong {
  border-color: var(--bad);
  color: #8e2c27;
  background: var(--bad-soft);
  box-shadow: 0 3px 0 #edcbc6;
}

.choice.wrong::before { content: "!"; color: #fff; background: var(--bad); }

.choice:disabled:not(.correct):not(.wrong) { opacity: 0.6; }

.feedback {
  min-height: 30px;
  margin: 20px auto 0;
  color: var(--muted);
  font-weight: 700;
}

.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.q-progress {
  margin-top: 25px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.sentence-card,
.definition-card {
  max-width: 720px;
  margin: 0 auto 22px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5faf8;
  font-size: clamp(20px, 3.5vw, 28px);
  font-weight: 700;
  line-height: 1.45;
}

.blank-word {
  display: inline-block;
  min-width: 120px;
  border-bottom: 3px solid var(--brand);
  color: var(--brand-dark);
}

/* Guessy — soft sunny letterpress */
.guessy-head {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.guessy-head .prompt {
  margin-bottom: 15px;
}

.wg-message {
  min-height: 28px;
  margin: 6px auto 10px;
  color: var(--muted);
  font-weight: 700;
}

.wg-message.feedback { margin-top: 6px; }
.wg-message.bad { color: var(--bad); }
.wg-message.good { color: var(--good); }

.wg-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wg-chip {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  vertical-align: -2px;
}

.wg-chip.g { background: var(--good); }
.wg-chip.y { background: var(--accent); }
.wg-chip.n { background: #9aa5a6; }

.wg-grid {
  display: grid;
  gap: 6px;
  width: min(100%, 304px);
  margin: 0 auto 18px;
}

.wg-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.wg-slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid #cdd8d7;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
}

.wg-slot[data-mark]::after {
  content: attr(data-mark);
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
}

.wg-slot.cursor { border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(74, 144, 200, 0.15); }
.wg-slot.g { border-color: var(--good); color: #fff; background: var(--good); }
.wg-slot.y { border-color: #c99212; color: #3a2d0a; background: var(--accent); }
.wg-slot.n { border-color: #7c898a; color: #fff; background: #879394; }

.wg-slot.reveal {
  animation: tile-reveal 520ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--tile-delay, 0ms) both;
}

.wg-row.shake {
  animation: row-shake 320ms ease-in-out;
}

@keyframes tile-reveal {
  0% { opacity: 0.25; transform: rotateX(90deg) scale(0.92); }
  55% { transform: rotateX(-8deg) scale(1.02); }
  100% { opacity: 1; transform: rotateX(0) scale(1); }
}

@keyframes row-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.wg-kb {
  display: grid;
  gap: 6px;
  max-width: 610px;
  margin: 0 auto;
}

.wg-kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.wg-key {
  flex: 1 1 0;
  max-width: 50px;
  min-width: 30px;
  min-height: 48px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: #e4eae9;
  box-shadow: 0 2px 0 #c4cecc;
  font-size: clamp(13px, 2.2vw, 16px);
  font-weight: 800;
}

.wg-key.wide {
  flex-basis: 72px;
  max-width: 76px;
  font-size: 12px;
}

.wg-key.g { color: #fff; background: var(--good); box-shadow: 0 2px 0 #247a52; }
.wg-key.y { color: #3a2d0a; background: var(--accent); box-shadow: 0 2px 0 #c99212; }
.wg-key.dead { color: #fff; background: #879394; box-shadow: none; }
.wg-key:disabled { opacity: 0.72; }

.guessy-tip {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 13px;
}

.guessy-complete {
  display: grid;
  place-items: center;
  max-width: 680px;
  margin: 30px auto;
}

.guessy-complete h2 {
  font-size: clamp(30px, 6vw, 46px);
}

.guessy-answer {
  margin: 10px 0;
  color: var(--brand-dark);
  font-family: var(--font-display);
  font-size: clamp(42px, 9vw, 66px);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.wg-tools {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px auto 0;
}

.word-bank {
  max-width: 620px;
  max-height: 170px;
  margin: 12px auto 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #f8fbfa;
  font-size: 13px;
  text-align: left;
}

/* Builder */
.wb-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto 25px;
  color: var(--muted);
  font-size: 18px;
}

.wb-build,
.wb-letters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 64px;
  margin: 15px auto;
}

.wb-slot,
.wb-tile {
  display: grid;
  place-items: center;
  width: clamp(46px, 10vw, 58px);
  height: clamp(52px, 11vw, 64px);
  border: 2px solid var(--brand);
  border-radius: 12px;
  color: var(--brand-dark);
  background: #fff;
  box-shadow: 0 3px 0 #b8d4d0;
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
  text-transform: uppercase;
}

.wb-slot.empty {
  border-style: dashed;
  border-color: #b8c7c5;
  color: transparent;
  background: #f7faf9;
  box-shadow: none;
}

.wb-tile {
  border-color: #c99212;
  color: #503f13;
  background: var(--accent-soft);
  box-shadow: 0 3px 0 #e2c66e;
}

.wb-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.wb-reveal {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  color: var(--bad);
  background: var(--bad-soft);
}

.speak-answer {
  min-height: 38px;
  margin-left: 8px;
  padding: 6px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: #fff;
  font-weight: 700;
}

/* Results */
.results-screen {
  display: grid;
  place-items: center;
}

.results-card {
  width: min(100%, 680px);
  padding: clamp(28px, 5vw, 52px);
  text-align: center;
}

.result-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 18px;
  color: #6e5000;
  background: var(--accent-soft);
  font-family: var(--font-display);
  font-size: 32px;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 15px 0 20px;
  font-size: 30px;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.star-empty { filter: grayscale(1); opacity: 0.26; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 26px 0;
}

.result-actions {
  justify-content: center;
}

.level-banner,
.achievement-banner {
  margin: 0 auto 15px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-family: var(--font-display);
  font-weight: 700;
}

.rank-banner {
  font-size: clamp(18px, 3vw, 24px);
}

/* Dialog */
dialog {
  width: min(calc(100% - 28px), 480px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: var(--shadow-md);
}

dialog::backdrop {
  background: rgba(36, 52, 71, 0.42);
  backdrop-filter: blur(2px);
}

.dialog-inner { padding: 24px; }
.dialog-inner h2 { font-size: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.toast {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-md);
  font-weight: 700;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.confetti {
  position: fixed;
  z-index: 150;
  top: -20px;
  pointer-events: none;
  animation: confetti-fall 2.6s linear forwards;
}

@keyframes confetti-fall {
  to { transform: translate3d(20px, 110vh, 0) rotate(620deg); }
}

/* Accessibility preferences */
html.large-text { font-size: 19px; }

html.high-contrast {
  --ink: #121820;
  --muted: #3a4654;
  --brand: #0f6b66;
  --brand-dark: #0a4f4b;
  --line: #7a8f8a;
  --accent: #c99212;
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 820px) {
  .welcome-card { grid-template-columns: 1fr; }
  .welcome-story { padding-bottom: 28px; }
  .game-card {
    grid-template-columns: auto 1fr;
  }
  .game-card .game-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .achievements { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .screen { padding: 14px 14px 34px; }
  .app-bar { margin-bottom: 14px; }
  .brand-sub { display: none; }
  .bar-actions .btn-quiet {
    width: auto;
    overflow: visible;
    padding-inline: 8px;
    color: var(--brand-dark);
    font-size: 14px;
  }
  #help-link::before,
  #settings-link::before { content: none; }
  .welcome-screen { padding-top: 12px; }
  .welcome-card { border-radius: 20px; }
  .welcome-story,
  .welcome-form { padding: 24px 20px; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .option-grid,
  .choices { grid-template-columns: 1fr; }
  .hub-footer { flex-direction: column; }
  .game-body { min-height: 480px; padding: 20px 12px 28px; }
  .choice { min-height: 60px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stats .stat:last-child { grid-column: span 2; }
  .data-actions { grid-template-columns: 1fr; }
  .setting-row { align-items: flex-start; }
  .lexicon-hero .brand-hero { font-size: clamp(34px, 11vw, 50px); }
  .hub-ritual { padding: 22px 16px; }
}

@media (max-width: 390px) {
  .brand-name { font-size: 15px; }
  .bar-actions { gap: 2px; }
  .wg-key { min-width: 26px; min-height: 44px; }
  .wg-kb-row { gap: 3px; }
  .wb-slot,
  .wb-tile { width: 42px; height: 50px; }
}

@media (orientation: landscape) and (max-height: 620px) {
  .game-body { min-height: 0; padding-top: 18px; }
  .wg-grid { gap: 4px; width: 245px; }
  .wg-row { gap: 4px; }
  .wg-slot { font-size: 20px; }
  .wg-key { min-height: 38px; }
  .game-topbar { margin-bottom: 8px; }
}
