:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #536157;
  --paper: #fffdf7;
  --soft: #f1efe6;
  --line: #d7d1bf;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warm: #b45309;
  --ok: #166534;
  --bad: #9f1239;
  --shadow: 0 24px 60px rgba(23, 33, 27, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 19px;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(20px, 5vw, 56px);
  background: rgba(255, 253, 247, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  letter-spacing: 0;
}

.header-actions,
.hero-actions,
.share-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.header-actions a {
  font-weight: 700;
  text-decoration: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.answer-row button,
.quiz-form button,
.email-row button,
.solution-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button,
.answer-row button,
.quiz-form button,
.email-row button {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.22);
}

.primary-button:hover,
.answer-row button:hover,
.quiz-form button:hover,
.email-row button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--ink);
  color: #ffffff;
}

.ghost-button,
.solution-button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.hero {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  padding: clamp(44px, 8vw, 84px) clamp(20px, 5vw, 72px);
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.98) 0%, rgba(255, 253, 247, 0.88) 48%, rgba(237, 242, 233, 0.82) 100%),
    radial-gradient(circle at 80% 20%, rgba(15, 118, 110, 0.18), transparent 34%);
  overflow: hidden;
}

.hero-copy {
  max-width: 720px;
  animation: rise-in 600ms ease both;
}

.eyebrow,
.game-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1.08;
}

.hero-text {
  max-width: 620px;
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: clamp(1.12rem, 2vw, 1.45rem);
}

.morning-visual {
  position: relative;
  min-height: 440px;
  display: grid;
  place-items: center;
  animation: float-in 700ms ease 120ms both;
}

.morning-visual::before {
  content: "";
  position: absolute;
  width: min(36vw, 440px);
  height: min(36vw, 440px);
  border-radius: 50%;
  background: #e6d8bd;
  opacity: 0.42;
}

.paper-sheet {
  position: relative;
  width: min(88vw, 420px);
  min-height: 520px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

.paper-date,
.paper-title,
.paper-line,
.paper-grid,
.paper-score {
  display: block;
}

.paper-date {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.paper-title {
  margin-top: 14px;
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 900;
}

.paper-line {
  width: 72%;
  height: 12px;
  margin-top: 28px;
  border-radius: 999px;
  background: #d9cdb4;
}

.paper-line.wide {
  width: 100%;
}

.paper-grid {
  width: 100%;
  height: 160px;
  margin-top: 34px;
  border: 2px solid #9a8f7c;
  background:
    linear-gradient(#9a8f7c 2px, transparent 2px),
    linear-gradient(90deg, #9a8f7c 2px, transparent 2px);
  background-size: 40px 40px;
}

.paper-score {
  width: max-content;
  margin-top: 34px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
}

.intro-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.intro-band p {
  margin: 0;
  padding: 22px clamp(20px, 4vw, 48px);
  background: #fbf6ea;
  font-weight: 800;
  text-align: center;
}

.game-shell,
.email-section,
.share-section {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(46px, 7vw, 84px) 0;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 28px;
}

.section-heading p:not(.eyebrow),
.email-section p,
.share-section p {
  color: var(--muted);
}

.score-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f2e7;
  font-weight: 800;
}

.score-panel strong {
  color: var(--accent-dark);
  font-size: 1.5rem;
}

.game-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.game-instruction {
  margin: 0;
  color: var(--muted);
}

.letter-bank,
.number-bank {
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 14px 18px;
  border-radius: 8px;
  background: #f3ead9;
  color: var(--ink);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.number-bank {
  letter-spacing: 0;
}

.answer-row,
.email-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.answer-row label,
.email-form label {
  grid-column: 1 / -1;
  font-weight: 900;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffdf8;
  color: var(--ink);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="radio"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

.quiz-form {
  display: grid;
  gap: 12px;
}

.quiz-form label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  font-weight: 800;
}

.quiz-form input {
  width: 24px;
  height: 24px;
}

.feedback {
  min-height: 30px;
  margin: 0;
  font-weight: 900;
}

.feedback.is-ok {
  color: var(--ok);
}

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

.solution {
  margin: 0;
  padding: 16px;
  border-left: 6px solid var(--warm);
  background: #fff7ed;
  font-weight: 700;
}

.email-section,
.share-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1.1fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  border-top: 1px solid var(--line);
}

.email-form {
  display: grid;
  gap: 12px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px clamp(20px, 5vw, 56px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.legal-page {
  width: min(860px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(42px, 7vw, 78px) 0;
}

.legal-page h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
}

.legal-page h2 {
  margin-top: 34px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.legal-page p {
  color: var(--muted);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@media (max-width: 820px) {
  body {
    font-size: 18px;
  }

  .site-header {
    position: static;
    align-items: flex-start;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .hero,
  .email-section,
  .share-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .morning-visual {
    min-height: 340px;
  }

  .paper-sheet {
    min-height: 360px;
  }

  .intro-band {
    grid-template-columns: 1fr;
  }

  .answer-row,
  .email-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .site-header,
  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions,
  .hero-actions,
  .share-actions {
    align-items: stretch;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .answer-row button,
  .quiz-form button,
  .email-row button,
  .solution-button {
    width: 100%;
    text-align: center;
  }

  .game-shell,
  .email-section,
  .share-section {
    width: min(100% - 28px, 1120px);
  }
}

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

@media print {
  .site-header,
  .hero,
  .intro-band,
  .email-section,
  .share-section,
  .site-footer,
  .score-panel,
  .answer-row,
  .quiz-form,
  .solution-button,
  .feedback {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 14pt;
  }

  .game-shell {
    width: 100%;
    padding: 0;
  }

  .section-heading {
    margin-bottom: 18pt;
  }

  .game-panel {
    page-break-inside: avoid;
    margin: 0 0 16pt;
    border: 1pt solid #000;
    padding: 14pt;
  }

  .letter-bank,
  .number-bank {
    border: 1pt solid #000;
    background: #ffffff;
    color: #000000;
  }

  .solution {
    display: block !important;
    border-left: 3pt solid #000;
    background: #ffffff;
  }
}
