/* Shared by every page: the soft pastel base, the rounded cards, the gentle motion.
   A game's own page adds its identity on top (see wordsprint/wordsprint.css). */

@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/Fredoka-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/Fredoka-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg-top: #fde3f0;
  --bg-bottom: #e2e1fb;
  --ink: #3b2b5e;
  --ink-soft: #6d6090;
  --card: #ffffff;
  --lip: #dcd4f3;
  --accent: #7b6cf6;
  --accent-lip: #5a4bd1;
  --mint: #bff0dc;
  --peach: #ffd9c4;
  --butter: #fff1b8;
  --sky: #cfe6ff;
  --radius: 28px;
  --gutter: 16px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Fredoka', ui-rounded, 'Nunito', system-ui, sans-serif;
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(170deg, var(--bg-top), var(--bg-bottom)) fixed;
  background-color: var(--bg-bottom);
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent-lip); }

/* ── The drifting circles and sparkles behind everything ─────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.55) 1.5px, transparent 2px);
  background-size: 38px 38px;
}
.backdrop span {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: drift 18s ease-in-out infinite alternate;
}
.backdrop span:nth-child(1) { width: 60vmax; height: 60vmax; left: -25vmax; top: -20vmax; }
.backdrop span:nth-child(2) { width: 45vmax; height: 45vmax; right: -20vmax; top: 10vh; animation-delay: -6s; }
.backdrop span:nth-child(3) { width: 50vmax; height: 50vmax; left: -10vmax; bottom: -30vmax; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(3vmax, 2vmax) scale(1.06); }
}

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

.page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px var(--gutter) 32px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 0 var(--lip), 0 18px 40px rgba(90, 70, 160, 0.12);
}

h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0 0 0.4em; }

.pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--butter);
  color: var(--ink);
}

.button {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 5px 0 var(--accent-lip);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--accent-lip); }
.button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-lip); }

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 24px var(--gutter) 40px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-bottom: 8px; }
.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }

/* ── Entrance: things float up into place, one after another ──────────────── */

.rise { animation: rise 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.rise:nth-child(2) { animation-delay: 0.08s; }
.rise:nth-child(3) { animation-delay: 0.16s; }
.rise:nth-child(4) { animation-delay: 0.24s; }
.rise:nth-child(5) { animation-delay: 0.32s; }
.rise:nth-child(6) { animation-delay: 0.40s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Legal pages: a readable column on a white card ───────────────────────── */

.doc { padding: 36px clamp(20px, 5vw, 56px); max-width: 780px; margin: 0 auto; }
.doc h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.doc h2 { font-size: 1.35rem; margin-top: 1.8em; }
.doc h3 { font-size: 1.1rem; margin-top: 1.4em; }
.doc p, .doc li, .doc td {
  color: #463a66;
  /* Long reading: the system face at a normal weight; the rounded face stays for headings. */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
}
.doc strong { font-weight: 650; color: var(--ink); }
.doc .table { overflow-x: auto; margin: 1em 0; }
.doc table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.95rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 2px solid #f0ecfb; }
.doc th { background: #f6f3ff; font-weight: 600; }
.doc tr:first-child th:first-child { border-top-left-radius: 14px; }
.doc tr:first-child th:last-child { border-top-right-radius: 14px; }
.doc code { background: #f3f0fd; padding: 1px 6px; border-radius: 6px; font-size: 0.92em; }
.doc hr { border: none; height: 2px; background: #f0ecfb; margin: 2em 0; }
.back { display: inline-block; margin-bottom: 18px; text-decoration: none; font-weight: 600; }
