/* wordstonegame.com. Colours come from the app: Moonlit Lake (World.swift, cosmos) for the night,
   the Sandstone tile set (Theme.swift) for stones, Palette.gold for a picked letter, Palette.red for a bust only. */

:root {
  --night: #0b0620;
  --night-2: #150c33;
  --night-3: #1f1446;
  --text: #f2eee4;
  --muted: rgba(242, 238, 228, 0.72);
  --faint: rgba(242, 238, 228, 0.5);
  --line: rgba(242, 238, 228, 0.12);
  --gold: #f6c453;
  --gold-ink: #2b1f12;
  --stone: #e6d3ae;
  --stone-side: #8e7449;
  --stone-rim: #fff2d4;
  --stone-ink: #2b1f12;
  --picked: #09090b;
  --bust: #ef5a50;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(30px, 4.4vw, 46px); }
h3 { font-size: 21px; letter-spacing: -0.01em; }
p { margin: 0; }
p + p { margin-top: 0.9em; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.narrow { max-width: 46rem; }
.lead { font-size: clamp(18px, 2vw, 20px); color: var(--muted); max-width: 36rem; }
.muted { color: var(--muted); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--gold); color: var(--gold-ink); padding: 8px 14px; border-radius: 10px; }

/* Header */
.top { position: absolute; inset: 0 0 auto; z-index: 5; }
.top-solid { position: static; border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 800 19px/1 var(--display); letter-spacing: 0.01em; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.top nav { display: flex; gap: 6px 22px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; padding: 10px 0; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
@media (max-width: 560px) { .top nav .opt { display: none; } }

/* Store button: a plain pill until APP_STORE_URL is set in site.js */
.store {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font: 700 17px/1 var(--display);
  text-decoration: none;
}
.store svg { width: 20px; height: 20px; flex: none; }
a.store { background: var(--gold); color: var(--gold-ink); box-shadow: 0 10px 30px -12px rgba(246, 196, 83, 0.7); }
a.store:hover { background: #ffd472; }
span.store { color: var(--text); border: 1px solid rgba(246, 196, 83, 0.55); background: rgba(11, 6, 32, 0.55); }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.cta-row .note { font-size: 15px; color: var(--muted); }

/* Hero: the Moonlit Lake painting under the dark, like the app's Backdrop (Tuning.backdropDim 0.5) */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 112px 0 72px; }
.hero-art { position: absolute; inset: 0; z-index: -1; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 6, 32, 0.82) 0%, rgba(11, 6, 32, 0.45) 55%, rgba(11, 6, 32, 0.3) 100%),
    linear-gradient(180deg, rgba(11, 6, 32, 0.25) 0%, rgba(11, 6, 32, 0) 40%, var(--night) 100%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6.2vw, 76px); line-height: 1.02; letter-spacing: -0.022em; max-width: 12ch; }
.hero .lead { margin-top: 22px; color: rgba(242, 238, 228, 0.82); }
.tagline { display: flex; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.tagline li {
  font: 800 13px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--stone-ink); background: var(--stone); padding: 8px 11px 7px; border-radius: 9px 12px 8px 11px;
  box-shadow: 0 3px 0 var(--stone-side), inset 0 1px 0 var(--stone-rim);
}
.tagline li:nth-child(2) { border-radius: 12px 8px 11px 9px; }
.tagline li:nth-child(3) { border-radius: 8px 11px 9px 13px; }

/* The board */
.board { position: relative; width: min(100%, 520px); margin-inline: auto; padding-bottom: 64px; }
.board svg { width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.55)); }
.board .side { fill: var(--stone-side); }
.board .face { fill: var(--stone); stroke: var(--stone-rim); stroke-width: 2; stroke-opacity: 0.7; }
.board text { fill: var(--stone-ink); font-family: var(--display); font-weight: 800; text-anchor: middle; }
.board .pick .face { fill: var(--picked); stroke: var(--gold); stroke-opacity: 1; stroke-width: 3; }
.board .pick .side { fill: #000; }
.board .pick text { fill: var(--gold); }
.offer {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 8px 8px 8px 16px; border-radius: 18px;
  background: rgba(11, 6, 32, 0.78); border: 1px solid rgba(246, 196, 83, 0.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.offer b { font: 800 18px/1 var(--display); letter-spacing: 0.06em; color: var(--gold); }
.offer .pts { font: 700 15px/1 var(--display); color: var(--muted); margin-right: 4px; }
.offer span.btn { font: 700 14px/1 var(--display); padding: 10px 14px; border-radius: 12px; }
.offer .take { background: var(--gold); color: var(--gold-ink); }
.offer .longer { border: 1px solid var(--line); color: var(--text); }

@media (prefers-reduced-motion: no-preference) {
  .board .pick .face { animation: pick-face 0.5s ease-out both; }
  .board .pick text { animation: pick-text 0.5s ease-out both; }
  .board .p1 > * { animation-delay: 0.5s !important; }
  .board .p2 > * { animation-delay: 0.85s !important; }
  .board .p3 > * { animation-delay: 1.2s !important; }
  .board .p4 > * { animation-delay: 1.55s !important; }
  .board .p5 > * { animation-delay: 1.9s !important; }
  .offer { animation: offer-in 0.45s 2.4s ease-out both; }
}
@keyframes pick-face { from { fill: var(--stone); stroke: var(--stone-rim); } }
@keyframes pick-text { from { fill: var(--stone-ink); } }
@keyframes offer-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Sections */
.section { padding: clamp(72px, 10vw, 120px) 0; }
.section-head { max-width: 42rem; margin-bottom: 44px; }
.section-head p { margin-top: 16px; color: var(--muted); font-size: 18px; }
.rule { border-top: 1px solid var(--line); }

/* A round, in four steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; border-top: 2px solid var(--stone-side); padding-top: 18px; }
.steps li::before { content: counter(step); display: block; font: 800 44px/1 var(--display); color: var(--stone); margin-bottom: 14px; }
.steps h3 { margin-bottom: 8px; }
.steps p { color: var(--muted); font-size: 16px; }

/* Take or go longer */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: var(--night-2); }
.choice > div { padding: clamp(24px, 4vw, 44px); }
.choice > div + div { border-left: 1px solid var(--line); background: var(--night-3); }
.choice h3 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 12px; }
.choice p { color: var(--muted); }
.word { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 14px; align-items: center; }
.word i {
  font: 800 20px/1 var(--display); font-style: normal; width: 40px; height: 42px; display: grid; place-items: center;
  background: var(--picked); color: var(--gold); border: 2px solid var(--gold);
  border-radius: 11px 14px 10px 13px; box-shadow: 0 4px 0 #000;
}
.word i:nth-child(even) { border-radius: 14px 10px 13px 11px; }
.word .new { border-style: dashed; }
.word .dead { color: var(--bust); border-color: var(--bust); }
.word .tag { font: 700 15px/1 var(--display); color: var(--muted); margin-left: 6px; }
.word .tag b { color: var(--gold); }
.word .tag .lost { color: var(--bust); }
.small { font-size: 15px; color: var(--faint); margin-top: 24px; }

/* Daily */
.daily { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.facts { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--line); }
.facts li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts b { font-family: var(--display); }
.facts span { color: var(--muted); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week div { aspect-ratio: 1; border-radius: 12px 15px 11px 14px; display: grid; place-items: center; font: 800 15px/1 var(--display); background: var(--stone); color: var(--stone-ink); box-shadow: 0 4px 0 var(--stone-side); }
.week div:nth-child(odd) { border-radius: 15px 11px 14px 12px; }
.week .today { background: var(--picked); color: var(--gold); border: 2px solid var(--gold); box-shadow: 0 4px 0 #000; }
.week .later { background: transparent; color: var(--faint); border: 1px dashed var(--line); box-shadow: none; }
.week-label { display: flex; justify-content: space-between; margin-top: 18px; font-size: 14px; color: var(--muted); }

/* Worlds: the nine paintings side by side, as in the app */
.worlds { display: flex; gap: 6px; height: min(72vh, 620px); padding-inline: 16px; }
.worlds figure { position: relative; flex: 1 1 0; min-width: 0; margin: 0; border-radius: 18px; overflow: hidden; transition: flex-grow 0.45s ease; }
.worlds figure:hover, .worlds figure:focus-within { flex-grow: 2.4; }
.worlds img { width: 100%; height: 100%; object-fit: cover; }
.worlds figcaption {
  position: absolute; inset: auto 0 0; padding: 48px 14px 14px;
  background: linear-gradient(180deg, transparent, rgba(11, 6, 32, 0.9));
  font: 800 16px/1.15 var(--display);
}
.worlds figcaption span { display: block; font: 600 13px/1.3 var(--body); color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .worlds figure { transition: none; } }

.with-shot { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: center; }
.with-shot.left { grid-template-columns: 300px minmax(0, 1fr); }
.shot { display: block; border-radius: 38px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7); background: var(--night-2); }
.shot-caption { font-size: 14px; color: var(--faint); margin-top: 12px; text-align: center; }

.sets { margin: 28px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.sets li { display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 14px; font-size: 15px; }
.sets i { width: 26px; height: 26px; border-radius: 7px 9px 6px 8px; display: grid; place-items: center; font: 800 13px/1 var(--display); font-style: normal; border: 2px solid transparent; }
.sets small { color: var(--faint); font-size: 13px; }

/* Levels */
.ladder { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; }
.ladder li { break-inside: avoid; display: grid; grid-template-columns: 4.2rem 1fr auto; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ladder .n { font: 800 24px/1 var(--display); color: var(--stone); }
.ladder .name { font-weight: 700; }
.ladder .name small { display: block; font-weight: 500; color: var(--faint); font-size: 14px; }
.ladder .lock { font-size: 13px; font-weight: 700; color: var(--gold); }
.ladder .free { font-size: 13px; font-weight: 700; color: var(--muted); }

/* Pro */
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; max-width: 30rem; }
.prices .price { margin: 0; }
.price { border: 1px solid var(--line); border-radius: 20px; padding: 20px; background: var(--night-2); }
.price b { display: block; font: 800 30px/1 var(--display); }
.price span { color: var(--muted); font-size: 15px; }
.ticks { list-style: none; margin: 26px 0 0; padding: 0; }
.ticks li { position: relative; padding: 7px 0 7px 30px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 13px; height: 13px; border-radius: 4px 5px 3px 5px; background: var(--gold); transform: rotate(8deg); }

/* FAQ */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 20px 40px 20px 0; position: relative; font: 700 18px/1.35 var(--display); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font: 400 26px/1 var(--body); color: var(--gold); }
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 0 22px; color: var(--muted); max-width: 44rem; }

/* Closing */
.closing { text-align: center; padding: clamp(80px, 12vw, 140px) 0; position: relative; overflow: hidden; isolation: isolate; }
.closing .icon { width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 28px; box-shadow: 0 20px 50px -10px rgba(246, 196, 83, 0.35); }
.closing h2 { max-width: 16ch; margin-inline: auto; }
.closing p { margin: 16px auto 0; color: var(--muted); max-width: 32rem; }
.closing .cta-row { justify-content: center; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 36px 0 48px; font-size: 15px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 18px 32px; justify-content: space-between; align-items: center; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.foot nav a:hover { color: var(--text); }
.fine { color: var(--faint); font-size: 13px; }

/* Text pages */
.page { padding: 56px 0 96px; }
.page h1 { font-size: clamp(36px, 5.5vw, 56px); letter-spacing: -0.025em; max-width: 18ch; }
.page .lead { margin-top: 18px; }
.page h2 { font-size: clamp(24px, 3vw, 30px); margin: 56px 0 14px; }
.page h3 { margin: 28px 0 8px; }
.page p, .page li { max-width: 42rem; }
.page ul, .page ol { padding-left: 1.3em; }
.page li { margin: 6px 0; }
.page li::marker { color: var(--stone-side); }
.crumbs { font-size: 14px; color: var(--faint); margin-bottom: 26px; }
.crumbs a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--faint); }
.crumbs a:hover { color: var(--text); }
.updated { color: var(--faint); font-size: 15px; margin-top: 12px; }
.answer { font-size: 19px; color: var(--text); max-width: 42rem; margin-top: 18px; padding-left: 18px; border-left: 3px solid var(--gold); }
.howto { counter-reset: s; list-style: none; padding: 0 !important; }
.howto > li { counter-increment: s; position: relative; padding: 4px 0 18px 56px; }
.howto > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 38px; height: 40px; display: grid; place-items: center; font: 800 18px/1 var(--display); background: var(--stone); color: var(--stone-ink); border-radius: 10px 13px 9px 12px; box-shadow: 0 3px 0 var(--stone-side); }
.howto h3 { margin: 4px 0 6px; }
.howto p { color: var(--muted); }
.missing { text-align: center; padding: 120px 0; }
.missing h1 { margin-inline: auto; }
.missing p { margin: 16px auto 30px; color: var(--muted); }

