:root {
  --bg: #f7f1e8;
  --card: #fffaf2;
  --ink: #2b2118;
  --muted: #6b5b4b;
  --accent: #c2562f;
  --accent-dark: #a2441f;
  --gold: #e0a03a;
  --line: #e6d9c6;
  --soft: #f1e6d6;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */
.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font: 700 18px/1.2 var(--serif); }
.brand svg { width: 32px; height: 32px; }
.top nav { display: flex; gap: 24px; font-size: 16px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.top nav a:hover { color: var(--accent-dark); }

/* ---------- hero + player ---------- */
.hero { padding: 24px 0 48px; }
.hero h1 { font-size: 36px; margin-bottom: 8px; }
.hero .lede { color: var(--muted); margin: 0 0 16px; max-width: 70ch; font-size: 16px; }

.stage {
  position: relative;
  width: 100%;
  height: 640px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.cover {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 46%, rgba(224, 160, 58, .18), transparent 60%),
    var(--card);
  text-align: center;
  padding: 24px;
  cursor: pointer;
}
.cover-inner { display: grid; justify-items: center; gap: 24px; }
.cover-compass { display: grid; grid-template-columns: repeat(3, 88px); grid-template-rows: repeat(3, 64px); gap: 8px; }
.cover-compass span {
  display: grid; place-items: center; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-1);
  font: 600 14px/1.2 var(--sans); color: var(--muted);
}
.cover-compass b { display: block; font-size: 22px; color: var(--accent); }
.cover-compass .n { grid-column: 2; grid-row: 1; }
.cover-compass .w { grid-column: 1; grid-row: 2; }
.cover-compass .c { grid-column: 2; grid-row: 2; background: var(--soft); border-style: dashed; }
.cover-compass .e { grid-column: 3; grid-row: 2; }
.cover-compass .s { grid-column: 2; grid-row: 3; }
.cover-note { color: var(--muted); font-size: 14px; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border-radius: var(--radius); border: 2px solid var(--accent);
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 17px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.big { min-height: 56px; padding: 0 32px; font-size: 18px; }
.btn.ghost { background: transparent; color: var(--accent-dark); }
.btn.ghost:hover { background: var(--soft); color: var(--accent-dark); }

.loader {
  position: absolute; inset: 0; display: none;
  place-items: center; align-content: center; gap: 16px;
  background: var(--card); text-align: center; color: var(--muted);
}
[data-gf-state="loading"] .loader { display: grid; }
.loader-arrows { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
.loader-arrows i {
  font-style: normal; font-size: 28px; color: var(--accent);
  display: grid; place-items: center; opacity: .2;
  animation: hop 1.2s infinite;
}
.loader-arrows .n { grid-column: 2; grid-row: 1; animation-delay: 0s; }
.loader-arrows .e { grid-column: 3; grid-row: 2; animation-delay: .3s; }
.loader-arrows .s { grid-column: 2; grid-row: 3; animation-delay: .6s; }
.loader-arrows .w { grid-column: 1; grid-row: 2; animation-delay: .9s; }
@keyframes hop { 0%, 60%, 100% { opacity: .2; transform: scale(1); } 20% { opacity: 1; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .loader-arrows i { animation: none; opacity: .8; } }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip[aria-pressed="true"], .chip[data-gf-liked] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count:empty { display: none; }
.share-msg { color: var(--muted); font-size: 14px; }

/* ---------- article ---------- */
.prose { padding-top: 48px; padding-bottom: 16px; }
.prose > * { max-width: 70ch; }
.prose h2 { font-size: 28px; margin: 48px 0 16px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 22px; margin: 32px 0 8px; }
.prose p, .prose li { color: var(--ink); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose table { border-collapse: collapse; width: 100%; max-width: 70ch; margin: 0 0 24px; font-size: 16px; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.prose th, .prose td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--soft); font-weight: 600; }
.prose strong { font-weight: 600; }
.prose blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--gold); background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- comments ---------- */
.talk { padding-top: 48px; padding-bottom: 64px; }
.talk h2 { font-size: 28px; margin-bottom: 8px; }
.talk .hint { color: var(--muted); margin: 0 0 24px; max-width: 70ch; }
.talk form { display: grid; gap: 12px; max-width: 70ch; background: var(--card); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font: 400 16px/1.5 var(--sans); color: var(--ink);
}
.field textarea { min-height: 112px; resize: vertical; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-msg { color: var(--muted); font-size: 14px; }
.replying { font-size: 14px; color: var(--muted); }
.replying:empty { display: none; }
.comment-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; max-width: 70ch; }
.comment-list[data-gf-empty]::before { content: "No comments yet. What was your best Wonderhop Unlimited round, or your favourite rare answer?"; color: var(--muted); }
.comment-list[data-gf-off] { display: none; }
.comment { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.comment[data-gf-owner] { border-color: var(--gold); background: #fff6e6; }
.comment header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 14px; color: var(--muted); }
.comment header b { color: var(--ink); }
.owner-tag { font-size: 12px; font-weight: 600; color: #7a4d06; background: #fbe3b5; padding: 2px 8px; border-radius: 999px; }
.comment p { margin: 8px 0; white-space: pre-wrap; }
.comment .reply-btn { background: none; border: 0; padding: 0; color: var(--accent-dark); font-weight: 600; font-size: 14px; cursor: pointer; }
.replies { list-style: none; margin: 12px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 8px; }
.replies:empty { display: none; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); background: var(--card); padding: 32px 0; font-size: 14px; color: var(--muted); }
.foot .wrap { display: grid; gap: 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.foot nav a { color: var(--ink); font-weight: 600; text-decoration: none; }
.foot nav a:hover { color: var(--accent-dark); }
.foot p { margin: 0; max-width: 90ch; }

/* ---------- plain pages ---------- */
.page { padding-top: 48px; padding-bottom: 64px; }
.page h1 { font-size: 36px; margin-bottom: 16px; }
.page .prose { padding-top: 16px; }
.contact-box { max-width: 70ch; display: grid; gap: 12px; background: var(--card); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); margin: 24px 0; }

/* ========== the game (inside the iframe) ========== */
body.embed { background: var(--card); height: 100vh; overflow: hidden; }
.g { height: 100vh; display: flex; flex-direction: column; }
.g-screen { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; }
.g-center { margin: auto; width: 100%; max-width: 560px; display: grid; gap: 16px; }
.g-title { font: 700 28px/1.2 var(--serif); text-align: center; margin: 0; }
.g-sub { text-align: center; color: var(--muted); margin: 0; font-size: 15px; }
.g-compass { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 420px; margin: 0 auto; width: 100%; }
.g-dir {
  display: grid; justify-items: center; gap: 2px;
  padding: 12px 8px; min-height: 84px;
  border-radius: var(--radius); border: 1px solid var(--line); background: #fff;
  cursor: pointer; box-shadow: var(--shadow-1); text-align: center;
  transition: border-color .15s, transform .15s;
}
.g-dir:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.g-dir:disabled { opacity: .45; cursor: not-allowed; }
.g-dir .ar { font-size: 24px; line-height: 1; color: var(--accent); }
.g-dir .nm { font-weight: 600; font-size: 16px; }
.g-dir .ds { font-size: 12px; color: var(--muted); line-height: 1.3; }
.g-dir.sky { grid-column: 2; }
.g-dir.past { grid-column: 1; grid-row: 2; }
.g-dir.mix { grid-column: 2; grid-row: 2; background: var(--soft); }
.g-dir.future { grid-column: 3; grid-row: 2; }
.g-dir.abyss { grid-column: 2; grid-row: 3; }
.g-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.g-select { min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 15px; }
.g-stats { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }
.g-keys { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }

.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.g-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: var(--soft); font-weight: 600; }
.g-badge b { color: var(--accent); }
.g-pts { font-weight: 600; }
.g-timer { height: 6px; background: var(--soft); }
.g-timer i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width .1s linear; }
.g-timer.low i { background: var(--accent); }
.g-q { font: 700 28px/1.2 var(--serif); text-align: center; margin: 0; }
.g-goal { text-align: center; color: var(--muted); margin: 0; font-size: 15px; }
.g-goal small { display: block; font-size: 13px; }
.g-form { display: flex; gap: 8px; }
.g-input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 16px;
  border-radius: var(--radius); border: 2px solid var(--line); background: #fff; font-size: 18px;
}
.g-input:focus { border-color: var(--accent); outline: none; }
.g-msg { min-height: 24px; text-align: center; font-size: 15px; color: var(--accent-dark); margin: 0; }
.g-shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.g-secs { text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; margin: 0; }

