:root {
  color-scheme: light;
  --paper: #f4f1e8;
  --surface: #fffdf7;
  --ink: #243229;
  --muted: #565f52;
  --green: #214536;
  --green-dark: #19382d;
  --green-soft: #e4ece1;
  --line: #ddd9cc;
  --gold: #dbc080;
  --amber: #78561c;
  --risk: #743e25;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  accent-color: var(--green);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #a06c18; outline-offset: 3px; }
::selection { background: #ecd89f; color: var(--green-dark); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.028em; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1rem; }
small { font-size: .8125rem; }
[hidden] { display: none !important; }
.icon { width: 19px; height: 19px; flex: none; vertical-align: middle; }
.topbar { background: var(--green-dark); color: var(--surface); }
.topbar-inner {
  max-width: 1536px;
  min-height: 72px;
  margin: auto;
  padding: 12px 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; font: 500 1.5rem var(--serif); white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; color: var(--gold); display: grid; place-items: center; }
.brand-mark .icon { width: 34px; height: 34px; }
.view-switch { display: flex; gap: 4px; background: #142e25; padding: 4px; border: 1px solid #476251; border-radius: 9px; }
.view-switch button { border: 0; border-radius: 5px; background: transparent; color: #e0e8dc; min-height: 36px; padding: 5px 15px; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.view-switch button:hover { background: #355547; }
.view-switch button[aria-pressed="true"] { background: #f4ead3; color: #233a2c; }
.preview-label { justify-self: end; font-size: .8125rem; color: #d9e2d5; }
.layout { display: grid; grid-template-columns: 221px minmax(0, 1fr) 286px; max-width: 1536px; margin: auto; min-height: calc(100vh - 72px); }
.rail { padding: 34px 17px 24px 23px; border-right: 1px solid var(--line); }
.rail h2 { font-size: 1.28rem; padding: 0 8px; margin-bottom: 6px; overflow-wrap: anywhere; }
.rail .chapter { color: var(--muted); font-size: .875rem; margin: 0 8px 25px; }
.scene-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.scene-list button { width: 100%; min-height: 43px; display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 8px; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; }
.scene-list button:hover { background: #ebe8dc; }
.scene-list button[aria-current="step"] { background: var(--green-soft); color: var(--green); font-weight: 750; border-color: #ccd9cc; }
.scene-number { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #d6d5c9; border-radius: 50%; color: var(--muted); font-size: .75rem; flex: none; }
[aria-current="step"] .scene-number { color: white; background: var(--green); border-color: var(--green); }
.rail-footer { border-top: 1px solid var(--line); margin: 24px 8px 0; padding-top: 13px; }
.main { min-width: 0; padding: 29px 27px 38px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 15px; }
.toolbar p { color: var(--muted); font-size: .875rem; font-weight: 650; }
.toolbar-actions { display: flex; gap: 6px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 7px 12px; border: 1px solid #d2d0c3; border-radius: 7px; color: var(--green); background: var(--surface); font-size: .875rem; font-weight: 700; text-align: center; }
.button:hover:not(:disabled) { background: var(--green-soft); border-color: #a8b9a8; }
.button.primary { background: var(--green); color: #fffdf7; border-color: var(--green); }
.button.primary:hover:not(:disabled) { background: #2c5946; }
.button.subtle { border-color: transparent; background: transparent; padding-inline: 0; text-align: left; justify-content: start; }
.button.wide { width: 100%; }
.button.mobile-dice { display: none; }
.hero { min-height: 266px; display: flex; flex-direction: column; justify-content: end; overflow: hidden; padding: 25px; border-radius: var(--radius); background: linear-gradient(90deg, #0e2923, #23493c); color: #fff8e8; }
.hero.illustrated { background-image: linear-gradient(0deg, rgba(12,30,26,.93), rgba(12,30,26,.05) 82%), url(assets/golden-barrier.webp); background-position: center, 50% 54%; background-size: cover; }
.hero h1 { font-size: 3rem; text-wrap: balance; }
.hero p { margin-top: 7px; color: #f1e1bb; font-size: .9375rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.main > .panel { margin-top: 17px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 11px; }
.panel-heading > .button { min-height: 38px; }
.heading-icon { display: flex; gap: 8px; align-items: center; }
.heading-icon .icon { color: var(--amber); }
.read-aloud { font: 1.16rem/1.56 var(--serif); color: #394438; max-width: 65ch; }
.encounter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 17px; }
.encounter-grid h2 { margin-bottom: 9px; }
.encounter-grid p, .panel .muted { color: var(--muted); font-size: .9375rem; }
.encounter-grid p + p { margin-top: 8px; }
.encounter-grid .button { margin-top: 12px; }
.tools { min-width: 0; border-left: 1px solid var(--line); padding: 29px 19px 26px; }
.tools > section + section { margin-top: 25px; }
.tools h2 { font-size: 1.45rem; }
.tools .panel-heading { margin-bottom: 6px; }
.party-list { list-style: none; margin: 0; padding: 0; }
.party-list li { border-bottom: 1px solid var(--line); }
.party-list button { display: flex; align-items: center; gap: 9px; text-align: left; width: 100%; min-height: 61px; padding: 7px 4px; color: var(--ink); background: transparent; border: 0; }
.party-list button:hover { background: var(--green-soft); }
.avatar { flex: none; display: grid; place-items: center; width: 37px; height: 37px; border-radius: 9px; color: #294736; background: #dce7d6; font: 600 1.15rem var(--serif); }
.tone-1 { background: #efe0bb; color: #664722; }
.tone-2 { background: #e8ddeb; color: #58395d; }
.tone-3 { background: #f0d8cd; color: #6c3c32; }
.party-list strong, .party-list small { display: block; overflow-wrap: anywhere; }
.party-list small { color: var(--muted); }
.dice-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.dice-options button { min-width: 0; min-height: 43px; padding: 3px; }
.dice-options [aria-pressed="true"] { color: white; background: var(--green); border-color: var(--green); }
.dice-options [aria-pressed="true"]:hover { background: #2c5946; }
.dice-result { min-height: 45px; display: flex; align-items: center; margin-top: 9px; font-size: .875rem; font-weight: 650; color: var(--green); overflow-wrap: anywhere; }
.dice-form { display: flex; gap: 6px; margin-top: 7px; }
.dice-form input { min-width: 0; width: 100%; }
.check-request { border: 1px solid #c9d7c9; border-radius: 8px; background: var(--green-soft); padding: 8px; font-size: .875rem; margin-top: 10px; }
.check-request .button { margin-top: 6px; }
.player-layout .rail { padding-top: 33px; }
.player-layout .rail .party-list { margin-top: 17px; }
.party-list button[aria-pressed="true"] { background: var(--green-soft); border-radius: 7px; }
.player-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.player-header .avatar { width: 52px; height: 52px; font-size: 1.6rem; }
.player-header h1 { font-size: 2.5rem; overflow-wrap: anywhere; }
.player-header p { color: var(--muted); font-size: .9rem; }
.player-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.resource { border-top: 1px solid var(--line); padding-top: 9px; }
.resource strong, .resource label { display: block; }
.resource label { color: var(--muted); font-size: .875rem; }
.resource strong { font-size: 1.2rem; }
progress { width: 100%; height: 9px; }
.traits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; text-align: center; }
.traits div { background: var(--paper); border-radius: 8px; padding: 8px 2px; }
.traits strong, .traits span { display: block; }
.traits span { color: var(--muted); font-size: .875rem; }
.spell { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.spell p { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.spell .risk { color: var(--risk); }
.event-note { margin-top: 12px; color: var(--green); font-weight: 650; overflow-wrap: anywhere; }
dialog { width: min(475px, calc(100% - 32px)); max-height: calc(100% - 32px); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 23px; }
dialog::backdrop { background: #16251ec2; }
dialog .panel-heading { margin-bottom: 13px; }
dialog p { margin-bottom: 10px; }
.form-stack { display: grid; gap: 11px; }
.form-stack label { display: grid; gap: 4px; font-weight: 650; font-size: .875rem; }
input, select { border: 1px solid #b8bdaf; background: #fff; color: var(--ink); border-radius: 6px; padding: 7px 8px; min-height: 40px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.notice { position: fixed; inset: auto 18px 16px auto; max-width: min(440px, calc(100% - 36px)); z-index: 3; color: white; background: var(--green-dark); border-radius: 9px; padding: 9px 12px; box-shadow: 0 8px 24px #15251e40; font-size: .875rem; }
.notice:empty { display: none; }
@media (min-width: 1360px) {
  .layout { grid-template-columns: 244px minmax(0, 1fr) 310px; }
  .main { padding-inline: 32px; }
  .tools { padding-inline: 23px; }
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: 180px minmax(0, 1fr) 232px; }
  .rail { padding-inline: 10px; }
  .main { padding-inline: 17px; }
  .tools { padding-inline: 12px; }
  .hero h1 { font-size: 2.55rem; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr) 245px; }
  .rail { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); padding: 13px 16px; }
  .rail h2, .rail .chapter { display: inline-block; margin: 0 4px 7px 0; padding: 0; }
  .scene-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .scene-list button { width: auto; padding: 4px 7px; min-height: 35px; gap: 5px; }
  .scene-number { width: 21px; height: 21px; }
  .rail-footer { margin: 6px 0 0; padding: 0; border: 0; }
  .player-layout .rail { padding-top: 13px; }
  .player-layout .rail .party-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 0; }
  .player-layout .rail .party-list li { border-bottom: 0; }
  .player-layout .rail .party-list button { min-height: 44px; }
  .player-layout .rail .avatar { display: none; }
  .main, .tools { padding-top: 17px; }
}
@media (max-width: 640px) {
  .topbar-inner { min-height: 62px; grid-template-columns: 1fr auto; padding: 8px 12px; gap: 6px; }
  .brand { font-size: 1.15rem; gap: 4px; }
  .brand-mark, .brand-mark .icon { width: 25px; height: 25px; }
  .view-switch button { padding-inline: 7px; min-height: 32px; font-size: .8125rem; }
  .preview-label { display: none; }
  .layout { display: block; }
  .hero { min-height: 216px; padding: 16px; }
  .encounter-grid { grid-template-columns: 1fr; gap: 10px; }
  .main { padding: 15px 12px; }
  .tools { padding: 15px 12px 22px; border: 0; border-top: 1px solid var(--line); }
  .tools > section + section { margin-top: 17px; }
  .panel { padding: 14px; }
  .toolbar { margin-bottom: 9px; }
  .button.mobile-dice { display: inline-flex; }
}
.checkbox input { min-height: auto; margin: 0 5px 0 0; vertical-align: middle; }
.dm-nav {
  max-width: 1536px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 23px;
  margin: auto;
  border-bottom: 1px solid var(--line);
  background: #ecebdf;
}
.dm-nav > div { display: flex; flex-wrap: wrap; gap: 4px; }
.dm-nav .button { background: transparent; border-color: transparent; }
.dm-nav .button[aria-current="page"] { background: var(--green); color: var(--surface); border-color: var(--green); }
.dm-layout { min-height: calc(100vh - 128px); }
.dm-layout .rail-footer + .rail-footer { margin-top: 6px; border: 0; padding-top: 0; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; }
.workspace-heading h1, .main > h1 { font-size: 2.45rem; overflow-wrap: anywhere; }
.workspace-heading p, .workspace-intro, .tools .muted { color: var(--muted); }
.workspace-intro { margin-top: 7px; max-width: 64ch; }
.workspace-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.workspace-actions .muted { flex-basis: 100%; }
.workspace-intro + .workspace-actions, .panel > .workspace-actions { margin-top: 12px; }
.panel > h2 + .muted, .panel > h1 + .muted { margin-top: 8px; }
.catalog, .detail-list { list-style: none; margin: 0; }
.catalog { padding: 0; }
.catalog-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 13px; padding: 15px; }
.catalog-row + .catalog-row { border-top: 1px solid var(--line); }
.catalog-row .catalog-description { flex: 1 1 185px; min-width: 0; overflow-wrap: anywhere; }
.catalog-row h2 { font: 700 1.08rem/1.24 system-ui, sans-serif; letter-spacing: 0; }
.catalog-row p { margin-top: 4px; }
.monster-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; color: var(--green); font-size: .875rem; font-weight: 650; }
.encounter-image { width: 100%; max-height: 340px; display: block; object-fit: contain; background: var(--green-dark); border-radius: 8px; }
.catalog .encounter-image { width: 64px; height: 56px; object-fit: cover; }
.detail-list { padding: 0; }
.detail-list > li { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 5px 10px; padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.detail-list > li:last-child { padding-bottom: 1px; }
.recent-attacks { margin-top: 10px; }
.player-combat { margin-bottom: 16px; }
.combat-count { color: var(--green); font-size: .875rem; font-weight: 750; }
.player-combat .encounter-image { margin-bottom: 12px; }
.attack-form { margin-top: 12px; }
.attack-form p { font-size: .9375rem; }
textarea {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid #b8bdaf;
  border-radius: 6px;
  padding: 7px 8px;
  resize: vertical;
}
input[type="file"] { width: 100%; }
.panel[aria-labelledby="combat-heading"] { border-color: #afc1b0; }
@media (max-width: 640px) {
  .dm-nav { padding: 5px 9px; gap: 0; align-items: start; }
  .dm-nav .button { min-height: 37px; padding: 5px 7px; }
  .dm-nav > div { gap: 0; }
  .workspace-heading h1, .main > h1 { font-size: 2rem; }
  .toolbar { flex-wrap: wrap; }
}
.weapon-line { margin-top: 9px; color: var(--muted); font-size: .9375rem; }

:root {
  color-scheme: dark;
  --paper: #171819;
  --surface: #252628;
  --ink: #f5f3ed;
  --muted: #c5c3bd;
  --green: #a8d3b3;
  --green-dark: #191e1c;
  --green-soft: #303b35;
  --line: #44464a;
  --gold: #e1bf79;
  --amber: #e2bc6d;
  --risk: #ffbb91;
  --serif: Georgia, "Times New Roman", serif;
  accent-color: #a8d3b3;
}
.topbar { background: #1b1d1e; color: var(--ink); box-shadow: inset 0 -1px #36383a; }
.topbar-inner { max-width: 1536px; }
.view-switch { background: #242628; border-color: #494b4e; }
.view-switch button:hover { background: #414448; }
.view-switch button[aria-pressed="true"] { background: #d8e5d7; color: #202c22; }
.session-tools { display: flex; justify-content: end; align-items: center; gap: 10px; }
.session-tools .button { min-height: 33px; }
.dm-nav { background: #202122; }
.dm-nav .button[aria-current="page"] { background: #333b35; color: #e4f7e7; border-color: #536b58; }
.button { background: #2b2d2e; color: var(--ink); border-color: #585b5d; }
.button:hover:not(:disabled) { color: #f7fff8; background: #39443d; border-color: #849989; }
.button.primary, .dice-options [aria-pressed="true"] { background: #b8d8bb; color: #17271c; border-color: #b8d8bb; }
.button.primary:hover:not(:disabled), .dice-options [aria-pressed="true"]:hover { background: #d3ebd5; color: #17271c; }
.scene-list button:hover { background: #303233; }
.scene-list button[aria-current="step"] { color: #d3edda; border-color: #5e7564; }
.scene-number { border-color: #626466; }
[aria-current="step"] .scene-number { color: #17271c; }
.read-aloud { color: #b3dbb6; }
.check-request { border-color: #5c775f; }
input, select, textarea { background: #202123; color: var(--ink); border-color: #707172; }
input::placeholder, textarea::placeholder { color: #b1b2b0; }
dialog { background: #272a29; }
.notice { background: #2d4936; }
.avatar { color: #d7eed6; background: #374d3e; }
.tone-1 { color: #f3d590; background: #53452e; }
.tone-2 { color: #f0d9f0; background: #514055; }
.tone-3 { color: #ffd0bd; background: #593d36; }
.brand-mark { color: var(--gold); }
.form-status:empty { display: none; }
.form-status { color: var(--risk); }
.gateway { width: min(640px, calc(100% - 32px)); margin: clamp(22px, 6vh, 76px) auto 40px; }
.gateway-art { min-height: 245px; background: linear-gradient(0deg, #172420f0, #17242015 85%), url(assets/golden-barrier.webp) center 58% / cover; border-radius: var(--radius); display: flex; align-items: end; padding: 24px; }
.gateway-art h1 { font-size: 2.45rem; }
.gateway-art p { color: #f5e9cc; margin-top: 5px; }
.gateway > .panel { margin-top: 14px; }
.player-header .encounter-image { width: 110px; height: 128px; border-radius: 12px; object-fit: cover; }
.player-header .avatar { width: 65px; height: 70px; }
.player-header p { margin-top: 4px; }
.player-story, .player-combat { margin: 0 0 15px; }
.player-story .reveal-entry { border-top: 1px solid var(--line); padding: 12px 0; }
.reveal-entry .encounter-image { margin: 8px 0; }
.reveal-entry h3 { margin: 3px 0 7px; }
.reveal-kind { color: #b8d4ed; font-size: .875rem; }
.journal-section { margin-top: 13px; }
.journal-section h3 { margin-bottom: 7px; }
.qr-display { display: grid; place-items: center; min-height: 190px; }
.qr-display img { display: block; width: min(290px, 100%); aspect-ratio: 1; border-radius: 8px; }
.code-fallback { margin-top: 10px; text-align: center; }
code { color: #f8d995; letter-spacing: .055em; }
.sound-mixer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 15px; }
.sound-mixer label { display: grid; font-size: .9rem; }
.sound-mixer input[type="range"] { padding: 0; }
.boss-strip { padding: 10px 11px; border: 1px solid #64766a; border-radius: 8px; margin-bottom: 13px; }
.boss-strip ol { margin: 7px 0; padding-left: 21px; }
.boss-strip [aria-current="step"], .turn-order [aria-current="step"] { color: #c2e9cb; font-weight: 700; }
.turn-order { margin-top: 10px; }
.character-facts { display: flex; flex-wrap: wrap; gap: 5px 15px; color: var(--muted); margin-top: 12px; }
.ability-score { font-size: 1.4rem; }
.builder-actions { margin-top: 14px; }
.type-picker { border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.handbook-block { border-top: 1px solid var(--line); padding: 14px 0; }
.handbook-block h3 { margin-bottom: 7px; }
.handbook-block .workspace-actions { margin-top: 8px; }
.handbook-text { white-space: pre-wrap; }
.handbook-block:is([data-type="Narration"], [data-type="NPC dialogue"]) .handbook-text, .reading-mode { font: 1.2rem/1.55 var(--serif); color: #b9dfbe; }
.handbook-block[data-type="Player action"] h3 { color: #9eceff; }
.handbook-block[data-type="Prop"] h3 { color: var(--gold); }
.handbook-block[data-type="GM secret"] h3 { color: #f0b6be; }
.handbook-block[data-type="Combat"] { padding-inline: 8px; background: #312a2d; }
.handbook > .muted { margin-bottom: 12px; }
dialog.reading-dialog { width: min(1000px, calc(100% - 24px)); min-height: 75vh; }
.reading-mode { margin-top: 14px; font-size: 1.7rem; }
.reading-mode[data-size="standard"] { font-size: 1.2rem; }
.reading-mode[data-size="extra large"] { font-size: 2.2rem; }
.draft-preview section { margin-bottom: 11px; }
.draft-preview details { margin: 6px 0; }
details summary { cursor: pointer; min-height: 32px; padding: 4px 0; font-weight: 650; }
@media (max-width: 860px) {
  .session-tools .preview-label { display: none; }
  .player-rail { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
}
@media (max-width: 640px) {
  .topbar-inner { grid-template-columns: auto 1fr auto; }
  .topbar-inner .button { padding-inline: 5px; font-size: .75rem; }
  .view-switch { justify-self: end; gap: 1px; }
  .view-switch button { padding-inline: 5px; }
  .brand { font-size: 1rem; }
  .brand-mark, .brand-mark .icon { width: 21px; height: 21px; }
  .dm-nav { flex-wrap: wrap; }
  .player-header .encounter-image { width: 76px; height: 91px; }
  .gateway-art { min-height: 200px; padding: 15px; }
  .gateway-art h1 { font-size: 2rem; }
}
