:root {
  color-scheme: light;
  --ui-scale: 1;
  --ink: #273128;
  --ink-soft: #626657;
  --green: #42513e;
  --green-deep: #26342b;
  --green-deeper: #18251d;
  --gold: #a27b41;
  --gold-light: #d2b779;
  --paper: #f5efdf;
  --paper-mid: #eee5ce;
  --paper-deep: #e5d8b7;
  --paper-line: rgba(105, 83, 48, .2);
  --shadow: 0 20px 60px rgba(7, 14, 9, .28);
  font-size: calc(16px * var(--ui-scale));
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(12px, 2vw, 30px);
  background:
    radial-gradient(ellipse at 5% 5%, rgba(157, 130, 79, .16), transparent 30%),
    radial-gradient(ellipse at 95% 95%, rgba(104, 127, 87, .16), transparent 35%),
    var(--green-deeper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

body[data-theme="night"] {
  color-scheme: dark;
  --ink: #e9e1cc;
  --ink-soft: #b1ae9b;
  --green: #899477;
  --green-deep: #202b23;
  --green-deeper: #121a15;
  --gold: #d1b06f;
  --gold-light: #dfc78f;
  --paper: #202a23;
  --paper-mid: #273229;
  --paper-deep: #334033;
  --paper-line: rgba(220, 199, 146, .18);
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #bc8e49; outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  padding: 10px 16px;
  background: var(--paper);
  color: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.app-frame {
  position: relative;
  width: min(1320px, 100%);
  min-height: min(900px, calc(100vh - 40px));
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(102, 81, 48, .075) .55px, transparent .7px);
  background-size: 5px 5px;
  box-shadow: var(--shadow);
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 90px;
  padding: 15px clamp(20px, 5vw, 70px);
  border-bottom: 1px solid var(--paper-line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
}

.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; white-space: nowrap; }
.brand-mark { display: block; width: 114px; height: 26px; object-fit: contain; }
.brand-divider { width: 1px; height: 24px; background: var(--paper-line); }
.brand-edition { color: var(--gold); font: 700 .61rem/1.2 Arial, sans-serif; letter-spacing: .2em; }

.primary-nav { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(12px, 2.7vw, 38px); }
.primary-nav a {
  position: relative;
  padding: 9px 0;
  color: var(--ink-soft);
  font: 700 .7rem/1.2 Arial, sans-serif;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .18s ease;
}
.primary-nav a::after { position: absolute; right: 0; bottom: 1px; left: 0; height: 1px; background: var(--gold); content: ""; transform: scaleX(0); transform-origin: left; transition: transform .18s ease; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--ink); }
.primary-nav a[aria-current="page"]::after, .primary-nav a:hover::after { transform: scaleX(1); }

main { min-height: 650px; }
.view { padding: clamp(26px, 5vw, 68px) clamp(20px, 5vw, 70px) 74px; animation: view-in .26s ease both; }
.view[hidden] { display: none; }
@keyframes view-in { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.welcome-panel {
  position: relative;
  display: grid;
  min-height: 390px;
  grid-template-columns: 1.12fr .88fr;
  overflow: hidden;
  background: var(--green-deep);
  color: #f4eddb;
  box-shadow: 0 16px 32px rgba(38, 45, 33, .18);
}
.welcome-panel::after { position: absolute; inset: 12px; z-index: 1; border: 1px solid rgba(228, 205, 149, .32); content: ""; pointer-events: none; }
.welcome-copy { position: relative; z-index: 2; align-self: center; padding: 54px clamp(26px, 5vw, 64px); }
.eyebrow { margin: 0 0 15px; color: var(--gold); font: 700 .64rem/1.3 Arial, sans-serif; letter-spacing: .2em; text-transform: uppercase; }
.welcome-copy .eyebrow { color: #d5bc7f; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-radius: 50%; background: #a9b58b; box-shadow: 0 0 0 4px rgba(169, 181, 139, .12); }
.title-plaque { position: relative; display: flex; min-height: 96px; align-items: center; margin: 8px 0 15px; }
.title-plaque > img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .96; }
.title-plaque-copy { position: relative; z-index: 1; padding: 8px 24px; color: #354131; }
.title-kicker { margin: 0 0 -2px; color: #715835; font: 700 .55rem/1.4 Arial, sans-serif; letter-spacing: .2em; text-transform: uppercase; }
.title-plaque :is(h1,h2) { margin: 0; font-size: clamp(1.75rem, 3.4vw, 2.6rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.12; }
.welcome-description { max-width: 430px; margin: 18px 0 22px; color: #e4dfcc; font-size: 1rem; }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 14px; padding: 10px 18px; border: 1px solid transparent; font: 700 .67rem/1.2 Arial, sans-serif; letter-spacing: .1em; text-decoration: none; text-transform: uppercase; transition: transform .18s ease, background .18s ease, border-color .18s ease; cursor: pointer; }
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .52; transform: none; cursor: not-allowed; }
.button-primary { background: #dbc58f; color: #26352a; }
.button-primary:hover { background: #ecd9a9; }
.button-primary span { font-size: 1rem; }
.button-quiet { color: #e5dbc0; }
.button-quiet:hover { color: white; }
.edition-note { display: flex; align-items: center; gap: 13px; margin-top: 24px; color: rgba(236, 229, 209, .72); }
.edition-note > span { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid rgba(221, 199, 145, .5); color: #dec58d; font: 700 .62rem Arial, sans-serif; }
.edition-note p { margin: 0; font-size: .78rem; line-height: 1.5; }
.edition-note strong { color: #e4d6b1; font-weight: 500; }

.welcome-scene { position: relative; align-self: stretch; min-height: 390px; overflow: hidden; background: #24352b; }
.welcome-scene::before { position: absolute; z-index: 1; inset: 0; background: linear-gradient(90deg, var(--green-deep) 0%, rgba(38, 52, 43, .28) 30%, rgba(19, 32, 24, .12) 100%), linear-gradient(0deg, rgba(20, 32, 24, .66), transparent 42%); content: ""; }
.welcome-scene > img { width: 100%; height: 100%; min-height: 390px; object-fit: cover; object-position: 57% 51%; opacity: .96; }
.scene-caption { position: absolute; z-index: 2; right: 34px; bottom: 35px; display: flex; align-items: center; gap: 11px; color: #f1e5c7; font: 700 .62rem/1.6 Arial, sans-serif; letter-spacing: .17em; }
.scene-caption small { color: #d8cba8; font: 400 .78rem Georgia, serif; letter-spacing: .02em; }
.caption-mark { color: #dec88f; font-size: 1.4rem; }
.welcome-stamp { position: absolute; z-index: 3; top: 27px; right: 27px; display: flex; width: 68px; height: 68px; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(241, 226, 191, .68); border-radius: 50%; color: #efe1bc; transform: rotate(11deg); }
.welcome-stamp span { font: 700 .42rem Arial, sans-serif; letter-spacing: .1em; }
.welcome-stamp strong { font-size: 1.2rem; font-weight: 400; line-height: 1; }

.home-lower { padding-top: 46px; }
.section-heading { display: flex; align-items: end; gap: 22px; margin-bottom: 17px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading h2 { margin: 0; font-size: 1.55rem; font-weight: 400; letter-spacing: -.02em; }
.heading-rule { flex: 1; height: 1px; margin-bottom: 8px; background: var(--paper-line); }
.desk-cards { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); }
.desk-card { position: relative; min-height: 205px; padding: 19px 24px 22px; text-decoration: none; transition: background .2s ease; }
.desk-card + .desk-card { border-left: 1px solid var(--paper-line); }
.desk-card:hover { background: color-mix(in srgb, var(--paper-mid) 62%, transparent); }
.card-index { color: var(--gold); font: 700 .57rem Arial, sans-serif; letter-spacing: .14em; }
.card-icon { float: right; color: var(--green); font-size: 1.2rem; }
.desk-card h3 { margin: 17px 0 4px; font-size: 1.2rem; font-weight: 400; }
.desk-card p { min-height: 43px; margin: 0 0 14px; color: var(--ink-soft); font-size: .83rem; }
.card-link { color: var(--green); font: 700 .61rem Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.card-link b { margin-left: 4px; font-size: .86rem; }

.page-intro { max-width: 760px; margin: 0 0 34px; }
.page-intro .back-link { display: inline-block; margin-bottom: 28px; color: var(--ink-soft); font: 700 .63rem Arial, sans-serif; letter-spacing: .12em; text-decoration: none; text-transform: uppercase; }
.page-intro .back-link:hover { color: var(--gold); }
.page-intro .eyebrow { margin-bottom: 8px; }
.page-intro :is(h1,h2) { margin: 0 0 11px; font-size: clamp(2rem, 4vw, 3.3rem); font-weight: 400; letter-spacing: -.04em; line-height: 1.12; }
.page-intro > p:last-child { max-width: 680px; margin: 0; color: var(--ink-soft); font-size: 1rem; }
.page-intro code, .asset-path { color: var(--green); font-size: .87em; }

.hub-content { display: grid; gap: 18px; }
.hub-status { min-height: 25px; margin: -19px 0 18px; color: var(--green); font: 700 .68rem/1.45 Arial, sans-serif; letter-spacing: .035em; }
.hub-status[data-kind="warning"] { color: #9a5139; }
body[data-theme="night"] .hub-status[data-kind="warning"] { color: #e3aa83; }
.hub-next-action { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 20px 22px; border: 1px solid var(--gold); background: color-mix(in srgb, var(--paper-mid) 72%, transparent); }
.hub-next-action > .eyebrow { width: 100%; margin: 0; }
.hub-next-action h2 { width: 100%; margin: -5px 0 0; font-size: 1.5rem; font-weight: 400; }
.hub-action-description { flex: 1 1 260px; margin: 0; color: var(--ink-soft); font-size: .84rem; }
.hub-next-action .button { flex: 0 0 auto; }
.hub-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hub-metric { display: grid; min-height: 105px; align-content: center; gap: 4px; padding: 14px 16px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 38%, transparent); }
.hub-metric-label { color: var(--gold); font: 700 .57rem Arial, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.hub-metric-value { color: var(--ink); font-size: 1.45rem; font-weight: 400; }
.hub-metric small { color: var(--ink-soft); font-size: .68rem; line-height: 1.4; }
.hub-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hub-column { display: grid; align-content: start; gap: 16px; }
.hub-panel { min-width: 0; padding: 19px 20px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper) 82%, white); }
body[data-theme="night"] .hub-panel { background: color-mix(in srgb, var(--paper) 84%, #344237); }
.hub-panel > .eyebrow { margin-bottom: 4px; }
.hub-panel > h2 { margin: 0 0 10px; font-size: 1.28rem; font-weight: 400; }
.hub-panel-note, .hub-effect-note { margin: 0 0 12px; color: var(--ink-soft); font-size: .75rem; }
.hub-effect-note { padding-left: 10px; border-left: 2px solid var(--gold); }
.hub-team + .hub-team { margin-top: 16px; }
.hub-team h3 { margin: 0 0 7px; color: var(--green); font-size: .95rem; font-weight: 500; }
.hub-list { display: grid; gap: 7px; }
.hub-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--paper-line); }
.hub-row-main { display: grid; min-width: 0; gap: 3px; }
.hub-row-main strong { color: var(--ink); font-size: .78rem; font-weight: 500; }
.hub-row-main small { color: var(--ink-soft); font-size: .68rem; line-height: 1.4; }
.hub-select { max-width: 145px; min-height: 36px; padding: 5px 8px; border: 1px solid var(--paper-line); background: var(--paper); color: var(--ink); font: .7rem Arial, sans-serif; }
.hub-button-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.hub-pillar-progress { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.hub-pillar-progress span, .hub-mastery-chip { padding: 5px 8px; border: 1px solid var(--paper-line); color: var(--ink-soft); font: 700 .54rem Arial, sans-serif; letter-spacing: .035em; }
.hub-mastery-chip { display: inline-block; margin: 0 5px 5px 0; }
.hub-button-row .button, .hub-panel > .button { min-height: 38px; padding: 8px 11px; font-size: .57rem; }
.hub-contract-status { flex: 0 0 auto; color: var(--gold); font: 700 .57rem Arial, sans-serif; letter-spacing: .09em; text-transform: uppercase; }
.hub-activity { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.hub-activity li { padding: 9px 0; border-top: 1px solid var(--paper-line); }
.hub-activity li > span { color: var(--gold); font: 700 .54rem Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.hub-activity li > p { margin: 2px 0 0; color: var(--ink-soft); font-size: .73rem; }

.run-placeholder { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(220px, .75fr); align-items: center; gap: clamp(24px, 7vw, 100px); max-width: 950px; margin: 0 auto; padding: 32px; background: color-mix(in srgb, var(--paper-mid) 45%, transparent); border: 1px solid var(--paper-line); }
.placeholder-board { position: relative; display: flex; min-height: 360px; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); background: rgba(35, 49, 39, .94); color: #e9ddbd; }
.board-grid { position: absolute; inset: 56px 14px 16px; border: 1px solid rgba(216, 194, 144, .19); background-image: linear-gradient(rgba(216, 194, 144, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(216, 194, 144, .12) 1px, transparent 1px); background-size: 34px 34px; }
.placeholder-board > img { position: relative; z-index: 1; width: 72px; height: 72px; margin-top: 36px; }
.placeholder-board > p { position: relative; z-index: 1; margin: 12px 0 0; color: #d7cba8; font-size: .86rem; }
.board-label { position: absolute; z-index: 1; top: 17px; right: 17px; left: 17px; display: flex; justify-content: space-between; color: #d9c591; font: 700 .53rem Arial, sans-serif; letter-spacing: .14em; }
.board-label span { color: rgba(231, 219, 190, .55); }
.run-note { max-width: 330px; }
.note-symbol { color: var(--gold); font-size: 1.5rem; }
.run-note .eyebrow { margin: 11px 0 7px; }
.run-note h2 { margin: 0 0 10px; font-size: 1.55rem; font-weight: 400; line-height: 1.15; }
.run-note > p:not(.eyebrow) { margin: 0 0 18px; color: var(--ink-soft); font-size: .92rem; }
.text-link { color: var(--green); font: 700 .64rem Arial, sans-serif; letter-spacing: .1em; text-decoration: none; text-transform: uppercase; }
.text-link:hover { color: var(--gold); }
.text-link span { margin-left: 5px; }

.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.asset-card { min-width: 0; overflow: hidden; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper) 88%, white); }
body[data-theme="night"] .asset-card { background: #273229; }
.asset-visual { display: grid; height: 210px; place-items: center; overflow: hidden; background: #e8ddc1; }
body[data-theme="night"] .asset-visual { background: #374337; }
.asset-preview-image { display: block; width: auto; max-width: 90%; height: auto; max-height: 88%; aspect-ratio: var(--asset-ratio); }
.asset-card-scene-background .asset-visual { background: #23362a; }
.asset-card-scene-background .asset-preview-image { width: 100%; max-width: 100%; height: 100%; max-height: 100%; }
.asset-card-character-portrait .asset-preview-image { width: 150px; height: 150px; }
.asset-card-character-fullBody .asset-preview-image { width: 124px; height: 202px; }
.asset-card-brand-wordmark .asset-preview-image { width: 78%; }
.asset-card-scene-titleFrame .asset-preview-image { width: 90%; }
.asset-card-tile-letter .asset-visual, .asset-card-ui-icon .asset-visual { background: #e9dfc6; }
body[data-theme="night"] .asset-card-tile-letter .asset-visual, body[data-theme="night"] .asset-card-ui-icon .asset-visual { background: #394536; }
.asset-card-tile-letter .asset-preview-image { width: 120px; }
.asset-card-ui-icon .asset-preview-image { width: 94px; }
.asset-details { padding: 14px 16px 15px; }
.asset-category { margin: 0 0 4px; color: var(--gold); font: 700 .55rem Arial, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.asset-details h2 { margin: 0 0 5px; font-size: 1.02rem; font-weight: 400; }
.asset-size { margin: 0 0 8px; color: var(--ink-soft); font: .68rem Arial, sans-serif; }
.asset-path { display: block; overflow: hidden; color: var(--ink-soft); font: .62rem/1.4 Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.manifest-note { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 13px 16px; border-left: 2px solid var(--gold); background: color-mix(in srgb, var(--paper-mid) 55%, transparent); }
.manifest-note > span { color: var(--gold); font-size: 1.25rem; }
.manifest-note p { margin: 0; color: var(--ink-soft); font-size: .82rem; }
.manifest-note strong { color: var(--ink); font-weight: 500; }

.settings-panel { max-width: 900px; border-top: 1px solid var(--paper-line); }
.setting-row { display: flex; min-height: 112px; align-items: center; justify-content: space-between; gap: 25px; padding: 24px 5px; border: 0; border-bottom: 1px solid var(--paper-line); }
.setting-choice { margin: 0; }
.setting-row > label, .setting-row > legend { display: flex; min-width: 260px; align-items: center; gap: 16px; padding: 0; }
.setting-row > legend { float: left; }
.setting-number { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid var(--paper-line); color: var(--gold); font: 700 .62rem Arial, sans-serif; }
.setting-row strong { display: block; margin-bottom: 2px; font-size: 1rem; font-weight: 400; }
.setting-row small { display: block; color: var(--ink-soft); font-size: .8rem; }
.choice-group { display: flex; gap: 8px; }
.choice-button { display: flex; min-height: 44px; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--paper-line); background: transparent; color: var(--ink-soft); font: 700 .63rem Arial, sans-serif; letter-spacing: .04em; cursor: pointer; }
.choice-button[aria-pressed="true"] { border-color: var(--gold); color: var(--ink); box-shadow: inset 0 -2px var(--gold); }
.swatch { width: 18px; height: 18px; border: 1px solid rgba(62, 54, 38, .24); border-radius: 50%; }
.swatch-parchment { background: #f5efdf; }
.swatch-night { background: #202a23; }
.scale-control { display: flex; width: min(340px, 45%); align-items: center; gap: 17px; }
.scale-control input { width: 100%; accent-color: var(--gold); cursor: pointer; }
.scale-control output { min-width: 50px; color: var(--green); font: 700 .72rem Arial, sans-serif; text-align: right; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 18px; }
.settings-footer p { margin: 0; color: var(--ink-soft); font-size: .77rem; }
.button-outline { min-height: 38px; padding: 8px 12px; border-color: var(--paper-line); background: transparent; color: var(--ink); font-size: .57rem; }
.button-outline:hover { border-color: var(--gold); }
.settings-footnote { max-width: 850px; margin: 20px 0 0; color: var(--ink-soft); font-size: .78rem; }

.about-panel { display: grid; max-width: 900px; grid-template-columns: 120px 1fr; align-items: center; gap: 30px; padding: clamp(25px, 4vw, 44px); border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 42%, transparent); }
.about-seal { position: relative; display: grid; width: 108px; height: 108px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--green); font-size: 3.2rem; }
.about-seal::before { position: absolute; inset: 7px; border: 1px dashed var(--paper-line); border-radius: 50%; content: ""; }
.about-seal span { position: absolute; right: 16px; bottom: 16px; color: var(--gold); font-size: 1rem; }
.about-panel .eyebrow { margin-bottom: 7px; }
.about-panel h2 { margin: 0 0 10px; font-size: 1.5rem; font-weight: 400; }
.about-panel p:not(.eyebrow) { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: .9rem; }
.about-meta { display: flex; flex-wrap: wrap; gap: 10px 30px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--paper-line); }
.about-meta span { color: var(--ink-soft); font-size: .72rem; }
.about-meta strong { display: block; color: var(--gold); font: 700 .54rem Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }

.site-footer { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px clamp(20px, 5vw, 70px); border-top: 1px solid var(--paper-line); color: var(--ink-soft); font: 700 .52rem Arial, sans-serif; letter-spacing: .16em; }
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a span { margin-left: 5px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; padding: 12px 17px; background: var(--green-deep); color: #f5efdf; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }

/* Stage 3: board loop, scoring records, and seeded replay */
.rule-glossary { max-width: 1120px; margin: 0 auto 20px; padding: 14px 18px; border: 1px solid var(--paper-line); background: var(--paper); }
.rule-glossary summary { cursor: pointer; color: var(--green); font-size: .88rem; }
.rule-glossary dl { margin: 18px 0 0; }
.rule-glossary dt { margin-top: 14px; color: var(--ink); font-size: .85rem; font-weight: 700; }
.rule-glossary dd { margin: 5px 0 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.55; }
.board-setup { display: grid; max-width: 1080px; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 20px; margin: 0 auto; }
.board-setup[hidden] { display: none; }
.setup-card, .controls-card, .dial-card, .up-next-card, .history-card { border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 45%, transparent); }
.setup-card { padding: clamp(20px, 3vw, 34px); }
.setup-card h2, .controls-card h2, .up-next-card h2, .history-card h2 { margin: 0; font-size: 1.28rem; font-weight: 400; letter-spacing: -.02em; }
.setup-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.setup-field { display: grid; gap: 7px; align-content: start; }
.setup-label { color: var(--ink); font-size: .85rem; }
.setup-field select { width: 100%; min-height: 43px; padding: 8px 10px; border: 1px solid var(--paper-line); border-radius: 0; background: var(--paper); color: var(--ink); }
.setup-field small, .hint-toggle small { display: block; color: var(--ink-soft); font-size: .72rem; line-height: 1.45; }
.hint-settings { display: grid; gap: 14px; margin: 23px 0 0; padding: 17px 0 0; border: 0; border-top: 1px solid var(--paper-line); }
.hint-settings legend { padding: 0 9px 0 0; color: var(--gold); font: 700 .61rem Arial, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.hint-toggle { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.hint-toggle input { width: 18px; height: 18px; flex: 0 0 18px; margin: 2px 0 0; accent-color: var(--green); }
.hint-toggle strong { display: block; margin-bottom: 2px; font-size: .85rem; font-weight: 500; }
.hint-penalty-field { max-width: 340px; }
.setup-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--paper-line); }
.score-goal-preview { margin: 0; color: var(--green); font-size: .92rem; }
.controls-card { padding: 25px; }
.controls-card .eyebrow { margin-bottom: 8px; }
.key-guide { display: grid; gap: 11px; margin: 18px 0; padding: 0; list-style: none; }
.key-guide li { display: flex; min-height: 28px; align-items: center; gap: 5px; color: var(--ink-soft); font-size: .78rem; }
.key-guide li span { margin-left: 8px; }
kbd { display: inline-flex; min-width: 25px; min-height: 25px; align-items: center; justify-content: center; padding: 2px 6px; border: 1px solid var(--paper-line); border-bottom-width: 2px; background: color-mix(in srgb, var(--paper) 85%, white); color: var(--ink); font: 700 .64rem Arial, sans-serif; }
.rules-note, .lexicon-note { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid var(--paper-line); color: var(--ink-soft); font-size: .77rem; line-height: 1.55; }
.lexicon-note { color: var(--ink-soft); font-size: .68rem; }
.board-shell { position: relative; max-width: 1120px; margin: 0 auto; }
.board-shell[hidden] { display: none; }
.board-toolbar { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.board-toolbar .eyebrow { margin: 0; color: var(--ink-soft); letter-spacing: .12em; }
.board-actions { display: flex; align-items: center; gap: 8px; }
.board-action { min-height: 38px; color: var(--green); }
.board-action[hidden] { display: none; }
.board-actions .button-outline { min-height: 38px; }
.board-actions kbd { min-width: 20px; min-height: 20px; margin-left: 2px; padding: 1px 4px; font-size: .54rem; }
.run-context { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(150px, .72fr); gap: 10px; margin-bottom: 12px; }
.context-card { min-width: 0; padding: 13px 15px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 45%, transparent); }
.context-card .eyebrow { margin: 0 0 6px; color: var(--gold); }
.context-main { margin: 0; color: var(--ink); font-size: .82rem; line-height: 1.45; }
.context-detail { margin: 6px 0 0; color: var(--ink-soft); font-size: .68rem; line-height: 1.4; }
.run-totals > p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: .73rem; }
.run-totals strong { color: var(--green); font-size: 1.05rem; font-weight: 500; }
.wanted-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.wanted-list[hidden] { display: none; }
.wanted-list li { padding: 4px 7px; border: 1px solid var(--paper-line); color: var(--ink-soft); font: 700 .58rem Arial, sans-serif; letter-spacing: .1em; }
.wanted-list li.is-found { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--paper)); color: var(--green); text-decoration: line-through; }
.board-layout { display: grid; grid-template-columns: minmax(300px, 1.3fr) minmax(235px, .7fr); align-items: start; gap: 18px; }
.board-main-column { min-width: 0; padding: 16px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 45%, transparent); }
.board-scorebar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.board-scorebar > div { display: flex; align-items: baseline; gap: 8px; }
.score-label { color: var(--ink-soft); font: 700 .57rem Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.board-scorebar strong { color: var(--green); font-size: 1.7rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.score-separator { color: var(--ink-soft); }
#game-goal { color: var(--ink-soft); font-size: .85rem; font-variant-numeric: tabular-nums; }
.board-finish { min-height: 38px; padding: 9px 12px; font-size: .55rem; }
.board-finish:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.fall-status { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--ink-soft); font: 700 .54rem Arial, sans-serif; letter-spacing: .09em; text-transform: uppercase; }
.grace-track { position: relative; height: 4px; flex: 1; overflow: hidden; background: color-mix(in srgb, var(--green) 15%, transparent); }
.grace-track span { display: block; width: 0; height: 100%; background: var(--gold); transition: width .12s linear; }
.placement-count { white-space: nowrap; }
.placement-count strong { color: var(--ink); font-size: .7rem; }
.board-stage { overflow: auto; padding: 12px; border: 1px solid rgba(216, 194, 144, .28); background: #203128; }
.game-board { --cell-size: clamp(18px, 2.7vw, 31px); display: flex; width: max-content; flex-direction: column; gap: 2px; margin: 0 auto; }
.board-row { display: grid; grid-template-columns: repeat(12, var(--cell-size)); grid-auto-rows: var(--cell-size); gap: 2px; }
.board-cell { position: relative; display: grid; min-width: 0; place-items: center; border: 1px solid rgba(223, 214, 186, .12); background: rgba(245, 239, 223, .035); color: #26342a; font: 700 clamp(.55rem, 1.3vw, .8rem)/1 Arial, sans-serif; user-select: none; }
.board-cell::after, .up-next-letter-tile::after { position: absolute; z-index: 3; top: 0; right: 0; display: none; width: 8px; height: 8px; border: 1px solid #263329; box-sizing: border-box; clip-path: polygon(0 0, 100% 0, 100% 100%); content: ""; pointer-events: none; filter: drop-shadow(-1px 1px 0 #263329); }
.board-cell[data-point-band="2"]::after, .up-next-letter-tile[data-point-band="2"]::after { display: block; background: #cc8c48; }
.board-cell[data-point-band="3"]::after, .up-next-letter-tile[data-point-band="3"]::after { display: block; background: #568a58; }
.board-cell[data-point-band="4"]::after, .up-next-letter-tile[data-point-band="4"]::after { display: block; background: #5680b3; }
.board-cell[data-point-band="5"]::after, .up-next-letter-tile[data-point-band="5"]::after { display: block; background: #9861b4; }
.board-cell[data-point-band="high"]::after, .up-next-letter-tile[data-point-band="high"]::after { display: block; background: linear-gradient(135deg, #fff9cc 0%, #f0c333 23%, #fff2a2 42%, #a97608 63%, #fff5bb 79%, #d6a51c 100%); box-shadow: 0 0 4px rgba(255, 220, 96, .9); }
.board-cell.seed-letter { border-color: rgba(215, 193, 146, .28); background: #c9b785; color: #354034; box-shadow: inset 0 1px rgba(255,255,255,.35); }
.board-cell.wanted-scaffold { outline: 2px dashed #89b3a1; outline-offset: -3px; }
.board-cell.placed-letter { border-color: rgba(238, 220, 165, .48); background: #728064; color: #fff5dc; }
.board-cell[data-heat="1"], .board-cell[data-heat="2"], .board-cell[data-heat="3"], .board-cell[data-heat="4"], .board-cell[data-heat="5"], .board-cell[data-heat="6"] { box-shadow: inset 0 -2px #dba95c; }
.board-cell[data-heat="3"], .board-cell[data-heat="4"], .board-cell[data-heat="5"], .board-cell[data-heat="6"] { box-shadow: inset 0 -3px #df864f; }
.board-cell[data-heat="5"], .board-cell[data-heat="6"] { box-shadow: inset 0 -4px #d76249; }
.board-cell.active { z-index: 1; border-color: #f0dc9c; background: #e3cb8a; color: #24342a; box-shadow: 0 0 0 2px rgba(227, 203, 138, .28), 0 2px 8px rgba(0,0,0,.25); }
.board-cell.hint-landing { outline: 2px solid #9ac6bc; outline-offset: -2px; box-shadow: inset 0 0 0 1px rgba(154,198,188,.3); }
.board-cell.scored-last-round { z-index: 2; box-shadow: 0 0 0 3px rgba(250, 225, 154, .8), 0 0 16px 6px rgba(246, 209, 111, .75); animation: score-tile-glow 1.5s ease-out both; }
@keyframes score-tile-glow {
  0%, 24% { box-shadow: 0 0 0 3px rgba(255, 240, 183, .95), 0 0 18px 8px rgba(255, 219, 119, .9); }
  100% { box-shadow: 0 0 0 0 rgba(255, 240, 183, 0), 0 0 0 0 rgba(255, 219, 119, 0); }
}
.game-board:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
.board-play-area { display: grid; grid-template-columns: minmax(0, 1fr) minmax(142px, .34fr); align-items: start; gap: 12px; }
.board-play-area .board-stage, .board-play-area .up-next-card { min-width: 0; }
.timer-track { height: 5px; overflow: hidden; margin-top: 10px; background: color-mix(in srgb, var(--green) 16%, transparent); }
.timer-track span { display: block; width: 100%; height: 100%; background: var(--gold); transition: width .15s linear, background .2s ease; }
.game-sidebar { display: grid; gap: 12px; }
.dial-card, .up-next-card, .history-card { padding: 17px; }
.dial-card { display: grid; justify-items: center; text-align: center; }
.dial-card .eyebrow { justify-self: start; }
.day-dial { --dial-color: #d0ad62; position: relative; display: grid; width: 116px; aspect-ratio: 1; place-content: center; justify-items: center; border-radius: 50%; background: conic-gradient(var(--dial-color) var(--dial-angle), color-mix(in srgb, var(--green) 18%, transparent) 0); transition: background .2s ease; }
.day-dial.is-night { --dial-color: #899395; }
.day-dial::before { position: absolute; inset: 8px; border: 1px solid var(--paper-line); border-radius: 50%; background: var(--paper); content: ""; }
.day-dial::after { position: absolute; top: 1px; left: calc(50% - 5px); width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; background: var(--dial-color); content: ""; transform: rotate(var(--dial-angle)) translateY(0); transform-origin: 5px 57px; }
.dial-remaining, .dial-phase { position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.dial-remaining { margin-top: 5px; color: var(--ink); font-size: 1.4rem; }
.dial-phase { color: var(--gold); font: 700 .52rem Arial, sans-serif; letter-spacing: .17em; }
.day-dial.is-night .dial-phase { color: #66757a; }
.dial-caption { margin: 10px 0 0; color: var(--ink-soft); font-size: .7rem; }
.up-next-card .eyebrow, .history-card .eyebrow, .overlay-history .eyebrow { margin-bottom: 4px; }
.up-next-list, .history-list { display: grid; margin: 12px 0 0; padding: 0; list-style: none; }
.up-next-list { gap: 10px; }
.history-list { gap: 7px; }
.up-next-item { display: grid; min-height: 66px; align-content: center; gap: 8px; padding: 9px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper) 85%, transparent); }
.up-next-item.is-conditional { grid-template-columns: minmax(0, 1fr); }
.up-next-index { color: var(--gold); font: 700 .55rem Arial, sans-serif; letter-spacing: .1em; }
.up-next-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.up-next-letter-tile { position: relative; display: grid; width: 27px; height: 31px; place-items: center; border: 1px solid rgba(56, 75, 57, .2); background: #d9cfad; color: var(--green); font: 700 .82rem/1 Arial, sans-serif; box-shadow: inset 0 1px rgba(255,255,255,.55); }
.up-next-item:first-child { min-height: 76px; border-color: color-mix(in srgb, var(--gold) 60%, var(--paper-line)); background: color-mix(in srgb, var(--gold) 11%, var(--paper)); }
.up-next-item:first-child .up-next-letter-tile { width: 31px; height: 36px; font-size: .92rem; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-count { display: grid; min-width: 27px; height: 27px; place-items: center; border: 1px solid var(--paper-line); color: var(--gold); font: 700 .62rem Arial, sans-serif; }
.history-list { max-height: 310px; overflow: auto; padding-right: 3px; }
.history-entry { border-bottom: 1px solid var(--paper-line); }
.history-entry summary { display: flex; min-height: 35px; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style-position: inside; }
.history-word { color: var(--ink); font: 700 .7rem Arial, sans-serif; letter-spacing: .1em; }
.history-points { color: var(--green); font: 700 .66rem Arial, sans-serif; }
.history-formula, .history-context { margin: 0; padding: 3px 2px 6px; color: var(--ink-soft); font-size: .68rem; line-height: 1.45; }
.history-context { padding-bottom: 9px; font-size: .62rem; }
.history-definition { display: inline-block; margin: 0 2px 9px; color: var(--green); font-size: .63rem; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.history-footnote { margin: 8px 0 0; color: var(--ink-soft); font-size: .59rem; }
.history-empty { padding: 8px 1px; color: var(--ink-soft); font-size: .73rem; }
.run-records-section { margin-top: 46px; }
.run-record-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.run-record-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 38%, transparent); }
.run-record-summary { display: grid; gap: 4px; min-width: 0; }
.run-record-summary strong { color: var(--ink); font-size: .78rem; font-weight: 500; }
.run-record-summary span { color: var(--ink-soft); font-size: .68rem; }
.run-record-item .button { flex: 0 0 auto; }
.run-timeline { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--paper-line); }
.run-timeline h3 { margin: 0; font-size: 1.1rem; font-weight: 400; }
.run-timeline-list { display: grid; gap: 7px; max-height: 180px; overflow: auto; margin: 8px 0 0; padding: 0; list-style: none; }
.run-timeline-item { display: grid; gap: 3px; padding: 8px 10px; border-left: 2px solid var(--gold); background: color-mix(in srgb, var(--paper-mid) 44%, transparent); }
.run-timeline-item strong { color: var(--ink); font-size: .68rem; font-weight: 600; }
.run-timeline-item span { color: var(--ink-soft); font-size: .61rem; }
.run-turn-details { margin-top: 5px; color: var(--green); font-size: .61rem; }
.run-turn-details summary { cursor: pointer; }
.run-turn-list { display: grid; gap: 4px; max-height: 110px; overflow: auto; margin: 6px 0 0; padding-left: 21px; color: var(--ink-soft); }
.run-turn-list li { padding-right: 5px; line-height: 1.4; }
.keyboard-note { margin: 12px 0 0; color: var(--ink-soft); font: 700 .53rem Arial, sans-serif; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.game-overlay { position: fixed; z-index: 30; inset: 0; display: grid; overflow: auto; place-items: center; padding: 20px; background: rgba(9, 16, 12, .72); }
.game-overlay[hidden] { display: none; }
.game-dialog { width: min(660px, 100%); max-height: min(88vh, 920px); overflow: auto; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--gold); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.game-dialog:focus { outline: 3px solid var(--gold); outline-offset: 4px; }
.game-dialog > .eyebrow { margin-bottom: 7px; }
.game-dialog h2 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 400; letter-spacing: -.04em; }
.overlay-summary { margin: 0 0 18px; color: var(--ink-soft); font-size: .86rem; }
.overlay-history { padding-top: 15px; border-top: 1px solid var(--paper-line); }
.overlay-history h3 { margin: 0; font-size: 1.1rem; font-weight: 400; }
.overlay-history .history-list { max-height: 36vh; margin-top: 8px; }
.overlay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--paper-line); }
.overlay-actions[hidden] { display: none; }
.overlay-actions .button-quiet { color: var(--green); }
.screen-reader-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 900px) {
  .welcome-panel { grid-template-columns: 1.15fr .85fr; }
  .welcome-copy { padding-right: 24px; padding-left: 32px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-placeholder { gap: 25px; padding: 22px; }
  .board-setup { grid-template-columns: 1fr; }
  .board-layout { grid-template-columns: 1fr; }
  .board-play-area { grid-template-columns: minmax(0, 1fr) minmax(176px, .4fr); }
  .game-sidebar { grid-template-columns: minmax(180px, .4fr) minmax(0, 1fr); }
  .run-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-totals { grid-column: 1 / -1; }
  .hub-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  body { padding: 0; }
  .app-frame { min-height: 100vh; }
  .site-header { min-height: auto; align-items: flex-start; flex-direction: column; gap: 12px; padding: 17px 20px 12px; }
  .primary-nav { width: 100%; justify-content: space-between; gap: 8px; }
  .primary-nav a { font-size: .57rem; letter-spacing: .08em; }
  main { min-height: 600px; }
  .view { padding: 24px 20px 48px; }
  .welcome-panel { grid-template-columns: 1fr; }
  .welcome-copy { padding: 36px 25px 28px; }
  .welcome-scene { min-height: 230px; }
  .welcome-scene > img { min-height: 230px; max-height: 230px; object-position: 55% 52%; }
  .welcome-scene::before { background: linear-gradient(0deg, rgba(20, 32, 24, .6), transparent 72%); }
  .welcome-stamp { top: auto; right: 26px; bottom: 190px; width: 57px; height: 57px; }
  .welcome-stamp span { font-size: .36rem; }
  .welcome-stamp strong { font-size: 1rem; }
  .scene-caption { right: 27px; bottom: 25px; }
  .home-lower { padding-top: 32px; }
  .desk-cards { grid-template-columns: 1fr; }
  .desk-card { min-height: 0; padding: 16px 14px; }
  .desk-card + .desk-card { border-top: 1px solid var(--paper-line); border-left: 0; }
  .desk-card h3 { margin-top: 9px; }
  .desk-card p { min-height: 0; margin-bottom: 8px; }
  .run-placeholder { grid-template-columns: 1fr; padding: 15px; }
  .placeholder-board { min-height: 310px; }
  .run-note { padding: 5px 7px 10px; }
  .asset-grid { grid-template-columns: 1fr; }
  .asset-visual { height: 190px; }
  .setting-row { align-items: flex-start; flex-direction: column; gap: 16px; }
  .setting-row > label, .setting-row > legend { min-width: 0; }
  .choice-group { width: 100%; }
  .choice-button { flex: 1; justify-content: center; }
  .scale-control { width: 100%; padding-left: 50px; }
  .settings-footer { align-items: flex-start; flex-direction: column; }
  .about-panel { grid-template-columns: 1fr; justify-items: start; gap: 20px; }
  .about-seal { width: 82px; height: 82px; font-size: 2.5rem; }
  .site-footer { flex-wrap: wrap; font-size: .46rem; }
  .footer-center { display: none; }
  .board-setup { gap: 12px; }
  .setup-fields { grid-template-columns: 1fr; }
  .setup-footer { align-items: flex-start; flex-direction: column; }
  .setup-footer .button { width: 100%; }
  .board-toolbar { align-items: flex-start; flex-direction: column; }
  .board-actions { width: 100%; justify-content: flex-end; }
  .run-context { grid-template-columns: 1fr; }
  .run-totals { grid-column: auto; }
  .board-layout { grid-template-columns: 1fr; }
  .board-main-column { padding: 11px; }
  .board-scorebar { align-items: flex-start; flex-direction: column; }
  .board-scorebar > div { align-self: flex-start; }
  .board-finish { align-self: stretch; }
  .game-board { --cell-size: clamp(18px, 6vw, 26px); }
  .board-play-area { grid-template-columns: 1fr; }
  .up-next-item { grid-template-columns: 32px minmax(0, 1fr); align-items: center; min-height: 60px; }
  .up-next-item:first-child { min-height: 68px; }
  .game-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-card { grid-column: 1 / -1; }
  .game-dialog { max-height: 92vh; }
  .run-record-item { align-items: flex-start; flex-direction: column; }
  .run-record-item .button { align-self: flex-start; }
  .hub-columns { grid-template-columns: 1fr; }
  .hub-next-action { align-items: stretch; flex-direction: column; }
  .hub-next-action .button { width: 100%; }
  .hub-metric { min-height: 96px; padding: 12px; }
  .hub-panel { padding: 16px; }
  .hub-row { align-items: flex-start; flex-direction: column; }
  .hub-select { max-width: none; width: 100%; }
}

@media (max-width: 420px) {
  .game-sidebar { grid-template-columns: 1fr; }
  .history-card { grid-column: auto; }
  .board-actions { justify-content: space-between; }
  .board-actions .button { padding-right: 10px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .board-cell.scored-last-round { animation: none !important; }
}

.stage5-hub-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.character-panel { align-content: start; }
.character-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.character-stat { display: grid; gap: 3px; padding: 9px; border: 1px solid var(--paper-line); text-align: center; }
.character-stat span { color: var(--ink-soft); font: 700 .53rem Arial, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.character-stat strong { color: var(--green); font-size: 1.2rem; font-weight: 500; }
.character-trait-list { display: flex; flex-wrap: wrap; gap: 6px; margin: -5px 0 12px; }
.character-trait { padding: 4px 8px; border: 1px solid var(--gold); color: var(--ink-soft); font: 700 .55rem Arial, sans-serif; }
.character-relations { display: grid; gap: 0; }
.character-relation-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--paper-line); font-size: .76rem; }
.character-relation-row span { color: var(--gold); font: 700 .58rem Arial, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.stage5-event-list { display: grid; }
.stage5-event-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--paper-line); }
.stage5-event-row .hub-row-main { flex: 1 1 auto; }
.stage5-event-row .button { flex: 0 0 auto; }
.event-lock-reason { color: var(--gold) !important; }

.setup-content { max-width: 1050px; margin: 0 auto 26px; }
.character-setup-form, .setup-complete-card { display: grid; gap: 20px; padding: clamp(18px, 3vw, 32px); border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper) 86%, white); }
body[data-theme="night"] .character-setup-form, body[data-theme="night"] .setup-complete-card { background: color-mix(in srgb, var(--paper) 88%, #344237); }
.character-setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.character-field { display: grid; gap: 6px; color: var(--ink-soft); font: 700 .64rem Arial, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.character-field input, .character-field select { min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--paper-line); background: var(--paper); color: var(--ink); font: .88rem Georgia, serif; letter-spacing: normal; text-transform: none; }
.character-field small { color: var(--ink-soft); font: .68rem/1.4 Georgia, serif; letter-spacing: normal; text-transform: none; }
.starting-set-fieldset, .appearance-swatches { min-width: 0; margin: 0; padding: 0; border: 0; }
.starting-set-fieldset > legend, .appearance-swatches > legend { margin-bottom: 7px; color: var(--ink); font-size: 1.15rem; }
.setup-note { margin: 0 0 12px; color: var(--ink-soft); font-size: .78rem; }
.starting-set-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.starting-set-card { display: grid; align-content: start; gap: 6px; min-height: 150px; padding: 11px; border: 1px solid var(--paper-line); background: color-mix(in srgb, var(--paper-mid) 38%, transparent); color: var(--ink); text-align: left; cursor: pointer; }
.starting-set-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: color-mix(in srgb, var(--gold-light) 13%, var(--paper)); }
.starting-set-card strong { color: var(--green); font-size: .9rem; font-weight: 500; }
.starting-set-motto { min-height: 2.6em; color: var(--ink-soft); font-size: .68rem; line-height: 1.3; }
.starting-set-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 6px; color: var(--ink-soft); font: .56rem Arial, sans-serif; }
.starting-set-trait { color: var(--gold); font: 700 .57rem Arial, sans-serif; }
.appearance-swatches { display: flex; align-items: center; gap: 9px; }
.appearance-swatches > legend { float: left; margin: 0 10px 0 0; }
.appearance-swatch { width: 32px; height: 32px; border: 3px solid var(--paper); border-radius: 50%; background: var(--appearance-color); box-shadow: 0 0 0 1px var(--paper-line); cursor: pointer; }
.appearance-swatch[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 2px; }
.setup-error { min-height: 1.2em; margin: 0; color: #9a5139; font-size: .78rem; }
.setup-complete-card { max-width: 720px; margin: auto; }
.setup-complete-card h2 { margin: 0; font-size: 1.8rem; font-weight: 400; }

.scene-content { max-width: 1000px; margin: 0 auto 28px; }
.scene-card { overflow: hidden; border: 1px solid var(--paper-line); background: var(--paper); box-shadow: 0 12px 32px rgba(20, 30, 20, .12); }
.scene-visual { position: relative; min-height: 280px; height: clamp(280px, 43vw, 470px); overflow: hidden; background: var(--green-deep); }
.scene-visual::after { position: absolute; inset: 35% 0 0; background: linear-gradient(0deg, rgba(15, 24, 18, .55), transparent); content: ""; pointer-events: none; }
.scene-background { width: 100%; height: 100%; object-fit: cover; }
.scene-portrait-frame { position: absolute; z-index: 1; right: clamp(18px, 5vw, 48px); bottom: -10px; width: clamp(130px, 21vw, 205px); height: clamp(170px, 28vw, 265px); overflow: hidden; border: 1px solid rgba(255,255,255,.7); background: color-mix(in srgb, var(--paper) 60%, transparent); box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.scene-portrait { width: 100%; height: 100%; object-fit: cover; }
.scene-art-label { position: absolute; z-index: 2; left: 15px; bottom: 13px; color: #fff; font: 700 .52rem Arial, sans-serif; letter-spacing: .16em; }
.scene-copy { display: grid; gap: 12px; padding: clamp(18px, 4vw, 36px); }
.scene-copy > .eyebrow { margin: 0; color: var(--gold); }
.scene-copy h2 { margin: -12px 0 0; font-size: clamp(1.45rem, 3vw, 2.15rem); font-weight: 400; }
.scene-speaker { margin: 4px 0 -8px; color: var(--green); font: 700 .64rem Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.scene-dialogue-text { min-height: 4em; margin: 0; color: var(--ink); font-size: clamp(1rem, 1.7vw, 1.24rem); line-height: 1.7; white-space: pre-line; }
.scene-outcome { min-height: 1em; margin: 0; color: var(--gold); font-size: .78rem; }
.scene-choice-list { display: grid; gap: 8px; padding-top: 5px; }
.scene-choice { width: 100%; min-height: 48px; justify-content: flex-start; text-align: left; }
.scene-confirmation { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--gold); background: color-mix(in srgb, var(--gold-light) 12%, var(--paper)); }
.scene-confirmation p { flex: 1 1 100%; margin: 0; font-size: .8rem; }
.scene-toolbar { display: grid; gap: 12px; margin-top: 5px; padding-top: 14px; border-top: 1px solid var(--paper-line); }
.scene-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scene-toolbar-actions .button { min-height: 40px; }
.scene-controls { margin-left: auto; color: var(--ink-soft); }
.scene-controls summary { cursor: pointer; font: 700 .62rem Arial, sans-serif; letter-spacing: .07em; text-transform: uppercase; }
.scene-control-grid { display: flex; flex-wrap: wrap; gap: 15px; padding: 12px 0 2px; }
.scene-setting-control { display: flex; align-items: center; gap: 8px; font: .7rem Arial, sans-serif; }
.scene-setting-control input[type="range"] { width: 100px; accent-color: var(--green); }
.scene-setting-control output { min-width: 44px; }
.scene-history-panel { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--paper-line); }
.scene-history-panel h3 { margin: 0 0 4px; font-size: .95rem; font-weight: 400; }
.scene-history-entry { padding: 8px 10px; border: 1px solid var(--paper-line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.scene-history-entry:hover { border-color: var(--gold); }
.scene-card-replay .scene-copy { gap: 8px; }
.scene-card-replay .scene-dialogue-text { min-height: auto; font-size: 1rem; }
.scene-replay-choice { margin: 5px 0 0; color: var(--green); font-size: .8rem; }
.scene-replay-count { padding: 0 5px; color: var(--ink-soft); font: 700 .6rem Arial, sans-serif; }
.scene-pref-range { display: flex; align-items: center; gap: 12px; min-width: min(320px, 100%); }
.scene-pref-range input { flex: 1; accent-color: var(--green); }
.scene-pref-range output { min-width: 45px; color: var(--ink-soft); font: .7rem Arial, sans-serif; }
.scene-pref-toggle { display: flex; align-items: center; gap: 9px; font-size: .78rem; }
.scene-pref-toggle input { accent-color: var(--green); }

@media (max-width: 900px) {
  .starting-set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage5-hub-content { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .character-setup-grid { grid-template-columns: 1fr; }
  .starting-set-grid { grid-template-columns: 1fr 1fr; }
  .starting-set-card { min-height: 138px; padding: 9px; }
  .character-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene-toolbar-actions { align-items: stretch; flex-direction: column; }
  .scene-toolbar-actions .button { width: 100%; }
  .scene-controls { margin: 0; }
  .scene-control-grid { align-items: flex-start; flex-direction: column; }
  .stage5-event-row { align-items: flex-start; flex-direction: column; }
}

/* Stage 6: local library and read-only event playback. */
.save-status { padding: 1rem; border: 1px solid currentColor; border-radius: .6rem; margin: 1rem 0; background: var(--surface, #eee5ce); color: var(--ink, #24372a); overflow-wrap: anywhere; }
.save-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 1.2rem; margin: 1.5rem 0; }
.save-card { border: 1px solid currentColor; border-radius: .8rem; padding: 1.4rem; margin: 1rem 0; overflow-wrap: anywhere; }
.save-card h2 { margin: 0 0 .6rem; }
.save-card label { display: grid; gap: .4rem; margin: 1rem 0; }
.save-card input, .save-card select { min-width: 0; max-width: 100%; font: inherit; padding: .65rem; border: 1px solid currentColor; border-radius: .35rem; }
.save-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1rem 0; }
.save-revision { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid currentColor; }
.save-card summary { cursor: pointer; padding: .6rem 0; }
.event-replay-dialog { max-width: min(760px, 92vw); max-height: 85vh; overflow-y: auto; padding: 1.5rem; border-radius: .8rem; background: #f3ebd6; color: #17221b; }
.event-replay-dialog::backdrop { background: #14231cd9; }
body[aria-busy="true"] button { cursor: progress; }
[hidden] { display: none !important; }
[hidden] { display: none !important; }
.stage7-hub { display: grid; gap: 1rem; margin-block: 1.5rem; }
.s7-commissions { scroll-margin-top: 2rem; }
.s7-offer-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(235px,1fr)); gap: 1rem; }
.s7-offer-grid article { display: flex; flex-direction: column; gap: .7rem; }
.s7-offer-grid button { margin-top: auto; }
.s7-panel > summary { cursor: pointer; font-weight: 700; font-size: 1.2rem; padding-block: .5rem; }
.s7-row { padding-block: .75rem; border-bottom: 1px solid currentColor; border-color: color-mix(in srgb,currentColor 20%,transparent); }
.s7-row small { display: block; margin-block: .4rem; }
.s7-row button { margin: .3rem .4rem .3rem 0; }
.s7-board-context { grid-column: 1 / -1; }
.s7-board-context progress { display: inline-block; width: 9rem; margin-inline: .7rem; accent-color: #708a6b; }
.s7-board-context p { margin-block: .45rem; }
.s7-offer { padding: 1rem; border: 2px solid #b68b48; }
.s7-offer strong { display: block; margin-bottom: .7rem; }
.s7-offer button { margin-right: .6rem; }
#stage7-ability-dialog { max-width: min(540px,90vw); padding: 1rem; border: 1px solid #837755; border-radius: .5rem; background: #eee6d3; color: #26342a; }
#stage7-ability-dialog::backdrop { background: #17221b99; }
.s7-control-key input { width: 3rem; text-align: center; text-transform: uppercase; }
.board-cell { opacity: var(--fade,1); }
.board-cell.s7-locked { box-shadow: inset 0 0 0 3px #716b69; background-image: repeating-linear-gradient(135deg,transparent,transparent 8px,#7772 9px,#7772 10px); }
.board-cell[data-ruin]:not([data-ruin=""])::before { content: attr(data-ruin); position: absolute; top: 1px; left: 3px; font-size: .55rem; font-weight: 700; }
.board-cell.s7-seal { outline: 2px solid #ba8c3e; outline-offset: -3px; }
.board-cell.s7-rune { border-color: #8067a8; box-shadow: inset 0 0 0 2px #8067a8; }
.board-cell.s7-corrupt { background-color: #825583; }
.board-cell.s7-glow { outline: 3px solid #e3c76f; outline-offset: -3px; box-shadow: 0 0 12px #ffe3a0; }
.board-cell.s7-outline { border: 2px dashed #628f64; }
.board-cell.s7-heresy { text-decoration: underline wavy #a24c49; }
.board-cell.s7-quantum { position: relative; background-color: #d7d0de; color: #293c32; border: 1px dashed #8c7b98; }
.quantum-first { animation: quantum-first 2.4s ease-in-out infinite alternate; }
.quantum-second { position: absolute; inset: 0; display: grid; place-items: center; animation: quantum-second 2.4s ease-in-out infinite alternate; }
@keyframes quantum-first { from { opacity: 1; } to { opacity: .08; } }
@keyframes quantum-second { from { opacity: .08; } to { opacity: 1; } }

/* Stage 8: core PC usability, nonblocking notices, sharing and board-owned labels. */
.s8-controls { display:flex; flex-wrap:wrap; gap:14px; align-items:center; }
.s8-controls label { display:grid; gap:5px; text-transform:capitalize; font-size:.85rem; }
.s8-setting { display:flex; align-items:center; gap:12px; }
.s8-setting small { display:block; margin-top:5px; color:var(--ink-soft); }
.s8-setting input { width:20px; height:20px; flex:none; }
.s8-notice { margin:12px 0; padding:16px; border:1px solid var(--gold); background:var(--paper-mid); }
.s8-notice p { margin-top:0; }
.s8-notice button { min-width:76px; margin:0 8px 8px 0; }
.s8-notice a { display:inline-block; margin:8px; }
.s8-share { margin-top:18px; border-top:1px solid var(--paper-line); padding-top:14px; }
.s8-share button { margin:4px; }
.s8-share textarea { display:block; width:100%; min-height:180px; background:var(--paper); color:var(--ink); }
.s8-daily-home { margin:28px auto; }
.s8-daily-home button { margin:5px; }
#daily-archive { padding-left:20px; }
#daily-archive li { margin:12px 0; }
#board-shell { padding-bottom:30px; }
.s8-watermark { display:block; position:absolute; bottom:5px; right:12px; max-width:90%; overflow-wrap:anywhere; font:.7rem/1.3 system-ui,sans-serif; color:var(--ink); pointer-events:none; user-select:none; }
.s8-watermark-overlay { position:static; margin-top:20px; max-width:100%; text-align:right; }
button:focus-visible, select:focus-visible, textarea:focus-visible { outline:3px solid var(--gold); outline-offset:3px; }
[hidden] { display:none !important; }
