/* Shared by the hub and every game page. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1c1712;
  --muted: #5d544a;
  --line: #e4ddd3;
  --accent: #c2410c;
  --on-accent: #ffffff;
  --chip: #f1ebe3;
  --felt: #1f6b45;
  --felt-2: #17583a;
  --shadow: 0 1px 2px rgb(0 0 0 / .08), 0 4px 14px rgb(0 0 0 / .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120d09;
    --surface: #1d1610;
    --text: #f4ece4;
    --muted: #b3a597;
    --line: #33281f;
    --accent: #ff9a52;
    --on-accent: #1c1712;
    --chip: #2a2018;
    --felt: #164d33;
    --felt-2: #103c27;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 18px rgb(0 0 0 / .3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top, .wrap, .foot { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; justify-content: space-between; align-items: center; height: 60px; gap: 12px; }
.brand { font-weight: 600; text-decoration: none; white-space: nowrap; }
.top nav { display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; }
.top nav a:hover { color: var(--text); }

.foot { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 20px; padding-bottom: 32px; color: var(--muted); font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control (difficulty / mode pickers) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Game page */
.game-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 8px 0 12px; }
.game-head h1 { font-size: clamp(22px, 4vw, 30px); line-height: 1.2; margin: 0; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stats { display: flex; gap: 14px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.stats b { color: var(--text); font-weight: 600; }
.stage { position: relative; max-width: 1080px; margin: 0 auto; }

/* Long-form content under each game */
.content { max-width: 760px; padding-top: 32px; }
.content h2 { font-size: 22px; line-height: 1.3; margin: 28px 0 8px; }
.content h3 { font-size: 17px; margin: 18px 0 4px; }
.content p, .content li { color: var(--muted); }
.content ol, .content ul { padding-left: 22px; }
.content strong { color: var(--text); }
.more { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin-top: 12px; }
.more a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.more a:hover { border-color: var(--accent); }
.more b { display: block; }
.more span { font-size: 13px; color: var(--muted); }

/* Dialog + toast (util.js) */
dialog.gm {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 18px;
  background: var(--surface); color: var(--text);
  width: min(92vw, 380px); box-shadow: 0 20px 60px rgb(0 0 0 / .35);
}
dialog.gm::backdrop { background: rgb(0 0 0 / .45); }
dialog.gm h2 { margin: 0 0 8px; font-size: 22px; }
dialog.gm .gm-body { color: var(--muted); }
dialog.gm .gm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.gm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin: 12px 0 4px; text-align: center; }
.gm-grid div { background: var(--chip); border-radius: 10px; padding: 8px 4px; }
.gm-grid b { display: block; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.gm-grid span { font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .top nav a.hide-sm { display: none; }
  .stats { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---- Game page as its own small website ---- */
.page-game [id] { scroll-margin-top: 70px; }
.gs-bar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.gs-bar-in { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 54px; display: flex; align-items: center; gap: 14px; }
.gs-brand { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; min-width: 0; max-width: 32%; color: var(--text); text-decoration: none; font-weight: 700; }
.gs-brand b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-logo { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.gs-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.gs-nav::-webkit-scrollbar { display: none; }
.gs-nav a { padding: 7px 11px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.gs-nav a:hover, .gs-nav a.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.gs-cta { flex: none; text-decoration: none; }
@media (max-width: 760px) { .gs-bar-in { height: 46px; padding: 0 10px; } .gs-brand, .gs-cta { display: none; } }

.gs-hero { display: grid; gap: 20px; align-items: center; padding-top: 18px; padding-bottom: 14px; }
@media (min-width: 820px) { .gs-hero { grid-template-columns: minmax(0, 1fr) 250px; } }
.gs-kicker { margin: 0; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.gs-hero h1 { font-size: clamp(26px, 4.4vw, 40px); line-height: 1.15; margin: 4px 0 8px; }
.gs-lead { margin: 0 0 12px; color: var(--muted); max-width: 70ch; }
.gs-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gs-chips li { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.gs-hero-art { border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .45); transform: rotate(1.5deg); }
@media (max-width: 819px) { .gs-hero-art { display: none; } .gs-lead { font-size: 15px; } }
.page-game .game-head { justify-content: flex-start; }

.gs-body { display: grid; gap: 32px; }
@media (min-width: 1000px) { .gs-body { grid-template-columns: minmax(0, 760px) 240px; justify-content: space-between; } }
.gs-body .content { max-width: none; }
.gs-body .content h2 { display: flex; align-items: center; gap: 10px; margin-top: 38px; }
.gs-body .content h2::before { content: ""; flex: none; width: 5px; height: 1em; border-radius: 3px; background: var(--accent); }
.gs-toc { display: none; }
@media (min-width: 1000px) { .gs-toc { display: block; padding-top: 32px; } .gs-toc-in { position: sticky; top: 70px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); max-height: calc(100vh - 90px); overflow: auto; } }
.gs-toc h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.gs-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.gs-toc a { display: block; padding: 6px 9px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.gs-toc a:hover, .gs-toc a.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.gs-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 34px 0 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.gs-share span { font-weight: 600; margin-right: auto; }

/* Rich content blocks used in guide.html */
.content .g-steps { list-style: none; padding: 0; display: grid; gap: 10px; counter-reset: gstep; }
@media (min-width: 640px) { .content .g-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.content .g-steps li { counter-increment: gstep; position: relative; padding: 14px 14px 14px 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.content .g-steps li::before { content: counter(gstep); position: absolute; left: 14px; top: 13px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent); color: var(--on-accent); }
.content .g-cards { display: grid; gap: 10px; }
@media (min-width: 640px) { .content .g-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.content .g-card { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.content .g-card h3 { margin: 0 0 4px; }
.content .g-card p { margin: 0; }
.content .g-tips { list-style: none; padding: 0; display: grid; gap: 8px; }
.content .g-tips li { position: relative; padding: 11px 14px 11px 44px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.content .g-tips li::before { content: "💡"; position: absolute; left: 14px; top: 10px; }
.content .g-gloss { display: grid; gap: 8px; margin: 0; }
@media (min-width: 640px) { .content .g-gloss { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.content .g-gloss div { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.content .g-gloss dt { font-weight: 700; color: var(--text); }
.content .g-gloss dd { margin: 3px 0 0; color: var(--muted); font-size: 15px; }
.content .faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 8px 0; }
.content .faq summary { cursor: pointer; padding: 13px 16px; font-weight: 600; color: var(--text); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.content .faq summary::-webkit-details-marker { display: none; }
.content .faq summary::after { content: "+"; color: var(--accent); }
.content .faq details[open] summary::after { content: "−"; }
.content .faq details p { margin: 0; padding: 0 16px 13px; }
@media (max-width: 760px) { .gs-hero { padding-top: 10px; padding-bottom: 4px; } .gs-hero h1 { font-size: 24px; margin: 2px 0 0; } .gs-lead, .gs-chips { display: none; } }
@media (max-width: 819px) { .gs-hero .gs-hero-art { display: none; } }
