:root {
  --ink: #20251b;
  --paper: #f1e8cf;
  --cream: #fff9e9;
  --forest: #304d2d;
  --forest-2: #47643c;
  --orange: #d45f2f;
  --gold: #e9be4d;
  --muted: #667267;
  --line: rgba(24, 38, 30, .16);
  --shadow: 0 24px 70px rgba(24, 38, 30, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 124px; }
body { background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; margin: 0; }
body, button, input, textarea { font-size: 16px; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: -.055em; }
p { line-height: 1.58; }

.site-header { align-items: center; backdrop-filter: blur(14px); background: rgba(243, 237, 221, .91); border-bottom: 1px solid var(--line); display: flex; height: 64px; justify-content: space-between; padding: 0 clamp(18px, 5vw, 72px); position: sticky; top: 0; z-index: 30; }
.wordmark { align-items: center; display: flex; font-size: 14px; font-weight: 800; gap: 10px; letter-spacing: -.02em; }
.wordmark-mark { align-items: center; background: var(--orange); border-radius: 50%; color: white; display: inline-flex; font-family: Georgia, serif; font-size: 19px; height: 34px; justify-content: center; width: 34px; }
.header-note { color: var(--muted); font-size: 12px; }
.eyebrow, .section-kicker p { color: var(--forest-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; margin: 0; text-transform: uppercase; }

.shelf-hero { background: radial-gradient(circle at 82% 26%, rgba(217,106,53,.18), transparent 28%), linear-gradient(145deg, var(--cream), #eadfc5); border-bottom: 1px solid var(--line); padding: clamp(80px, 14vw, 160px) clamp(20px, 8vw, 120px); }
.shelf-hero h1, .root-hero h1 { font-size: clamp(54px, 10vw, 122px); line-height: .88; margin: 26px 0; max-width: 1000px; }
.hero-copy { color: #46534a; font-size: clamp(18px, 2.4vw, 26px); max-width: 670px; }
.shelf-section { padding: 76px clamp(20px, 8vw, 120px) 110px; }
.section-title-row { align-items: end; display: flex; justify-content: space-between; margin-bottom: 30px; }
.section-title-row h2 { font-size: clamp(38px, 5vw, 62px); margin: 7px 0 0; }
.game-count { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; padding: 8px 12px; }
.game-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-tile { border: 1px solid var(--line); border-radius: 24px; display: flex; flex-direction: column; min-height: 470px; overflow: hidden; padding: 22px; position: relative; transition: transform .2s ease, box-shadow .2s ease; }
a.game-tile:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.root-tile { background: var(--forest); color: white; }
.future-tile { background: rgba(255,250,240,.6); border-style: dashed; color: var(--muted); }
.tile-badge { align-self: flex-start; border: 1px solid currentColor; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .12em; opacity: .85; padding: 7px 10px; text-transform: uppercase; }
.tile-letter, .tile-plus { align-items: center; align-self: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; display: flex; flex: 1; font-family: Georgia, serif; font-size: 150px; justify-content: center; line-height: 1; margin: 22px 0; width: 230px; }
.tile-letter { color: var(--gold); }
.tile-letter img { height: auto; width: 170px; }
.tile-plus { border-color: var(--line); color: rgba(24,38,30,.16); font-family: Arial, sans-serif; font-size: 100px; font-weight: 200; }
.tile-copy p { font-size: 12px; margin: 0; opacity: .72; text-transform: uppercase; }
.tile-copy h3 { font-family: Georgia, serif; font-size: 38px; font-weight: 500; margin: 3px 0 10px; }
.tile-copy span { font-size: 14px; }
.tile-copy b { float: right; font-size: 20px; }

.index-button { background: transparent; border: 0; border-bottom: 1px solid currentColor; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 800; min-height: 44px; min-width: 44px; padding: 4px 0; }
.header-actions { align-items: center; display: flex; gap: 18px; }
.settings-button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; min-height: 44px; padding: 5px 0; }
.page-index { background: rgba(255,250,240,.96); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 64px; z-index: 25; }
.index-inner { display: flex; gap: 22px; min-width: max-content; padding: 12px clamp(18px, 5vw, 72px); }
.page-index a { color: #536057; font-size: 12px; font-weight: 700; }

.root-page { background-color: var(--paper); background-image: radial-gradient(rgba(80,70,40,.055) .7px, transparent .7px); background-size: 8px 8px; }
.root-hero { align-items: center; background: linear-gradient(148deg, #fff8e6, #eadab3); border-bottom: 1px solid var(--line); display: grid; gap: clamp(20px, 4vw, 62px); grid-template-columns: minmax(0, 1.05fr) minmax(330px, .72fr); min-height: 710px; overflow: hidden; padding: clamp(70px, 10vw, 112px) clamp(20px, 8vw, 120px) 82px; position: relative; }
.root-hero::before, .root-hero::after { border: 1px solid rgba(48,77,45,.16); border-radius: 50%; content: ''; height: 220px; left: -110px; position: absolute; top: -90px; width: 220px; }
.root-hero::after { height: 310px; left: -154px; top: -135px; width: 310px; }
.root-hero-copy { position: relative; z-index: 2; }
.root-logo { display: block; height: auto; margin: 25px 0 7px; max-width: 410px; width: min(68vw, 410px); }
.root-hero h1 { font-size: clamp(44px, 6.8vw, 86px); margin: 0 0 26px; position: relative; z-index: 2; }
.root-hero .hero-copy { max-width: 620px; position: relative; z-index: 2; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; position: relative; z-index: 2; }
.button { align-items: center; border: 1px solid var(--ink); border-radius: 999px; display: inline-flex; font-size: 14px; font-weight: 800; justify-content: center; min-height: 50px; padding: 0 20px; }
.primary-button { background: var(--ink); color: white; }
.ghost-button { background: rgba(255,255,255,.44); }
.root-hero-art { align-self: end; margin: 0; position: relative; z-index: 1; }
.root-hero-art img { display: block; filter: saturate(.93) contrast(.98); height: auto; mix-blend-mode: multiply; position: relative; transform: rotate(1deg); width: 100%; z-index: 2; }
.root-hero-art figcaption { color: #6f735f; font-size: 9px; letter-spacing: .08em; margin-top: -12px; position: relative; text-align: right; text-transform: uppercase; z-index: 3; }
.art-sun { background: var(--gold); border-radius: 50%; height: 62%; opacity: .48; position: absolute; right: 1%; top: 2%; width: 72%; z-index: 1; }

.guide-section { border-bottom: 1px solid var(--line); padding: 90px clamp(20px, 8vw, 120px); }
.cream-section { background: var(--cream); }
.section-kicker { align-items: center; display: flex; gap: 12px; margin-bottom: 20px; }
.section-kicker > span { border-top: 3px solid var(--orange); font-size: 10px; font-weight: 800; padding-top: 6px; width: 34px; }
.guide-section > h2, .ask-copy h2, .law-section h2 { font-size: clamp(40px, 6vw, 72px); line-height: .95; margin: 0 0 36px; max-width: 900px; }
.idea-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.idea-card { background: white; border: 1px solid var(--line); border-radius: 18px; min-height: 260px; padding: 22px; }
.idea-card > span { color: var(--orange); font-size: 11px; font-weight: 800; }
.idea-card h3 { font-size: 23px; margin: 72px 0 8px; }
.idea-card p { color: var(--muted); font-size: 14px; margin: 0; }
.plain-note { background: #efe7d2; border-left: 3px solid var(--orange); border-radius: 0 12px 12px 0; color: #4c584f; font-size: 14px; line-height: 1.55; margin-top: 18px; padding: 18px 20px; }
.plain-note strong { color: var(--ink); }

.setup-list { border-top: 1px solid var(--line); list-style: none; margin: 0; padding: 0; }
.setup-list li { align-items: start; border-bottom: 1px solid var(--line); display: grid; gap: 24px; grid-template-columns: 48px 1fr; padding: 24px 0; }
.setup-list li > span { color: var(--orange); font-size: 11px; font-weight: 800; padding-top: 5px; }
.setup-list h3 { font-size: 20px; margin: 0; }
.setup-list p { color: var(--muted); margin: 5px 0 0; }
.dark-section { background: var(--forest); color: white; }
.light-kicker p { color: #b9d0bd; }
.phase-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.phase-grid article { border: 1px solid rgba(255,255,255,.18); border-radius: 18px; min-height: 310px; padding: 22px; }
.phase-number { align-items: center; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; display: flex; font-family: Georgia, serif; font-size: 26px; height: 52px; justify-content: center; width: 52px; }
.phase-name { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .15em; margin: 58px 0 6px; text-transform: uppercase; }
.phase-grid h3 { font-size: 24px; margin: 0; }
.phase-grid article > p:last-child { color: #c7d3c9; font-size: 14px; }
.turn-note { border-top: 1px solid rgba(255,255,255,.18); color: #c7d3c9; font-size: 13px; margin: 30px 0 0; padding-top: 18px; }

.action-list { border-top: 1px solid var(--line); }
.action-list article { align-items: start; border-bottom: 1px solid var(--line); display: grid; gap: 24px; grid-template-columns: 72px 1fr; padding: 28px 0; }
.action-icon { align-items: center; background: var(--forest); border-radius: 50%; color: white; display: flex; font-family: Georgia, serif; font-size: 27px; height: 58px; justify-content: center; width: 58px; }
.action-list h3 { font-size: 24px; margin: 0 0 6px; }
.action-list p { color: var(--muted); margin: 0; max-width: 800px; }
.battle-flow { counter-reset: battle; display: grid; gap: 0; grid-template-columns: repeat(4, 1fr); }
.battle-flow > div { border-left: 1px solid var(--line); min-height: 250px; padding: 8px 22px 20px; }
.battle-flow > div:last-child { border-right: 1px solid var(--line); }
.battle-flow span { color: var(--orange); font-size: 11px; font-weight: 800; }
.battle-flow h3 { font-size: 20px; margin: 76px 0 8px; }
.battle-flow p { color: var(--muted); font-size: 14px; margin: 0; }

.faction-section { background: #e8e0cc; }
.section-intro { color: var(--muted); margin: -18px 0 28px; max-width: 680px; }
.faction-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filter-button { background: transparent; border: 1px solid var(--ink); border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; min-height: 44px; padding: 10px 13px; }
.filter-button.active { background: var(--ink); color: white; }
.faction-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.faction-card { background: var(--cream); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 7px 0 rgba(32,37,27,.035); overflow: hidden; }
.faction-card summary { align-items: center; cursor: pointer; display: grid; gap: 12px; grid-template-columns: 15px 1fr 22px; list-style: none; min-height: 84px; padding: 15px 18px; }
.faction-card summary::-webkit-details-marker { display: none; }
.faction-dot { background: var(--faction); border-radius: 50%; height: 10px; width: 10px; }
.faction-card small { color: var(--muted); display: block; font-size: 9px; font-weight: 800; letter-spacing: .13em; margin-bottom: 3px; text-transform: uppercase; }
.faction-card strong { font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.details-mark { font-size: 22px; transition: transform .2s ease; }
.faction-card[open] .details-mark { transform: rotate(45deg); }
.faction-body { border-top: 1px solid var(--line); overflow: hidden; padding: 4px 18px 15px 45px; position: relative; }
.faction-art { float: right; height: 170px; margin: 8px -12px 4px 10px; object-fit: contain; width: 155px; }
.faction-body p { color: var(--muted); font-size: 13px; }
.faction-body b { color: var(--ink); display: block; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }

.golden-section { background: var(--gold); }
.golden-grid { display: grid; gap: 1px; grid-template-columns: repeat(3, 1fr); }
.golden-grid article { border-top: 1px solid rgba(24,38,30,.3); min-height: 190px; padding: 16px 20px 20px 0; }
.golden-grid span { font-size: 10px; font-weight: 800; }
.golden-grid h3 { font-size: 21px; margin: 52px 0 7px; }
.golden-grid p { color: #485044; font-size: 14px; margin: 0; }

.ask-section { background: #142d23; color: white; }
.ask-layout { display: grid; gap: clamp(30px, 7vw, 100px); grid-template-columns: .9fr 1.1fr; }
.ask-copy > p { color: #becdc2; font-size: 17px; max-width: 520px; }
.sample-questions { display: flex; flex-direction: column; gap: 8px; margin-top: 28px; }
.sample-questions button { background: transparent; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: white; cursor: pointer; font-size: 12px; min-height: 44px; padding: 10px 14px; text-align: left; }
.ask-card { background: var(--cream); border-radius: 20px; color: var(--ink); padding: clamp(20px, 4vw, 34px); }
.ask-card label:not(.listen-toggle) { display: block; font-size: 11px; font-weight: 800; margin: 0 0 8px; text-transform: uppercase; }
.ask-card input, .ask-card textarea { background: white; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); margin: 0 0 20px; outline: 0; padding: 13px 14px; width: 100%; }
.ask-card input:focus, .ask-card textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(37,77,57,.12); }
.ask-actions { display: flex; gap: 8px; }
.ask-actions button { border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 800; min-height: 48px; padding: 0 16px; }
.ask-button { background: var(--orange); border: 1px solid var(--orange); color: white; flex: 1; }
.ask-button:disabled { cursor: wait; opacity: .7; }
.speak-button { background: white; border: 1px solid var(--line); color: var(--ink); }
.speak-button span { color: var(--orange); }
.speak-button.listening { background: #fbe5da; }
.listen-toggle { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 8px; margin: 14px 0 0; }
.listen-toggle input { margin: 0; width: auto; }
.answer-box { background: #ede7d7; border-radius: 12px; margin-top: 20px; padding: 18px; }
.answer-label { color: var(--orange); font-size: 9px; font-weight: 800; letter-spacing: .14em; margin: 0 0 8px; text-transform: uppercase; }
[data-answer-text] { line-height: 1.6; white-space: pre-wrap; }
.replay-button { background: transparent; border: 0; border-bottom: 1px solid currentColor; color: var(--forest); cursor: pointer; font-size: 12px; font-weight: 800; margin-top: 14px; padding: 0 0 3px; }
.ask-privacy { color: var(--muted); font-size: 10px; margin: 16px 0 0; }

.law-section { align-items: end; background: var(--cream); display: grid; gap: 40px; grid-template-columns: 1fr auto; }
.law-section h2 { margin: 8px 0 18px; }
.law-section p:not(.eyebrow) { color: var(--muted); max-width: 680px; }
.law-actions { align-items: stretch; display: flex; flex-direction: column; gap: 14px; min-width: 220px; }
.text-link { border-bottom: 1px solid currentColor; font-size: 12px; font-weight: 800; padding-bottom: 3px; text-align: center; }
.site-footer { align-items: center; background: #101d17; color: #aebcb2; display: flex; font-size: 11px; gap: 20px; justify-content: space-between; min-height: 92px; padding: 24px clamp(20px, 8vw, 120px); }
.site-footer a { align-items: center; color: white; display: inline-flex; font-weight: 800; min-height: 44px; }

.settings-dialog { background: transparent; border: 0; max-height: 94vh; max-width: 560px; overflow-y: auto; overscroll-behavior: contain; padding: 0; width: calc(100% - 28px); }
.settings-dialog::backdrop { backdrop-filter: blur(8px); background: rgba(11,24,17,.68); }
.settings-form { background: var(--cream); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); color: var(--ink); padding: clamp(22px, 5vw, 34px); }
.settings-heading { align-items: start; display: flex; justify-content: space-between; }
.settings-heading h2 { font-family: Georgia, serif; font-size: 38px; font-weight: 500; letter-spacing: -.04em; margin: 6px 0 10px; }
.dialog-close { align-items: center; background: #ebe4d4; border: 0; border-radius: 50%; color: var(--ink); cursor: pointer; display: flex; font-size: 26px; height: 38px; justify-content: center; line-height: 1; width: 38px; }
.settings-explainer { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.settings-form label { display: block; font-size: 11px; font-weight: 800; margin: 0 0 7px; text-transform: uppercase; }
.settings-form label span { color: var(--muted); font-size: 9px; font-weight: 600; }
.settings-form input, .settings-form select { appearance: none; background: white; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); margin: 0 0 18px; min-height: 48px; padding: 0 13px; width: 100%; }
.settings-form input:focus, .settings-form select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(37,77,57,.12); outline: 0; }
.settings-status { background: #ede7d7; border-radius: 9px; color: var(--muted); font-size: 11px; margin: 2px 0 18px; padding: 11px 12px; }
.settings-actions { display: flex; gap: 8px; justify-content: flex-end; }
.settings-actions .button { cursor: pointer; }

@supports (padding: max(0px)) {
  .site-header { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .site-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

@supports (height: 100dvh) {
  .settings-dialog { max-height: calc(100dvh - 20px); }
}

@media (max-width: 980px) {
  .root-hero { grid-template-columns: minmax(0, 1fr) minmax(260px, .65fr); }
  .idea-grid, .battle-flow { grid-template-columns: repeat(2, 1fr); }
  .phase-grid { grid-template-columns: 1fr; }
  .phase-grid article { min-height: 230px; }
  .phase-name { margin-top: 38px; }
  .ask-layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  html { scroll-padding-top: 64px; }
  .header-note { display: none; }
  .page-index { -webkit-overflow-scrolling: touch; display: none; max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; position: fixed; left: 0; right: 0; top: 64px; }
  .page-index.open { display: block; }
  .index-inner { align-items: stretch; flex-direction: column; gap: 0; min-width: 0; padding: 12px 20px 18px; }
  .page-index a { border-bottom: 1px solid var(--line); font-size: 14px; padding: 13px 2px; }
  .game-grid, .faction-grid, .golden-grid, .law-section { grid-template-columns: 1fr; }
  .game-tile { min-height: 430px; }
  .root-hero { display: block; min-height: 720px; padding-bottom: 0; }
  .root-logo { margin-top: 20px; width: min(78vw, 360px); }
  .root-hero-art { margin: -18px auto 0; max-width: 410px; width: 88%; }
  .root-hero-art figcaption { bottom: 14px; margin: 0; position: absolute; right: 0; }
  .art-sun { height: 62%; right: -2%; top: 11%; width: 70%; }
  .idea-grid { grid-template-columns: 1fr; }
  .idea-card { min-height: 205px; }
  .idea-card h3 { margin-top: 44px; }
  .battle-flow { grid-template-columns: 1fr; }
  .battle-flow > div, .battle-flow > div:last-child { border: 0; border-top: 1px solid var(--line); min-height: 185px; padding-left: 0; }
  .battle-flow h3 { margin-top: 42px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .settings-dialog { margin-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .guide-section { padding-bottom: 70px; padding-top: 70px; }
  .hero-actions, .hero-actions .button { width: 100%; }
  .action-list article { grid-template-columns: 52px 1fr; }
  .action-icon { font-size: 22px; height: 44px; width: 44px; }
  .ask-actions { align-items: stretch; flex-direction: column; }
  .speak-button { width: 100%; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; }
  .settings-actions .button { width: 100%; }
  .faction-art { height: 135px; width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