.g-score { text-align: center; font: 700 48px/1 var(--serif); color: var(--accent); margin: 0; }
.g-you { text-align: center; margin: 0; font-size: 18px; }
.g-rank { text-align: center; margin: 0; color: var(--muted); font-size: 14px; }
.g-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.g-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 15px; }
.g-list li.me { border-color: var(--accent); background: #fdeee6; font-weight: 600; }
.g-list .meter { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.g-list .meter i { display: block; height: 100%; background: var(--gold); }
.g-list .v { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.g-h { font: 600 14px/1.4 var(--sans); color: var(--muted); margin: 8px 0 0; text-transform: none; }
.g-more { background: none; border: 0; color: var(--accent-dark); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: 14px; justify-self: start; }

.g-total { text-align: center; font: 700 48px/1 var(--serif); margin: 0; }
.g-total small { font-size: 22px; color: var(--muted); }
.g-emoji { text-align: center; font-size: 28px; letter-spacing: 4px; margin: 0; }
.g-recap { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.g-recap li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.g-recap .ar { color: var(--accent); font-weight: 600; }
.g-recap .p { font-weight: 600; font-variant-numeric: tabular-nums; }
.g-recap .a { color: var(--muted); }
.g-copy { width: 100%; min-height: 96px; border-radius: 8px; border: 1px solid var(--line); padding: 8px; font: 14px/1.4 var(--sans); }
.g-note { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top nav { gap: 16px; font-size: 15px; }
  .brand span { font-size: 16px; }
  .hero { padding: 16px 0 32px; }
  .hero h1 { font-size: 28px; }
  .stage { height: 600px; border-radius: 8px; }
  .cover-compass { grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 56px); }
  .btn { width: 100%; }
  .actions .chip { flex: 1 1 auto; justify-content: center; }
  .prose h2, .talk h2 { font-size: 22px; }
  .page h1 { font-size: 28px; }
  .g-screen { padding: 16px; }
  .g-title, .g-q { font-size: 22px; }
  .g-dir { min-height: 76px; padding: 8px 4px; }
  .g-dir .ds { font-size: 12px; }
  .g-score, .g-total { font-size: 36px; }
  .g-form { flex-direction: column; }
  .g-form .btn { width: 100%; }
}

[data-gf-reply-cancel] { display: none; }
[data-gf-replying] [data-gf-reply-cancel] { display: inline-flex; }
.page .hint { color: var(--muted); font-size: 14px; margin: 0; }
.contact-box .g-select { width: 100%; }
.prose table { display: block; overflow-x: auto; }
@media (max-width: 640px) {
  .top nav a.nav-play { display: none; }
  .top nav { gap: 12px; font-size: 14px; }
  .prose th, .prose td { padding: 8px 12px; }
}