/* Narrow screens */
@media (max-width: 900px) {
  .hero { padding: 96px 0 56px; }
  .hero-grid, .daily, .with-shot, .with-shot.left { grid-template-columns: 1fr; }
  .hero-art::after { background: linear-gradient(180deg, rgba(11, 6, 32, 0.55) 0%, rgba(11, 6, 32, 0.5) 50%, var(--night) 100%); }
  .board { width: min(100%, 440px); margin-top: 8px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .with-shot .shot-wrap { max-width: 280px; margin-inline: auto; order: 2; }
  .worlds { height: auto; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .worlds figure { flex: 0 0 58vw; height: 96vw; max-height: 520px; scroll-snap-align: center; }
  .worlds figure:hover, .worlds figure:focus-within { flex-grow: 0; }
}
@media (max-width: 640px) {
  .choice { grid-template-columns: 1fr; }
  .choice > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .ladder { columns: 1; }
  .facts li { grid-template-columns: 1fr; gap: 2px; }
  .offer { gap: 6px; padding-left: 12px; }
  .offer span.btn { padding: 9px 10px; }
}
@media (max-width: 460px) {
  .steps { grid-template-columns: 1fr; }
  .prices { grid-template-columns: 1fr 1fr; gap: 10px; }
  .price { padding: 16px; }
  .price b { font-size: 25px; }
}

/* Small helpers (the CSP allows no inline styles) */
.sub { margin-top: 16px; }
.muted.sub { margin-top: 12px; max-width: 34rem; }
.more { margin-top: 22px; }
.sets-block { margin-top: 72px; }
.h3-lg { font-size: clamp(24px, 3vw, 30px); }
.section-head.tight { margin-bottom: 28px; }
.small.next { margin-top: 12px; }
.faq-title { margin-bottom: 32px; }

/* Tile set swatches: faces, letters and rims from Theme.swift */
.t-stone { background: #e6d3ae; color: #2b1f12; }
.t-graphite { background: #2c2c2e; color: #fff; }
.t-gold { background: #f1d795; color: #3a2906; }
.t-crystal { background: #3e6488; color: #fff; border-color: #b8ecff !important; }
.t-blue { background: #0b1426; color: #5ce1ff; border-color: #2bb8ff !important; }
.t-green { background: #0a1a12; color: #6bff9a; border-color: #2ee06a !important; }
.t-pink { background: #1c0a1a; color: #ff7adf; border-color: #ff3fc8 !important; }
.t-obsidian { background: #2b303b; color: #f2eee4; border-color: #4a5262 !important; }

/* Scoring table on /how-to-play */
.points { border-collapse: collapse; margin: 18px 0; font-variant-numeric: tabular-nums; width: 100%; max-width: 42rem; }
.points th, .points td { border: 1px solid var(--line); padding: 10px 8px; text-align: center; }
.points th { text-align: left; font-weight: 700; color: var(--muted); font-size: 15px; }
.points tbody td { font: 800 18px/1 var(--display); color: var(--gold); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page .faq { margin-top: 8px; }
.store-back { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 14px; background: var(--gold); color: var(--gold-ink); font: 700 17px/1 var(--display); text-decoration: none; }
@media (max-width: 460px) { .points th, .points td { padding: 8px 4px; } .points tbody td { font-size: 15px; } }

/* Text pages read as one centred column on wide screens */
.page .wrap { width: min(720px, 100% - 32px); }
