:root {
  color-scheme: dark;
  --ink: #061016;
  --ink-soft: #0b1920;
  --panel: rgba(10, 28, 35, 0.88);
  --panel-solid: #0d2028;
  --paper: #f4ead7;
  --ivory: #fff8e9;
  --muted: #b8aa9f;
  --gold: #c9a66b;
  --gold-bright: #efd49a;
  --gold-dark: #705b35;
  --wine: #0f4853;
  --wine-bright: #2d7886;
  --rose: #8ad6df;
  --violet: #425a78;
  --success: #a8c8a5;
  --danger: #e38b67;
  --line: rgba(216, 182, 106, 0.2);
  --line-strong: rgba(216, 182, 106, 0.46);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.46);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--ink); scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% -8%, rgba(25, 105, 120, 0.34), transparent 34rem),
    radial-gradient(circle at 92% 102%, rgba(54, 74, 111, 0.28), transparent 36rem),
    linear-gradient(135deg, #040b10 0%, #07151b 50%, #050d12 100%);
  color: var(--ivory);
  font-family: var(--sans);
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { color: inherit; }
button, label, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.25;
  animation: drift 16s ease-in-out infinite alternate;
}
.ambient-one { top: 18%; left: -12rem; background: #0d6c7b; }
.ambient-two { right: -12rem; bottom: 0; background: #344e78; animation-delay: -8s; }
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

@keyframes drift { to { transform: translate3d(5rem, -3rem, 0) scale(1.12); } }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.play-locked { overflow: hidden; }
body.play-locked > :not(.play-gate):not(script) { visibility: hidden; }

.play-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  min-height: 100dvh;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(3, 10, 14, 0.98) 0 40%, rgba(3, 12, 16, 0.78) 66%, rgba(3, 10, 14, 0.93) 100%),
    radial-gradient(circle at 77% 48%, rgba(45, 120, 134, 0.24), transparent 24rem),
    linear-gradient(135deg, #03090d, #07161c 52%, #03090d);
  color: var(--ivory);
}

.play-gate::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.play-gate-atmosphere {
  position: fixed;
  top: 50%;
  right: clamp(-13rem, -6vw, -4rem);
  width: min(58vw, 720px);
  aspect-ratio: 1;
  transform: translateY(-50%);
  border-radius: 50%;
  background: url("assets/rpg-studio-oath-sigil.svg") center / 72% no-repeat;
  opacity: 0.13;
  filter: drop-shadow(0 0 80px rgba(52, 139, 153, 0.24));
}

.play-gate-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 48px));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px 0 30px;
}

.play-gate-brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ivory);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.25em;
  text-decoration: none;
}

.play-gate-brand img { width: 48px; height: 48px; }
.play-gate-card { width: min(620px, 100%); align-self: center; padding: clamp(32px, 5vw, 64px); border: 1px solid var(--line-strong); border-radius: 24px 5px 24px 5px; background: linear-gradient(145deg, rgba(13, 32, 40, 0.96), rgba(5, 16, 22, 0.94)); box-shadow: 0 32px 90px rgba(0, 0, 0, 0.5); }
.play-gate-copy { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.play-gate-kicker { color: var(--gold); font-size: 0.73rem; font-weight: 750; letter-spacing: 0.22em; }
.play-gate-copy h1 { max-width: 10ch; margin: 15px 0 18px; font-family: var(--serif); font-size: clamp(2.8rem, 6vw, 5.25rem); font-weight: 400; line-height: 0.94; letter-spacing: -0.045em; text-wrap: balance; }
.play-gate-copy p { max-width: 42ch; margin: 0; color: #cbbfb4; font-size: 1.04rem; line-height: 1.7; }
.play-gate-form { margin-top: 28px; }
.play-gate-form > label { display: block; margin-bottom: 9px; color: var(--gold-bright); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; }
.play-gate-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(0, 0, 0, 0.24); transition: border-color 160ms ease, box-shadow 160ms ease; }
.play-gate-field:focus-within { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(239, 212, 154, 0.12); }
.play-gate-field input { min-width: 0; height: 58px; padding: 0 18px; border: 0; outline: 0; background: transparent; color: var(--ivory); font-size: 1.12rem; letter-spacing: 0.08em; }
.play-gate-field button { min-width: 130px; min-height: 58px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 0 20px; border: 0; border-left: 1px solid rgba(6, 16, 22, 0.3); background: linear-gradient(135deg, #e4c578, #c89e56); color: #11100c; font-weight: 800; cursor: pointer; }
.play-gate-field button:hover { background: linear-gradient(135deg, #efd795, #d7ae65); }
.play-gate-field button:active { transform: translateY(1px); }
.play-gate-error { min-height: 1.5em; margin: 9px 0 0; color: #f0aa8d; font-size: 0.83rem; }
.play-gate-home { display: inline-block; margin-top: 17px; color: #cbbfb4; font-size: 0.88rem; text-underline-offset: 4px; }
.play-gate-note { align-self: end; margin: 0; color: #8d827a; font-size: 0.76rem; }
.play-gate-noscript { position: fixed; z-index: 2; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; color: #f0aa8d; }

@media (max-width: 760px) {
  .play-gate { background: radial-gradient(circle at 80% 18%, rgba(45, 120, 134, 0.22), transparent 18rem), linear-gradient(160deg, #03090d, #07161c 60%, #03090d); }
  .play-gate-atmosphere { top: 8%; right: -7rem; width: 22rem; transform: none; opacity: 0.08; }
  .play-gate-shell { width: min(100% - 28px, 560px); min-height: 100svh; padding: 18px 0 22px; }
  .play-gate-brand img { width: 42px; height: 42px; }
  .play-gate-brand { font-size: 0.72rem; }
  .play-gate-card { padding: 28px 20px; border-radius: 18px 4px 18px 4px; }
  .play-gate-copy { padding-bottom: 22px; }
  .play-gate-copy h1 { max-width: 11ch; margin-top: 12px; font-size: clamp(2.65rem, 13vw, 4rem); }
  .play-gate-copy p { font-size: 0.98rem; line-height: 1.6; }
  .play-gate-form { margin-top: 22px; }
  .play-gate-field { grid-template-columns: 1fr; overflow: visible; border: 0; background: transparent; }
  .play-gate-field input { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(0, 0, 0, 0.24); }
  .play-gate-field input:focus { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(239, 212, 154, 0.12); }
  .play-gate-field button { width: 100%; margin-top: 10px; border: 0; border-radius: 10px; }
  .play-gate-note { max-width: 34ch; font-size: 0.7rem; }
}

.site-header {
  width: min(1540px, calc(100% - 40px));
  height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ivory);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.wordmark-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold-dark);
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-8deg);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0;
}

.wordmark-mark::first-letter { transform: rotate(8deg); }
.header-actions { display: flex; align-items: center; gap: 18px; }
.play-controls { display: flex; align-items: center; gap: 9px; }
.layout-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,0.2); }
.layout-option { min-width: 52px; padding: 6px 11px; border: 0; border-radius: 999px; background: transparent; color: #7f746e; font-size: 0.68rem; cursor: pointer; transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.layout-option.active { background: #302428; box-shadow: inset 0 0 0 1px rgba(216,182,106,0.2); color: var(--gold-bright); }
.privacy-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.73rem; letter-spacing: 0.04em; }
.privacy-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #89af85; box-shadow: 0 0 10px #89af85; }

.quiet-button, .icon-button, .text-button, .secondary-button, .resume-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.quiet-button:hover, .icon-button:hover, .secondary-button:hover, .resume-button:hover { border-color: var(--line-strong); background: rgba(216,182,106,0.06); }
.quiet-button { padding: 9px 13px; border-radius: 999px; color: #d2c5ba; font-size: 0.75rem; }
.icon-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; color: var(--muted); font-size: 0.72rem; }
.icon-button svg { width: 16px; height: 16px; fill: currentColor; }

#app-shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; }
.view { min-height: calc(100vh - 84px); }
.setup-view, .studio-view { width: min(1320px, 100%); margin-inline: auto; }

.setup-view {
  display: grid;
  grid-template-columns: minmax(340px, 0.88fr) minmax(480px, 1.12fr);
  gap: clamp(48px, 7vw, 112px);
  align-items: start;
  padding: 36px 0 80px;
}

.module-cover-wrap {
  width: min(100%, clamp(330px, calc((100dvh - 230px) * 0.6667), 430px));
  justify-self: end;
  align-self: start;
}
.edition-kicker, .eyebrow, .chapter-label, .state-kicker, .fate-label, .summary-kicker {
  color: var(--gold);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.edition-kicker { margin: 0 0 13px 3px; color: #9d8d80; }

.module-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(226, 195, 124, 0.48);
  border-radius: 4px 16px 16px 4px;
  box-shadow: -9px 6px 0 #1e1718, -10px 6px 0 rgba(216,182,106,0.22), var(--shadow);
  transform: perspective(1400px) rotateY(2deg) rotateZ(-0.5deg);
}
.module-cover::after { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(240,215,146,0.38); border-radius: 2px 11px 11px 2px; pointer-events: none; }
.module-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,4,5,0.18), rgba(5,4,5,0.05) 35%, rgba(5,4,5,0.92) 91%); }
.cover-copy { position: absolute; inset: 9% 8% 8%; display: flex; flex-direction: column; justify-content: flex-end; text-align: center; text-shadow: 0 2px 18px #000; }
.cover-copy p { margin: 0 0 auto; color: #e8d7bd; font-size: 0.67rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.cover-crest { margin: auto 0 12px; color: var(--gold-bright); font-size: 1.2rem; }
.cover-copy h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.25rem, 4.2vw, 3.7rem); font-weight: 400; line-height: 0.9; letter-spacing: -0.055em; }
.cover-copy span { margin-top: 15px; color: #d9c8b5; font-family: var(--serif); font-size: 0.83rem; font-style: italic; }
.setup-view[data-module-id="unbroken-v1"] .cover-scrim { background: linear-gradient(180deg, transparent 0 54%, rgba(5,4,5,0.16) 61%, rgba(5,4,5,0.86) 76%, rgba(5,4,5,0.98) 100%); }
.setup-view[data-module-id="unbroken-v1"] .cover-copy { inset: 58% 7% 4%; justify-content: flex-end; }
.setup-view[data-module-id="unbroken-v1"] .cover-crest { display: none; }
.setup-view[data-module-id="unbroken-v1"] .cover-copy p { margin: 0 0 8px; font-size: 0.56rem; line-height: 1.35; }
.setup-view[data-module-id="unbroken-v1"] .cover-copy h1 { font-size: clamp(1.75rem, 3.15vw, 2.85rem); line-height: 0.91; }
.setup-view[data-module-id="unbroken-v1"] .cover-copy span { margin-top: 9px; font-size: 0.76rem; }
.module-meta { display: flex; justify-content: center; gap: 9px; margin-top: 25px; }
.module-meta span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.66rem; }

.setup-panel { max-width: 610px; }
.module-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 28px; }
.module-selector button { min-width: 0; display: grid; gap: 4px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,0.018); color: #988c84; text-align: left; cursor: pointer; }
.module-selector button:hover { border-color: var(--line-strong); }
.module-selector button.selected { border-color: rgba(216,182,106,0.7); background: linear-gradient(135deg, rgba(112,59,31,0.42), rgba(15,72,83,0.22)); box-shadow: inset 0 0 0 1px rgba(216,182,106,0.08); }
.module-selector span { color: var(--gold); font-size: .56rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.module-selector strong { color: #e3d7cc; font-family: var(--serif); font-size: .92rem; font-weight: 400; }
.module-selector small { color: #7f746d; font-size: .62rem; }
.setup-panel h2, .studio-intro h1 {
  margin: 12px 0 18px;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 4.5vw, 4.5rem);
  font-weight: 400;
  line-height: 0.99;
  letter-spacing: -0.045em;
}
.lede { max-width: 56ch; margin: 0 0 34px; color: #cbbdb2; font-family: var(--serif); font-size: 1.04rem; line-height: 1.68; }
.field-label, fieldset legend { display: block; margin-bottom: 9px; color: #d9cdc2; font-size: 0.77rem; font-weight: 700; letter-spacing: 0.03em; }
.text-field { height: 52px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.025); }
.text-field:focus-within { border-color: var(--gold-dark); }
.text-field input { min-width: 0; flex: 1; height: 100%; padding: 0 16px; border: 0; outline: 0; background: none; color: var(--ivory); font-family: var(--serif); font-size: 1.12rem; }
.text-field span { padding: 0 14px; color: #7f746c; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; }
.field-help { margin: 7px 2px 0; color: #8e837b; font-size: 0.72rem; line-height: 1.45; }
.hatchling-name-field { margin-top: 20px; }
.role-fieldset { margin-top: 25px; }
.role-fieldset > p { margin: -3px 0 11px; color: #7f8d91; font-size: 0.72rem; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-option { min-width: 0; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-card { min-height: 96px; display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-rows: auto auto auto; align-content: center; column-gap: 11px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,0.018); transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.role-option:hover .role-card { transform: translateY(-1px); border-color: var(--line-strong); }
.role-option input:focus-visible + .role-card { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.role-option input:checked + .role-card { border-color: rgba(138,214,223,0.68); background: linear-gradient(135deg, rgba(15,72,83,0.43), rgba(201,166,107,0.07)); box-shadow: inset 0 0 0 1px rgba(138,214,223,0.07); }
.role-avatar, .identity-avatar { display: block; background-image: url("assets/seventh-current-avatars.webp"); background-repeat: no-repeat; background-size: 200% 200%; }
.role-avatar { width: 80px; height: 80px; grid-row: 1 / 4; border: 1px solid rgba(201,166,107,0.32); border-radius: 9px; }
.avatar-cartographer { background-position: 0 0; }
.avatar-stormrunner { background-position: 100% 0; }
.avatar-diver { background-position: 0 100%; }
.avatar-envoy { background-position: 100% 100%; }
.role-card strong { align-self: end; color: #dce8e7; font-family: var(--serif); font-size: 0.82rem; font-weight: 400; line-height: 1.15; }
.role-card small { align-self: start; margin-top: 3px; color: #718287; font-size: 0.62rem; line-height: 1.25; }
.attribute-builder { margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(3,14,19,0.34); }
.attribute-builder-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.attribute-builder-head strong, .attribute-builder-head small { display: block; }
.attribute-builder-head strong { color: #cddbdc; font-family: var(--serif); font-size: 0.84rem; font-weight: 400; }
.attribute-builder-head small { color: #64767b; font-size: 0.63rem; }
.attribute-builder-head button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(138,214,223,0.05); color: var(--rose); font-size: 0.68rem; cursor: pointer; }
.attribute-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.attribute-grid > div { padding: 8px 6px; border-radius: 8px; background: rgba(255,255,255,0.025); text-align: center; }
.attribute-grid span, .attribute-grid strong { display: block; }
.attribute-grid span { color: #72848a; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; }
.attribute-grid strong { margin-top: 2px; color: var(--gold-bright); font-family: var(--serif); font-size: 1rem; font-weight: 400; }
fieldset { min-width: 0; padding: 0; border: 0; }
.trope-fieldset { position: relative; margin: 27px 0 0; }
.trope-fieldset legend { margin-bottom: 2px; }
.trope-fieldset > p, .tone-fieldset > p { margin: 0 0 12px; color: #81766f; font-size: 0.7rem; }
.trope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trope-option { cursor: pointer; }
.trope-option input { position: absolute; opacity: 0; pointer-events: none; }
.trope-option span { min-height: 66px; display: flex; flex-direction: column; justify-content: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.02); transition: all 160ms ease; }
.trope-option strong { color: #d4c7bd; font-family: var(--serif); font-size: 0.86rem; font-weight: 400; }
.trope-option small { margin-top: 2px; color: #786f69; font-size: 0.64rem; }
.trope-option input:checked + span { border-color: rgba(216,182,106,0.72); background: linear-gradient(135deg, rgba(95,23,36,0.31), rgba(216,182,106,0.07)); box-shadow: inset 0 0 0 1px rgba(216,182,106,0.08); }
.trope-option input:checked + span strong { color: var(--gold-bright); }
.selection-count { position: absolute; right: 2px; top: 0; color: var(--gold); font-size: 0.65rem; }
.tone-fieldset { margin-top: 24px; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,0.18); }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span { display: block; padding: 9px 8px; border-radius: 8px; color: #8f837a; text-align: center; font-size: 0.69rem; cursor: pointer; }
.segmented-control input:checked + span { color: var(--ivory); background: #302327; box-shadow: 0 3px 12px rgba(0,0,0,0.3); }
.tone-fieldset > p { margin-top: 7px; }
.secondary-legend { margin-top: 16px; }

.primary-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 25px;
  padding: 0 20px;
  border: 1px solid #e3c77d;
  border-radius: 10px;
  background: linear-gradient(135deg, #b18a43, #e2c377 55%, #a97b34);
  box-shadow: 0 13px 30px rgba(117, 79, 25, 0.2), inset 0 1px rgba(255,255,255,0.4);
  color: #1a1209;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.primary-button:disabled { filter: grayscale(0.8); opacity: 0.42; cursor: not-allowed; }
.primary-button.compact { width: auto; min-width: 190px; min-height: 44px; margin-top: 0; }
.resume-button { width: 100%; margin-top: 9px; padding: 11px; border-radius: 9px; color: var(--gold); }
.private-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 13px 0 0; color: #7f756e; font-size: 0.66rem; }
.private-note svg { width: 14px; height: 14px; fill: currentColor; }

/* Playing */
.play-view {
  height: calc(100dvh - 84px);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(200px, 230px) minmax(430px, 1fr) minmax(330px, 380px);
  gap: 16px;
  padding: 18px 0 22px;
  overflow: hidden;
}
.character-column, .story-column, .action-column { min-width: 0; min-height: 0; }
.character-column { display: flex; flex-direction: column; gap: 10px; }
.story-column { display: flex; flex-direction: column; gap: 13px; }
.action-column { display: flex; flex-direction: column; overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(155deg, rgba(31,23,26,0.91), rgba(14,11,12,0.94)); box-shadow: 0 22px 55px rgba(0,0,0,0.28); scrollbar-width: thin; }
.action-column.awaiting-player-action { border-color: rgba(216,182,106,0.72); box-shadow: inset 0 0 0 1px rgba(216,182,106,0.2), 0 0 18px rgba(216,182,106,0.17), 0 22px 55px rgba(0,0,0,0.28); }
.action-kicker { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; color: var(--gold); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.16em; }
.action-kicker small { color: #6e6560; font-size: 0.58rem; font-weight: 500; letter-spacing: 0; }
.scene-header { min-height: 78px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.scene-header h1 { margin: 6px 0 0; font-family: var(--serif); font-size: clamp(2.15rem, 3.2vw, 3.45rem); font-weight: 400; line-height: 0.98; letter-spacing: -0.04em; }
.scene-progress { width: 112px; padding-bottom: 5px; color: #877c74; font-size: 0.67rem; text-align: right; }
.progress-track { height: 2px; margin-top: 8px; overflow: hidden; background: #2a2223; }
.progress-track div { width: 20%; height: 100%; background: var(--gold); transition: width 500ms ease; }
.story-cast { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 13px; background: rgba(17, 25, 27, 0.68); }
.story-cast-heading { flex: 0 0 74px; display: grid; gap: 3px; padding-left: 4px; color: var(--gold); font-size: 0.59rem; font-weight: 750; letter-spacing: 0.14em; }
.story-cast-heading small { color: #837971; font-size: 0.55rem; font-weight: 500; letter-spacing: 0; line-height: 1.25; }
.story-cast-list { display: flex; gap: 7px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.story-cast-button { flex: 0 0 auto; width: 48px; display: grid; align-items: center; padding: 4px; border: 1px solid #3b3230; border-radius: 9px; background: rgba(255,255,255,0.025); color: #cfc1b5; cursor: pointer; text-align: left; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.story-cast-button:hover, .story-cast-button:focus-visible { transform: translateY(-1px); border-color: var(--gold-dark); background: rgba(216,182,106,0.08); outline: 0; }
.story-cast-button img { width: 38px; height: 42px; border-radius: 6px; object-fit: cover; object-position: 50% 17%; }
.story-cast-button span { display: none; }
.action-column.cast-drawer-open > :not(.cast-drawer) { display: none; }
.cast-drawer { min-height: 0; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.cast-drawer-close { align-self: flex-start; padding: 6px 0; border: 0; background: none; color: var(--gold); font-size: 0.69rem; cursor: pointer; }
.cast-drawer-close:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.cast-drawer > img { width: 100%; min-height: 0; flex: 1; border: 1px solid var(--line-strong); border-radius: 13px; object-fit: contain; background: #090b0c; box-shadow: 0 16px 38px rgba(0,0,0,0.38); }
.cast-drawer-copy { flex: 0 0 auto; }
.cast-drawer-copy > span { color: var(--gold); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.cast-drawer-copy h2 { margin: 7px 0 6px; font-family: var(--serif); font-size: clamp(1.65rem, 2.25vw, 2rem); font-weight: 400; line-height: 1.08; text-wrap: balance; }
.cast-drawer-copy blockquote { margin: 0 0 9px; color: #f0dfcb; font-family: var(--serif); font-size: 1rem; font-style: italic; line-height: 1.5; text-wrap: pretty; }
.cast-drawer-copy p { margin: 0; color: #b8aaa0; font-size: 0.9rem; line-height: 1.58; text-wrap: pretty; }
.cast-card-enlarge { width: 100%; min-height: 44px; margin-top: 14px; justify-content: center; }
.cast-card-modal { box-sizing: border-box; width: min(1180px, calc(100vw - 24px)); height: min(calc(100dvh - 24px), 960px); max-width: none; max-height: none; padding: 18px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(145deg, #10272e, #071116 72%); box-shadow: 0 30px 100px rgba(0,0,0,.72); color: var(--ivory); }
.cast-card-modal::backdrop { background: rgba(2, 8, 11, 0.91); backdrop-filter: blur(10px); }
.cast-card-modal-close { position: absolute; top: 16px; right: 16px; float: none; margin: 0; background: rgba(6,16,22,.92); color: var(--ivory); }
.cast-card-modal-layout { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); gap: clamp(18px, 3vw, 38px); align-items: center; }
.cast-card-modal-art { min-width: 0; min-height: 0; height: 100%; display: grid; place-items: center; }
.cast-card-modal-art img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; border: 1px solid var(--line-strong); border-radius: 14px; background: #05090b; box-shadow: 0 20px 55px rgba(0,0,0,.48); }
.cast-card-modal-copy { max-width: 34rem; padding-right: clamp(8px, 2vw, 24px); }
.cast-card-modal-copy > span { color: var(--gold-bright); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.cast-card-modal-copy h2 { margin: 12px 0 18px; font-family: var(--serif); font-size: clamp(2.1rem, 4vw, 4rem); font-weight: 400; line-height: 1; letter-spacing: -.025em; text-wrap: balance; }
.cast-card-modal-copy blockquote { margin: 0 0 20px; color: #f2dfc7; font-family: var(--serif); font-size: clamp(1.15rem, 1.7vw, 1.5rem); font-style: italic; line-height: 1.55; text-wrap: pretty; }
.cast-card-modal-copy p { max-width: 44ch; margin: 0; color: #c5b8ad; font-size: 1.05rem; line-height: 1.7; text-wrap: pretty; }
.narrative-card { position: relative; flex: 1; min-height: 0; padding: clamp(30px, 4vw, 50px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(39,28,31,0.94), rgba(18,14,15,0.93)); box-shadow: var(--shadow); scrollbar-width: thin; }
.narrative-card::before { content: ""; position: absolute; width: 230px; height: 230px; right: -80px; top: -95px; border: 1px solid rgba(216,182,106,0.09); border-radius: 50%; box-shadow: 0 0 0 22px rgba(216,182,106,0.025), 0 0 0 44px rgba(216,182,106,0.018); }
.narrative-ornament { position: absolute; left: 17px; top: 14px; color: rgba(216,182,106,0.36); }
#narrative-copy { position: relative; }
#narrative-copy p { max-width: 68ch; margin: 0 0 1em; color: #e7dbcf; font-family: var(--serif); font-size: clamp(1.03rem, 1.35vw, 1.23rem); line-height: 1.7; }
#narrative-copy p:last-child { margin-bottom: 0; }
#narrative-copy em { color: var(--gold-bright); font-style: normal; }
.story-status-strip { display: none; align-items: center; gap: 18px; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: #786f69; font-size: 0.65rem; }
.story-status-strip span:first-child { margin-right: auto; color: #aa9e95; }
.story-status-strip strong { color: #d9c8b8; font-weight: 600; }
.narration-controls { display: grid; grid-template-columns: auto auto minmax(100px, 1fr) auto auto; align-items: center; gap: 8px; color: #8e827a; font-size: 0.64rem; }
.narration-controls button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.02); color: #b2a59c; cursor: pointer; }
.narration-controls button:disabled { opacity: 0.45; cursor: default; }
.narration-controls input[type="range"], .voice-field input[type="range"] { width: 100%; accent-color: var(--gold); }
.narration-sentence,
.narration-word { padding: 0; margin: 0; border: 0; color: inherit; font: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; letter-spacing: inherit; transition: none; transform: none; }
.narration-sentence { border-radius: 4px; }
.narration-sentence.active-sentence { background: rgba(216,182,106,0.1); color: #f1e6d9; }
.narration-word.active-word { border-radius: 3px; background: #d8b66a; box-shadow: inset 0 -2px 0 #f3d48a; color: #211813; }
.compact-text { padding: 0; font-size: 0.62rem; }
.role-inspect-button { grid-column: 2; justify-self: start; padding: 0; border: 0; background: none; color: var(--gold); font-size: 0.58rem; cursor: pointer; }
.role-inspect-button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.portrait-hover-preview { position: fixed; z-index: 30; width: 300px; height: 300px; pointer-events: none; border: 1px solid var(--line-strong); border-radius: 16px; background-image: url("assets/seventh-current-avatars.webp"); background-repeat: no-repeat; background-size: 200% 200%; box-shadow: 0 24px 70px rgba(0,0,0,0.72); }
.portrait-modal { width: min(620px, calc(100% - 28px)); text-align: center; }
.portrait-modal h2 { margin: 12px 0 7px; font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 400; }
.portrait-modal p { color: var(--muted); }
.portrait-preview-art { width: min(520px, 75vw); aspect-ratio: 1; margin: 0 auto 24px; border: 1px solid var(--line-strong); border-radius: 16px; background-image: url("assets/seventh-current-avatars.webp"); background-repeat: no-repeat; background-size: 200% 200%; }
.tooltip-popover { position: fixed; z-index: 60; width: min(300px, calc(100vw - 24px)); padding: 13px 34px 13px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #241a1c; box-shadow: 0 16px 45px rgba(0,0,0,0.6); color: #d8ccc3; font-size: 0.72rem; line-height: 1.45; }
.tooltip-popover button { position: absolute; right: 7px; top: 6px; border: 0; background: none; color: #9c9088; cursor: pointer; }
.tooltip-popover.inline-tooltip { position: relative; inset: auto; width: 100%; margin: 10px 0; box-shadow: none; }
.preference-check { display: flex; align-items: center; gap: 9px; color: #b7aaa0; font-size: 0.72rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.adult-confirm-modal { width: min(560px, calc(100% - 28px)); }
.adult-confirm-modal h2 { font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 400; }
.adult-confirm-modal p { color: var(--muted); line-height: 1.6; }
.fate-reveal { display: flex; align-items: center; gap: 13px; margin: 10px 0 17px; padding: 12px 13px; border-left: 1px solid var(--gold-dark); background: linear-gradient(90deg, rgba(216,182,106,0.08), transparent); }
.fate-seal { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--gold-dark); border-radius: 50%; color: var(--gold); animation: reveal 700ms ease both; }
.fate-reveal p { margin: 3px 0 0; color: #bfb0a4; font-family: var(--serif); font-size: 0.8rem; font-style: italic; line-height: 1.35; }
@keyframes reveal { from { transform: scale(0.4) rotate(-30deg); opacity: 0; } }
.choice-section { min-height: 0; }
.choice-heading-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.choice-heading-row h2 { margin: 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.choice-heading-row > span { color: #786f69; font-size: 0.62rem; }
.choice-list { display: grid; gap: 7px; }
.choice-button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,0.018); text-align: left; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.choice-button:hover { transform: translateX(3px); border-color: var(--line-strong); background: rgba(216,182,106,0.055); }
.choice-glyph { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #3d3032; border-radius: 9px; color: var(--gold); font-family: var(--serif); }
.choice-button strong { display: block; color: #ded2c8; font-family: var(--serif); font-size: 0.88rem; font-weight: 400; line-height: 1.22; }
.choice-button small { display: block; margin-top: 3px; color: #756c66; font-size: 0.61rem; }
.choice-button > span:last-child { color: #5c514d; }
.freeform-row { height: 45px; display: flex; align-items: center; margin-top: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,0.17); }
.freeform-row:focus-within { border-color: var(--gold-dark); }
.freeform-row input { min-width: 0; flex: 1; height: 100%; padding: 0 12px; border: 0; outline: 0; background: none; color: var(--ivory); font-family: var(--serif); font-size: 0.82rem; }
.freeform-row input::placeholder { color: #685f5b; }
.mic-button, .send-button { width: 40px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: #8e7f76; cursor: pointer; }
.mic-button svg { width: 18px; height: 18px; fill: currentColor; }
.mic-button.listening { color: var(--rose); animation: pulse 1.1s ease-in-out infinite; }
.send-button { margin-right: 4px; border-radius: 8px; background: #302428; color: var(--gold); }
@keyframes pulse { 50% { transform: scale(1.13); filter: drop-shadow(0 0 7px #2d7886); } }
@media (prefers-reduced-motion: no-preference) {
  .action-column.awaiting-player-action { animation: playerActionGlow 2.4s ease-in-out infinite; }
  @keyframes playerActionGlow { 50% { border-color: rgba(230,203,133,0.95); box-shadow: inset 0 0 0 1px rgba(216,182,106,0.28), 0 0 24px rgba(216,182,106,0.25), 0 22px 55px rgba(0,0,0,0.28); } }
}
.interpretation-note { margin: 7px 4px 0; color: #5f5753; font-size: 0.59rem; line-height: 1.35; }

.resolution-panel { padding: 20px; border: 1px solid var(--line-strong); border-radius: 15px; background: linear-gradient(135deg, rgba(70,44,49,0.47), rgba(18,14,15,0.88)); box-shadow: var(--shadow); }
.resolution-topline { display: flex; justify-content: space-between; color: var(--gold); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; }
.resolution-topline span:last-child { color: #897c73; letter-spacing: 0.03em; }
.dice-stage { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.die-button { position: relative; width: 78px; height: 78px; flex: 0 0 auto; border: 0; background: transparent; cursor: pointer; }
.die-shape { position: absolute; inset: 5px; background: linear-gradient(145deg, #e4c77d, #997134); clip-path: polygon(50% 0, 94% 25%, 94% 75%, 50% 100%, 6% 75%, 6% 25%); filter: drop-shadow(0 8px 15px rgba(0,0,0,0.5)); }
.die-shape::after { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(35,21,8,0.5); clip-path: inherit; }
.die-button strong { position: relative; z-index: 1; color: #24170a; font-family: var(--serif); font-size: 1.45rem; }
.die-button.rolling { animation: diceRoll 700ms cubic-bezier(.2,.8,.2,1); }
@keyframes diceRoll { 20% { transform: rotate(80deg) scale(.86); } 55% { transform: rotate(250deg) scale(1.1); } 100% { transform: rotate(360deg); } }
.dice-stage h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 400; }
.dice-stage p { margin: 5px 0 0; color: #978b82; font-size: 0.73rem; }
.resolution-result { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.resolution-result p { margin: 0 0 16px; color: #d9cec4; font-family: var(--serif); font-size: 0.94rem; line-height: 1.52; }
.resolution-tier { width: fit-content; margin-bottom: 10px; padding: 5px 8px; border: 1px solid rgba(216,182,106,.35); border-radius: 999px; color: var(--gold-bright); font-size: .58rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.resolve-spend { width: 100%; margin: 0 0 10px; }
.roll-autoplay-control { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid rgba(216,182,106,.28); border-radius: 11px; color: #e4d9cd; cursor: pointer; }
.roll-autoplay-control input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--gold); }
.roll-autoplay-control span { display: grid; gap: 2px; }
.roll-autoplay-control strong { font-size: .82rem; }
.roll-autoplay-control small { color: #9f9288; font-size: .7rem; line-height: 1.4; }

.state-card, .resource-card, .ledger-card { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(24,18,20,0.7); backdrop-filter: blur(18px); }
.identity-card h2 { margin: 5px 0 0; font-family: var(--serif); font-size: 1.4rem; font-weight: 400; }
.identity-card p, .current-truth p { margin: 3px 0 0; color: #837970; font-family: var(--serif); font-size: 0.76rem; font-style: italic; }
.identity-profile { display: flex; align-items: center; gap: 11px; margin-top: 9px; }
.identity-profile h2 { margin: 0; }
.identity-profile p { color: #82949a; }
.identity-avatar { width: 52px; height: 52px; flex: 0 0 auto; border: 1px solid rgba(201,166,107,0.35); border-radius: 10px; }
.companion-profile { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.companion-profile img { width: 58px; height: 58px; flex: 0 0 auto; object-fit: cover; border: 1px solid rgba(216,182,106,.45); border-radius: 12px; }
.companion-profile h3 { margin: 0; color: #eadbc8; font-family: var(--serif); font-size: 1.08rem; font-weight: 400; }
.companion-profile p { margin: 4px 0 0; color: #9f8c7f; font-size: .66rem; }
.identity-vitality { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: #7f9195; font-size: 0.66rem; }
.identity-vitality strong { color: #cbd7d5; font-weight: 600; }
.resource-row, .meter-row, .ledger-title { display: flex; align-items: center; justify-content: space-between; }
.resource-row span, .meter-row span { display: block; color: #d6c9bf; font-family: var(--serif); font-size: 0.86rem; }
.resource-row small { display: block; color: #706762; font-size: 0.58rem; }
.resource-row strong { color: var(--gold-bright); font-family: var(--serif); font-size: 1.5rem; }
.resource-pips { display: flex; gap: 5px; margin: 10px 0 18px; }
.resource-pips i { width: 22px; height: 4px; border-radius: 4px; background: var(--gold); }
.resource-pips i.empty { background: #332a2b; }
.meter-row { margin-top: 10px; font-size: 0.68rem; }
.meter-row strong { color: var(--success); }
.meter-row.danger strong { color: var(--danger); }
.meter { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 4px; background: #2d2627; }
.meter i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #718f71, #b8d1ad); transition: width 500ms ease; }
.danger-meter i { width: 10%; background: linear-gradient(90deg, #87533d, #e38b67); }
.current-truth { flex: 1; }
.current-truth p { color: #b5a89f; line-height: 1.55; }
.ledger-launch { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(216,182,106,0.045); color: #9d9189; text-align: left; cursor: pointer; }
.ledger-launch small, .ledger-launch strong { display: block; }
.ledger-launch small { margin-bottom: 3px; color: #655d58; font-size: 0.54rem; letter-spacing: 0.14em; }
.ledger-launch strong { color: #cbbeb4; font-family: var(--serif); font-size: 0.82rem; font-weight: 400; }
.ledger-launch > span:last-child { color: var(--gold); }

/* Living Book mode uses the same scene and event state with a second renderer. */
.play-view[data-layout="book"] { width: min(1180px, 100%); grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr); gap: 0; margin-inline: auto; padding: 28px 0 34px; }
.play-view[data-layout="book"] .character-column { display: none; }
.play-view[data-layout="book"] .story-column,
.play-view[data-layout="book"] .action-column { position: relative; height: 100%; padding: clamp(30px, 4vw, 52px); border: 1px solid #b7a98c; border-radius: 5px 0 0 8px; background: linear-gradient(100deg, #eee2ca, #fff9e9 22%, #f7ecd7); box-shadow: -16px 22px 60px rgba(0,0,0,0.42); color: #2b211e; }
.play-view[data-layout="book"] .action-column { border-left: 0; border-radius: 0 8px 8px 0; background: linear-gradient(80deg, #eadcc2, #fbf1de 13%, #f2e5cf); box-shadow: 16px 22px 60px rgba(0,0,0,0.42), inset 16px 0 28px rgba(72,50,30,0.08); }
.play-view[data-layout="book"] .action-column.awaiting-player-action { border-color: rgba(28,93,108,0.78); box-shadow: inset 0 0 0 1px rgba(28,93,108,0.28), 0 0 20px rgba(42,113,128,0.23), 16px 22px 60px rgba(0,0,0,0.42), inset 16px 0 28px rgba(72,50,30,0.08); }
@media (prefers-reduced-motion: no-preference) {
  .play-view[data-layout="book"] .action-column.awaiting-player-action { animation-name: bookPlayerActionGlow; }
  @keyframes bookPlayerActionGlow { 50% { border-color: rgba(19,78,92,0.98); box-shadow: inset 0 0 0 1px rgba(28,93,108,0.38), 0 0 26px rgba(42,113,128,0.3), 16px 22px 60px rgba(0,0,0,0.42), inset 16px 0 28px rgba(72,50,30,0.08); } }
}
.play-view[data-layout="book"] .story-column::after { content: ""; position: absolute; z-index: 3; top: 12px; right: -1px; bottom: 12px; width: 1px; background: linear-gradient(transparent, rgba(73,51,34,0.3) 15%, rgba(73,51,34,0.3) 85%, transparent); }
.play-view[data-layout="book"] .scene-header { align-items: flex-start; }
.play-view[data-layout="book"] .scene-header h1 { color: #2d211d; font-size: clamp(2.45rem, 4vw, 4.1rem); }
.play-view[data-layout="book"] .story-cast { border-color: #b7a98c; background: rgba(105, 79, 42, 0.05); }
.play-view[data-layout="book"] .story-cast-button { border-color: #c4b697; background: rgba(255,255,255,0.34); }
.play-view[data-layout="book"] .cast-drawer-copy h2 { color: #2d211d; }
.play-view[data-layout="book"] .cast-drawer-copy blockquote { color: #4a362d; }
.play-view[data-layout="book"] .cast-drawer-copy p { color: #6f5b4e; }
.play-view[data-layout="book"] .eyebrow,
.play-view[data-layout="book"] .action-kicker span,
.play-view[data-layout="book"] .fate-label { color: #175667; }
.play-view[data-layout="book"] .scene-progress { color: #7d7161; }
.play-view[data-layout="book"] .progress-track { background: #d3c3a7; }
.play-view[data-layout="book"] .progress-track div { background: #175667; }
.play-view[data-layout="book"] .narrative-card { padding: 18px 0 8px; border: 0; border-radius: 0; background: none; box-shadow: none; }
.play-view[data-layout="book"] .narrative-card::before { display: none; }
.play-view[data-layout="book"] .narrative-ornament { top: 3px; left: auto; right: 2px; color: rgba(23,86,103,0.28); }
.play-view[data-layout="book"] #narrative-copy p { max-width: 52ch; color: #382d27; font-size: clamp(1.08rem, 1.45vw, 1.28rem); line-height: 1.78; }
.play-view[data-layout="book"] .story-status-strip { display: flex; border-color: rgba(90,65,42,0.23); color: #7d6d5d; }
.play-view[data-layout="book"] .story-status-strip span:first-child,
.play-view[data-layout="book"] .story-status-strip strong { color: #4d3c33; }
.play-view[data-layout="book"] .action-kicker { color: #175667; }
.play-view[data-layout="book"] .action-kicker small { color: #8c7b69; }
.play-view[data-layout="book"] .fate-reveal { margin-top: 22px; border-color: #9c6b47; background: linear-gradient(90deg, rgba(23,86,103,0.08), transparent); }
.play-view[data-layout="book"] .fate-seal { border-color: #887143; color: #175667; }
.play-view[data-layout="book"] .fate-reveal p { color: #5f5045; }
.play-view[data-layout="book"] .choice-heading-row h2 { color: #2f2520; font-size: 1.55rem; }
.play-view[data-layout="book"] .choice-heading-row > span { color: #897968; }
.play-view[data-layout="book"] .choice-button { border-color: rgba(104,76,51,0.27); background: rgba(255,255,255,0.28); }
.play-view[data-layout="book"] .choice-button:hover { border-color: rgba(23,86,103,0.55); background: rgba(23,86,103,0.05); }
.play-view[data-layout="book"] .choice-glyph { border-color: #c0ab8b; color: #175667; }
.play-view[data-layout="book"] .choice-button strong { color: #3b2d27; }
.play-view[data-layout="book"] .choice-button small { color: #8a7767; }
.play-view[data-layout="book"] .choice-button > span:last-child { color: #9c856f; }
.play-view[data-layout="book"] .freeform-row { border-color: rgba(104,76,51,0.32); background: rgba(255,255,255,0.3); }
.play-view[data-layout="book"] .freeform-row input { color: #382d27; }
.play-view[data-layout="book"] .freeform-row input::placeholder { color: #998674; }
.play-view[data-layout="book"] .send-button { background: #175667; color: #fff4df; }
.play-view[data-layout="book"] .interpretation-note { color: #94816f; }
.play-view[data-layout="book"] .resolution-panel { border-color: rgba(23,86,103,0.35); background: rgba(23,86,103,0.06); box-shadow: none; }
.play-view[data-layout="book"] .resolution-topline { color: #175667; }
.play-view[data-layout="book"] .resolution-topline span:last-child,
.play-view[data-layout="book"] .dice-stage p { color: #786859; }
.play-view[data-layout="book"] .dice-stage h2,
.play-view[data-layout="book"] .resolution-result p { color: #382d27; }
.play-view[data-layout="book"] .resolution-result { border-color: rgba(104,76,51,0.24); }
.play-view[data-layout="book"] .narration-sentence.active-sentence { background: rgba(161,112,48,0.14); color: #382d27; }
.play-view[data-layout="book"] .narration-word.active-word { background: #d5ad4f; box-shadow: inset 0 -2px 0 #8b6728; color: #211711; }

/* Studio */
.studio-view { padding: 62px 0 90px; }
.studio-intro { max-width: 850px; margin-bottom: 42px; }
.studio-intro h1 { margin-bottom: 13px; font-size: clamp(2.7rem, 5.5vw, 5.4rem); }
.studio-intro > p { max-width: 68ch; color: #958980; font-family: var(--serif); }
.edition-stage { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: clamp(40px, 7vw, 100px); align-items: center; padding: 40px clamp(24px, 5vw, 68px); border: 1px solid var(--line); border-radius: 22px; background: radial-gradient(circle at 15% 10%, rgba(22,103,119,0.23), transparent 30rem), rgba(7,16,22,0.82); box-shadow: var(--shadow); }
.library-item.current { background: linear-gradient(150deg, rgba(24,111,126,0.25), rgba(5,16,23,0.94)); }
.mini-book { position: relative; aspect-ratio: 2/3; overflow: hidden; border: 1px solid rgba(216,182,106,0.5); border-radius: 3px 11px 11px 3px; box-shadow: -7px 5px 0 #2b2022, -8px 5px rgba(216,182,106,0.3), 0 27px 50px rgba(0,0,0,0.5); transform: rotate(-1.5deg); }
.mini-book img { width: 100%; height: 100%; object-fit: cover; }
.mini-book-scrim { position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.1) 38%, rgba(0,0,0,0.89)); }
.mini-book-copy { position: absolute; inset: 9%; display: flex; flex-direction: column; justify-content: flex-end; text-align: center; }
.mini-book-copy > span { margin-bottom: auto; color: #eee0c7; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.17em; }
.mini-book-copy h2 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 400; line-height: 0.92; }
.mini-book-copy p { margin: 9px 0 0; color: #e2cbb4; font-family: var(--serif); font-size: 0.69rem; font-style: italic; }
.mini-book-copy small { margin-top: 9px; color: var(--gold); font-size: 0.5rem; letter-spacing: 0.14em; }
.edition-summary { max-width: 690px; }
.edition-summary h2 { margin: 9px 0 15px; font-family: var(--serif); font-size: clamp(2.1rem, 4vw, 3.8rem); font-weight: 400; line-height: 1.03; letter-spacing: -0.04em; }
.edition-summary > p { color: #aa9e95; font-family: var(--serif); font-size: 0.95rem; line-height: 1.67; }
.ending-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 26px 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--line); }
.ending-stats div { padding: 13px; background: #191416; text-align: center; }
.ending-stats strong { display: block; color: var(--gold-bright); font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.ending-stats span { color: #746b65; font-size: 0.58rem; }
.edition-actions { display: flex; gap: 9px; }
.edition-preview-player { margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5,12,16,0.48); }
.edition-preview-transport { display: flex; align-items: center; gap: 8px; }
.edition-preview-transport button { min-width: 64px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.03); color: #d3c5bc; cursor: pointer; }
.edition-preview-transport button:disabled { opacity: .46; cursor: default; }
.edition-preview-transport span { margin-left: auto; color: #988a81; font-variant-numeric: tabular-nums; font-size: .66rem; }
.edition-preview-player input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--gold); }
.edition-preview-player p { margin: 7px 0 0; color: #9d9088; font-size: .66rem; }
.secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 9px; color: #d2c5bc; font-size: 0.73rem; }
.secondary-button svg { width: 15px; height: 15px; fill: var(--gold); }
.secondary-button.full { width: 100%; }
.studio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.studio-card { position: relative; min-height: 310px; padding: 25px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: rgba(23,17,19,0.72); }
.studio-card-number { position: absolute; right: 19px; top: 13px; color: rgba(216,182,106,0.18); font-family: var(--serif); font-size: 2rem; }
.studio-card-heading > span { color: var(--gold); font-size: 0.59rem; font-weight: 700; letter-spacing: 0.16em; }
.studio-card-heading h3 { max-width: 16ch; margin: 8px 0 13px; font-family: var(--serif); font-size: 1.5rem; font-weight: 400; line-height: 1.1; }
.studio-card > p { color: #847a73; font-size: 0.7rem; line-height: 1.55; }
.voice-card blockquote { margin: 18px 0 11px; color: #d9c8b9; font-family: var(--serif); font-size: 1rem; font-style: italic; }
.consent-line { display: flex; align-items: flex-start; gap: 7px; color: #8c8179; font-size: 0.64rem; cursor: pointer; }
.consent-line input { accent-color: var(--gold); }
.recording-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 15px; }
.record-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid rgba(161,50,72,0.55); border-radius: 999px; background: rgba(95,23,36,0.2); color: #d8a9b0; font-size: 0.66rem; cursor: pointer; }
.record-button i { width: 7px; height: 7px; border-radius: 50%; background: #db6077; }
.record-button.recording i { animation: pulse 700ms infinite; }
.recording-status, .play-cameo-button { color: #8e8179; font-size: 0.64rem; }
.recording-status { margin: 10px 0 0; line-height: 1.45; }
.play-cameo-button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer; }
.play-cameo-button.danger-text { color: #d79a9f; }
.review-preview { display: flex; flex-wrap: wrap; gap: 5px; margin: 22px 0; }
.review-preview span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 999px; color: #8b7f77; font-size: 0.57rem; }
.offer-list { margin: 24px 0 18px; }
.offer-list div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); color: #988c83; font-size: 0.69rem; }
.offer-list strong { color: var(--gold); font-weight: 500; }
.text-button { padding: 0; border: 0; color: #c4ad78; font-size: 0.68rem; }
.keepsake-actions { display: grid; gap: 12px; margin-top: 18px; }
.keepsake-actions .text-button { justify-self: start; }
.restart-row { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding: 16px 4px; border-top: 1px solid var(--line); }
.restart-row p { color: #786e68; font-family: var(--serif); font-style: italic; }

/* Dialogs */
.modal { width: min(760px, calc(100% - 28px)); max-height: min(86vh, 850px); padding: clamp(28px, 5vw, 56px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(145deg, #201719, #100d0e); box-shadow: 0 30px 100px #000; color: var(--ivory); }
.modal::backdrop { background: rgba(5,4,5,0.83); backdrop-filter: blur(9px); }
.modal-close { position: sticky; float: right; top: 0; z-index: 2; width: 33px; height: 33px; display: grid; place-items: center; margin: -20px -20px 0 0; border: 1px solid var(--line); border-radius: 50%; background: #21191b; color: #9a8d83; font-size: 1.2rem; cursor: pointer; }
.edition-modal h2, .consent-modal h2, .library-modal h2 { margin: 9px 0 20px; font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 400; line-height: 1.04; letter-spacing: -0.035em; }
.chapter-copy { padding: 25px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chapter-copy p { margin: 0 0 1.3em; color: #ded2c7; font-family: var(--serif); font-size: 1.02rem; line-height: 1.82; }
.chapter-copy p:first-child::first-letter { float: left; margin: 6px 8px 0 0; color: var(--gold); font-size: 3.6rem; line-height: .72; }
.chapter-footer { display: flex; justify-content: space-between; margin-top: 15px; color: #6e6560; font-size: 0.62rem; }
.consent-modal > div > p { color: #92867e; font-size: 0.76rem; }
.permission-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.permission-row input { margin-top: 3px; accent-color: var(--gold); }
.permission-row strong, .permission-row small { display: block; }
.permission-row strong { color: #d8cbc2; font-family: var(--serif); font-size: 0.86rem; font-weight: 400; }
.permission-row small { margin-top: 3px; color: #766d67; font-size: 0.62rem; line-height: 1.45; }
.required-permission { border-color: rgba(216,182,106,0.34); }
.synthetic-lock { margin: 14px 0; padding: 12px 14px; border-left: 2px solid #4b3e40; background: rgba(255,255,255,0.025); }
.synthetic-lock span { color: #756b65; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.13em; }
.synthetic-lock p { margin: 4px 0 0; color: #716863; font-size: 0.65rem; }
.consent-modal select { width: 100%; height: 43px; margin-bottom: 5px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #181214; color: var(--ivory); }
.evaluation-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.evaluation-head h2 { margin-bottom: 8px; }
.score-ring { width: 88px; height: 88px; flex: 0 0 auto; display: grid; place-content: center; border: 2px solid var(--gold); border-radius: 50%; text-align: center; box-shadow: inset 0 0 20px rgba(216,182,106,0.08); }
.score-ring strong { font-family: var(--serif); font-size: 2rem; font-weight: 400; line-height: 1; }
.score-ring span { color: #756b64; font-size: 0.56rem; }
.gate-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.gate-row span { padding: 6px 8px; border-radius: 999px; background: rgba(115,152,111,0.11); color: #a8c8a5; font-size: 0.6rem; }
.score-list { display: grid; gap: 9px; margin: 23px 0; }
.score-item { display: grid; grid-template-columns: 105px 1fr 32px; align-items: center; gap: 10px; color: #a89b92; font-size: 0.67rem; }
.score-item > div { height: 4px; overflow: hidden; border-radius: 5px; background: #342b2c; }
.score-item i { display: block; height: 100%; background: linear-gradient(90deg, var(--wine-bright), var(--gold)); }
.score-item strong { color: #d4c6bc; font-weight: 500; text-align: right; }
.evaluation-callout { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(216,182,106,0.04); }
.evaluation-callout strong { color: var(--gold); font-size: 0.68rem; }
.evaluation-callout p { margin: 4px 0 0; color: #92867f; font-size: 0.69rem; }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.library-heading h2 { margin-bottom: 0; }
.library-heading > p { max-width: 25ch; color: #877b73; font-family: var(--serif); font-style: italic; }
.library-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 30px; }
.library-item { min-height: 290px; display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(160deg, transparent 20%, rgba(0,0,0,0.88)), radial-gradient(circle at 70% 20%, #6d253a, #171015 70%); }
.library-item.stars { background: linear-gradient(160deg, transparent 20%, rgba(0,0,0,0.88)), radial-gradient(circle at 70% 20%, #2d6070, #11151d 70%); }
.library-item.ember { background: linear-gradient(160deg, transparent 20%, rgba(0,0,0,0.9)), url("assets/last-ember-mountain-cover.webp") center 42% / cover; }
.library-item.unbroken { background: linear-gradient(160deg, transparent 20%, rgba(0,0,0,0.9)), url("assets/unbroken-cover.webp") center 42% / cover; }
.library-item[type="button"] { color: inherit; text-align: left; cursor: pointer; }
.library-item[type="button"]:hover, .library-item[type="button"]:focus-visible { border-color: var(--gold-dark); transform: translateY(-2px); }
.library-item.tea { background: linear-gradient(160deg, transparent 20%, rgba(0,0,0,0.8)), radial-gradient(circle at 70% 20%, #6a6335, #171810 70%); }
.library-item > span { color: var(--gold); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.1em; }
.library-item h3 { margin: 7px 0 8px; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; line-height: 1; }
.library-item p { color: #ad9f95; font-family: var(--serif); font-size: 0.72rem; }
.library-item small { margin-top: auto; padding-top: 35px; color: #766b65; font-size: 0.55rem; }
.licensed-note { display: flex; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; font-size: 0.67rem; }
.licensed-note strong { color: var(--gold); }
.licensed-note span { color: #81766f; }

.ledger-modal { width: min(680px, calc(100% - 28px)); }
.ledger-modal-heading, .voice-modal-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.ledger-modal-heading h2, .voice-modal-heading h2 { margin: 7px 0 0; font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 400; line-height: 1; }
.ledger-modal-heading > strong { color: var(--gold); font-family: var(--serif); font-size: 0.88rem; font-weight: 400; }
.ledger-explainer { max-width: 64ch; margin: 18px 0 20px; color: #8d8179; font-family: var(--serif); font-size: 0.83rem; line-height: 1.6; }
.ledger-card-dialog { max-height: min(54vh, 510px); overflow: auto; }
.ledger-card-dialog ol { margin: 0; padding: 0 0 0 22px; }
.ledger-card-dialog li { padding: 0 0 13px 6px; color: #958982; font-family: var(--serif); font-size: 0.82rem; line-height: 1.45; }
.ledger-card-dialog li::marker { color: var(--gold-dark); }
.ledger-card-dialog li:first-child { color: #d2c4b9; }

.voice-modal { width: min(720px, calc(100% - 28px)); }
.voice-status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: #9e928a; font-size: 0.65rem; white-space: nowrap; }
.voice-status i { width: 7px; height: 7px; border-radius: 50%; background: #947e6f; }
.voice-status.connected { color: #b7d1b2; }
.voice-status.connected i { background: #8fbc87; box-shadow: 0 0 9px rgba(143,188,135,0.8); }
.voice-intro { max-width: 67ch; margin: 19px 0 23px; color: #968981; font-family: var(--serif); font-size: 0.86rem; line-height: 1.58; }
.voice-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.voice-field { display: grid; gap: 7px; color: #a99b91; font-size: 0.68rem; }
.voice-field-wide { grid-column: 1 / -1; }
.voice-field select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #181214; color: var(--ivory); }
.voice-field select:focus { border-color: var(--gold-dark); }
.voice-field select:disabled { opacity: 0.52; }
.voice-sample-card { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: rgba(216,182,106,0.04); }
.voice-sample-card > span { color: var(--gold); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.14em; }
.voice-sample-card blockquote { margin: 10px 0 17px; color: #ddd0c5; font-family: var(--serif); font-size: 1.06rem; font-style: italic; line-height: 1.55; }
.voice-security-note { display: flex; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 13px 15px; border: 1px solid rgba(113,143,113,0.22); border-radius: 10px; background: rgba(113,143,113,0.045); font-size: 0.64rem; }
.voice-security-note strong { color: #b5c9b1; }
.voice-security-note span { max-width: 34ch; color: #776e68; text-align: right; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 20; transform: translate(-50%, 25px); padding: 10px 15px; border: 1px solid var(--line-strong); border-radius: 999px; background: #21191b; box-shadow: var(--shadow); color: #dacec4; font-size: 0.69rem; opacity: 0; pointer-events: none; transition: all 220ms ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1240px) {
  .play-view { grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); }
  .character-column { display: none; }
  .story-status-strip { display: flex; }
}

@media (max-width: 980px) {
  .site-header { width: min(100% - 28px, 1500px); }
  #app-shell { width: min(100% - 28px, 1500px); }
  .setup-view { grid-template-columns: minmax(280px, .8fr) minmax(400px, 1.2fr); gap: 44px; }
  .play-view { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
  .play-view[data-layout="book"] { grid-template-columns: minmax(0, 1fr) 340px; }
  .privacy-badge { display: none; }
  .header-actions { gap: 8px; }
  .studio-grid { grid-template-columns: 1fr 1fr; }
  .commerce-card { grid-column: 1 / -1; min-height: auto; }
}

@media (max-width: 760px) {
  .site-header { width: min(100% - 28px, 1320px); height: 66px; }
  .privacy-badge, #library-button, .ledger-header-button { display: none; }
  .wordmark { font-size: 0.69rem; }
  #app-shell { width: min(100% - 28px, 1320px); }
  .view { min-height: calc(100vh - 66px); }
  .setup-view { display: block; padding: 30px 0 55px; }
  .module-cover-wrap { width: min(78vw, 330px); margin: 0 auto 48px; }
  .setup-panel { margin: 0 auto; }
  .module-selector { margin-bottom: 34px; }
  .setup-panel h2 { font-size: 2.65rem; }
  .trope-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr 1fr; }
  .trope-option span { min-height: 58px; }
  .play-view, .play-view[data-layout="book"] { width: 100%; height: auto; min-height: calc(100dvh - 66px); display: flex; flex-direction: column; gap: 12px; padding: 24px 0 58px; overflow: visible; }
  .character-column { display: none; }
  .story-column, .action-column { width: 100%; }
  .scene-header { align-items: flex-start; }
  .scene-header h1 { font-size: 2.45rem; }
  .scene-progress { width: 78px; padding-top: 4px; }
  .narrative-card { min-height: 0; padding: 32px 25px; }
  #narrative-copy p { font-size: 1.04rem; }
  .action-column { overflow: visible; }
  .story-cast { align-items: stretch; }
  .story-cast-heading { align-content: center; }
  .cast-drawer { position: fixed; inset: 66px 0 0; z-index: 80; height: auto; padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); overflow: auto; background: #120f10; }
  .cast-drawer > img { width: min(100%, 430px); max-height: 64vh; margin-inline: auto; flex: 0 0 auto; aspect-ratio: 2 / 3; }
  .cast-drawer-copy { width: min(100%, 430px); margin-inline: auto; }
  .cast-drawer-close { position: sticky; top: 0; z-index: 2; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #21191b; }
  .play-view[data-layout="book"] .cast-drawer { background: #f4e8d2; }
  .cast-card-modal { width: calc(100vw - 16px); height: calc(100dvh - 16px); padding: 54px 12px 14px; }
  .cast-card-modal-close { top: 10px; right: 10px; }
  .cast-card-modal-layout { display: flex; flex-direction: column; gap: 18px; overflow: auto; }
  .cast-card-modal-art { flex: 0 0 auto; width: 100%; height: min(64dvh, 660px); }
  .cast-card-modal-art img { max-height: 100%; }
  .cast-card-modal-copy { width: min(100%, 430px); max-width: none; padding: 0 8px 24px; }
  .cast-card-modal-copy h2 { font-size: clamp(2rem, 10vw, 3.2rem); }
  .cast-card-modal-copy blockquote { font-size: 1.16rem; }
  .cast-card-modal-copy p { font-size: 1rem; }
  .story-status-strip { flex-wrap: wrap; gap: 6px 13px; height: auto; padding-block: 8px; border-radius: 12px; }
  .story-status-strip span:first-child { width: 100%; margin-right: 0; }
  .narration-controls { grid-template-columns: auto auto 1fr; }
  .narration-controls #narration-progress { grid-column: 1 / -1; grid-row: 2; }
  .narration-controls #narration-playback-status { grid-column: 1 / -1; }
  .play-view[data-layout="book"] .story-column,
  .play-view[data-layout="book"] .action-column { height: auto; padding: 31px 25px; border: 1px solid #b7a98c; border-radius: 7px; }
  .play-view[data-layout="book"] .story-column::after { display: none; }
  .play-view[data-layout="book"] .action-column { border-top: 0; margin-top: -19px; padding-top: 42px; box-shadow: 0 22px 45px rgba(0,0,0,0.38); }
  .choice-button { grid-template-columns: 33px 1fr 15px; }
  .interpretation-note { line-height: 1.4; }
  .edition-stage { grid-template-columns: 1fr; }
  .mini-book { width: min(72vw, 270px); justify-self: center; }
  .studio-grid { grid-template-columns: 1fr; }
  .commerce-card { grid-column: auto; }
  .studio-card { min-height: 0; }
  .edition-actions { flex-direction: column; }
  .primary-button.compact { width: 100%; }
  .ending-stats { grid-template-columns: repeat(2, 1fr); }
  .library-heading { display: block; }
  .library-grid { grid-template-columns: 1fr; }
  .library-item { min-height: 230px; }
  .licensed-note { flex-direction: column; }
  .voice-form-grid { grid-template-columns: 1fr; }
  .voice-field-wide { grid-column: auto; }
  .voice-security-note { flex-direction: column; }
  .voice-security-note span { max-width: none; text-align: left; }
}

@media (max-width: 430px) {
  .header-actions { gap: 5px; }
  .icon-button span { display: none; }
  .icon-button { width: 38px; justify-content: center; }
  .layout-option { min-width: 46px; padding-inline: 8px; }
  .module-cover-wrap { width: min(82vw, 315px); }
  .module-meta { flex-wrap: wrap; }
  .module-selector { grid-template-columns: 1fr; }
  .segmented-control span { padding-inline: 2px; font-size: 0.62rem; }
  .role-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column; }
  .scene-header h1 { font-size: 2.15rem; }
  .story-cast { gap: 7px; padding-inline: 6px; }
  .story-cast-heading { flex-basis: 62px; }
  .choice-heading-row > span { display: none; }
  .dice-stage { align-items: flex-start; }
  .modal { padding: 35px 21px; }
  .modal-close { margin: -22px -7px 0 0; }
  .evaluation-head { align-items: flex-start; }
  .score-ring { width: 74px; height: 74px; }
  .score-item { grid-template-columns: 87px 1fr 28px; }
}

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

/* Compact audiobook transport: keeps reading space primary. */
.narration-controls { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 7px 10px; border: 1px solid #766651; border-radius: 12px; background: #10272e; color: #f8efde; font-size: .8125rem; position: sticky; bottom: 12px; z-index: 4; box-shadow: 0 8px 24px rgba(3, 12, 15, .18); }
.audio-player-timeline { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 90px; }
.audio-player-timeline input { flex: 1; min-width: 42px; }
.audio-player-timeline span { font-variant-numeric: tabular-nums; min-width: 2.7em; color: #d8cbb5; font-size: .75rem; }
.audio-player-timeline span:last-child { text-align: right; }
.audio-player-buttons, .audio-player-options { display: flex; align-items: center; gap: 6px; width: auto; }
.narration-controls button, .narration-controls select { min-height: 32px; padding: 5px 8px; color: #fff4dd; background: #19373e; border: 1px solid #807157; border-radius: 8px; font: inherit; cursor: pointer; }
.narration-controls .audio-primary { display: grid; place-items: center; min-width: 34px; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: #dfc18b; color: #172b31; border-color: #dfc18b; font-size: .9rem; font-weight: 800; line-height: 1; }
.narration-controls button:disabled { opacity: .55; cursor: default; }
.audio-speed select { min-width: 54px; padding-inline: 6px; font-variant-numeric: tabular-nums; }
.audio-player-more { position: relative; }
.audio-player-more summary { display: grid; place-items: center; min-width: 32px; height: 32px; list-style: none; color: #fff4dd; background: #19373e; border: 1px solid #807157; border-radius: 8px; cursor: pointer; letter-spacing: 1px; }
.audio-player-more summary::-webkit-details-marker { display: none; }
.audio-player-menu { position: absolute; right: 0; bottom: calc(100% + 8px); display: grid; gap: 4px; width: max-content; min-width: 154px; padding: 7px; border: 1px solid #807157; border-radius: 10px; background: #10272e; box-shadow: 0 12px 28px rgba(3, 12, 15, .32); }
.audio-player-menu button { width: 100%; text-align: left; }
@media(max-width: 600px) { .narration-controls { gap: 6px; padding: 7px; bottom: 6px; } .audio-player-timeline span { display: none; } .audio-player-timeline { min-width: 44px; } .audio-player-buttons { gap: 4px; } .narration-controls button, .narration-controls select { padding-inline: 6px; } }
.wordmark-sigil{width:42px;height:42px;color:var(--gold);flex:0 0 auto}

/* Scalable Adventure Library */
.catalog-view{width:min(1420px,100%);margin-inline:auto;padding:24px 0 70px}
.catalog-intro{display:grid;grid-template-columns:minmax(350px,.82fr) minmax(500px,1.18fr);gap:38px;align-items:end;margin-bottom:18px}
.catalog-intro>div:first-child>span,.catalog-journeys>div>span{color:var(--gold);font-size:.67rem;font-weight:750;letter-spacing:.24em}
.catalog-intro h1{margin:6px 0 4px;font:400 clamp(3rem,4.4vw,4.7rem)/.86 var(--serif);letter-spacing:-.055em}
.catalog-intro p{margin:12px 0 0;color:#c5d2d1;font:400 1.02rem var(--sans)}
.catalog-tools{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;position:relative}
.catalog-search{height:51px;display:flex;align-items:center;gap:10px;padding:0 15px;border:1px solid var(--line-strong);border-radius:11px;background:rgba(3,14,19,.76);color:var(--gold)}
.catalog-search span{font-size:1.45rem;line-height:0}.catalog-search input{width:100%;border:0;outline:0;background:none;color:var(--ivory);font:inherit}.catalog-search input::placeholder{color:#78868a}
.catalog-filters{position:relative}.catalog-filters summary{height:51px;display:flex;align-items:center;padding:0 18px;border:1px solid var(--gold-dark);border-radius:11px;color:#efe1c7;cursor:pointer;list-style:none}.catalog-filters summary::before{content:"☷";margin-right:9px;color:var(--gold);font-size:1.1rem}
.filter-panel{position:absolute;right:0;top:60px;z-index:12;width:360px;display:grid;grid-template-columns:1fr 1fr;gap:20px;padding:22px;border:1px solid var(--gold-dark);border-radius:12px;background:#07171d;box-shadow:0 28px 70px rgba(0,0,0,.6)}
.filter-panel>div{display:grid;align-content:start;gap:8px}.filter-panel strong{margin:4px 0;color:#eadbbd;font-size:.72rem}.filter-panel label,.filter-panel span{color:#a7b5b4;font-size:.68rem}.filter-panel input{accent-color:var(--gold)}
.catalog-chips{grid-column:1/-1;display:flex;gap:7px;flex-wrap:wrap;margin-top:5px}.catalog-chips button{padding:7px 14px;border:1px solid var(--line-strong);border-radius:999px;background:#091a20;color:#afbcba;cursor:pointer}.catalog-chips button.active,.catalog-chips button:hover{border-color:#e0bd73;background:linear-gradient(135deg,#d5ad61,#f0d68f);color:#172027}
.catalog-feature{height:clamp(390px,36vw,500px);min-height:390px;position:relative;overflow:hidden;border:1px solid rgba(216,182,106,.5);border-radius:4px;background:#081820}.catalog-feature>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:57% 24%}.catalog-feature-scrim{position:absolute;inset:0;background:linear-gradient(90deg,rgba(4,15,20,.98) 0%,rgba(4,15,20,.84) 38%,rgba(4,15,20,.16) 70%),linear-gradient(0deg,rgba(4,15,20,.72),transparent 45%)}
.catalog-feature-copy{position:absolute;left:clamp(25px,4vw,60px);top:50%;width:min(620px,52%);transform:translateY(-50%)}.catalog-feature-copy>span{display:inline-block;padding:6px 14px;border:1px solid var(--gold);border-radius:999px;color:#f0d58f;font-size:.61rem;letter-spacing:.2em}.catalog-meta{margin:12px 0;color:#e0c99b;font-size:.64rem;letter-spacing:.14em}.catalog-meta i{display:inline-block;width:1px;height:12px;margin:0 10px;background:rgba(216,182,106,.5);vertical-align:middle}.catalog-feature h2{margin:0;font:400 clamp(2.65rem,4.4vw,4.4rem)/.94 var(--serif);letter-spacing:-.05em}.catalog-feature p{max-width:54ch;margin:13px 0 18px;color:#d3dcda;line-height:1.5}
.catalog-primary,.catalog-secondary{min-height:48px;padding:0 22px;border-radius:9px;font-weight:800;cursor:pointer}.catalog-primary{border:1px solid #efd48d;background:linear-gradient(135deg,#b8893f,#efd48d 55%,#b38137);color:#16130e}.catalog-secondary{margin-left:8px;border:1px solid rgba(216,182,106,.6);background:rgba(4,15,20,.55);color:#eee8dc}
.catalog-section{padding:58px 0 0}.catalog-section-head{display:flex;align-items:center;gap:22px;margin-bottom:22px}.catalog-section-head::after{content:"";height:1px;flex:1;background:linear-gradient(90deg,rgba(216,182,106,.7),transparent)}.catalog-section-head h2{margin:0;font:400 clamp(2.1rem,3.5vw,3.2rem)/1 var(--serif)}.catalog-section-head>span{order:3;color:#acb7b5;font-size:.68rem}
.catalog-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.catalog-card{min-width:0;padding:0;overflow:hidden;border:1px solid rgba(216,182,106,.42);border-radius:5px;background:#081820;color:inherit;text-align:left;cursor:pointer;transition:transform .25s ease,border-color .25s ease}.catalog-card:hover{transform:translateY(-4px);border-color:#e0bd73}.catalog-card-art{height:360px;display:block;overflow:hidden}.catalog-card-art img{width:100%;height:100%;display:block;object-fit:cover;object-position:center 22%;transition:transform .6s ease}.catalog-card:hover img{transform:scale(1.035)}.catalog-card-copy{min-height:128px;position:relative;display:grid;gap:6px;padding:18px 62px 18px 18px}.catalog-card-copy strong{font:400 clamp(1.35rem,2vw,2rem)/1.05 var(--serif)}.catalog-card-copy small{color:#d1d9d7}.catalog-card-copy em{color:#8fa09f;font-size:.64rem;font-style:normal}.catalog-card-copy i{position:absolute;right:18px;top:38px;width:38px;height:38px;display:grid;place-items:center;border:1px solid var(--gold);border-radius:50%;color:var(--gold);font-style:normal}.catalog-empty{padding:35px;border:1px dashed var(--line-strong);color:var(--muted);text-align:center}
.mood-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.mood-grid button{min-height:260px;display:flex;flex-direction:column;justify-content:flex-end;padding:20px;border:1px solid rgba(216,182,106,.42);border-radius:5px;color:#fff;text-align:left;cursor:pointer;background-image:linear-gradient(0deg,rgba(5,15,19,.96),rgba(5,15,19,.08)),url("assets/seventh-current-cover.webp");background-size:cover;background-position:center 46%}.mood-grid button[data-mood="bonds"]{background-image:linear-gradient(0deg,rgba(5,15,19,.96),rgba(5,15,19,.08)),url("assets/last-ember-mountain-cover.webp");background-position:center 18%}.mood-grid button[data-mood="mystery"]{background-image:linear-gradient(0deg,rgba(5,15,19,.96),rgba(5,15,19,.08)),url("assets/unbroken-card-calder.webp");background-position:center top}.mood-grid button[data-mood="romantic"]{background-image:linear-gradient(0deg,rgba(5,15,19,.96),rgba(5,15,19,.08)),url("assets/unbroken-cover.webp");background-position:center 24%}.mood-grid span{font:400 1.55rem var(--serif)}.mood-grid small{margin-top:4px;color:#c0cdca}
.catalog-journeys{margin-top:58px;display:grid;grid-template-columns:auto 1fr auto;gap:28px;align-items:center;padding:32px;border:1px solid rgba(216,182,106,.42);border-radius:5px;background:radial-gradient(circle at 25%,rgba(34,86,98,.28),transparent 34%),#07171d}.journey-seal{width:84px;height:84px;display:grid;place-items:center;border:1px solid rgba(216,182,106,.45);border-radius:50%;color:var(--gold);font-size:2.4rem}.catalog-journeys h2{margin:5px 0;font:400 2rem var(--serif)}.catalog-journeys p{margin:0;color:#9eaeac;font-size:.72rem}.catalog-back{margin-bottom:20px;padding:0;border:0;background:none;color:var(--gold);cursor:pointer}
@media(max-width:980px){.catalog-intro{grid-template-columns:1fr 1fr;gap:24px}.catalog-intro h1{font-size:clamp(3rem,6vw,4.35rem)}.catalog-feature{height:500px}.catalog-feature-copy{width:min(620px,68%)}.catalog-feature-scrim{background:linear-gradient(90deg,rgba(4,15,20,.98),rgba(4,15,20,.7) 60%,rgba(4,15,20,.12)),linear-gradient(0deg,rgba(4,15,20,.72),transparent 48%)}.catalog-grid{grid-template-columns:1fr 1fr}.catalog-card:last-child{grid-column:1/-1}.mood-grid{grid-template-columns:1fr 1fr}}
@media(max-width:760px){.catalog-view{padding:18px 0 56px}.catalog-intro{display:block;margin-bottom:14px}.catalog-intro>div:first-child>span{font-size:.58rem}.catalog-intro h1{font-size:2.8rem;line-height:.9}.catalog-intro p{margin-top:8px;font-size:.9rem}.catalog-tools{grid-template-columns:minmax(0,1fr) auto;margin-top:14px}.catalog-search,.catalog-filters summary{height:46px}.catalog-filters summary{justify-content:center;padding-inline:14px}.filter-panel{position:absolute;width:min(360px,calc(100vw - 32px));margin-top:0}.catalog-chips{flex-wrap:nowrap;overflow-x:auto;padding-bottom:3px;scrollbar-width:none}.catalog-chips::-webkit-scrollbar{display:none}.catalog-chips button{flex:0 0 auto;padding:6px 12px}.catalog-feature{height:470px;min-height:470px;margin-top:0}.catalog-feature>img{object-position:65% 18%}.catalog-feature-copy{left:18px;right:18px;top:auto;bottom:20px;width:auto;transform:none}.catalog-feature h2{font-size:2.65rem}.catalog-feature p{font-size:.8rem;margin-block:10px 14px}.catalog-grid{grid-template-columns:1fr}.catalog-card:last-child{grid-column:auto}.catalog-card-art{height:390px}.mood-grid{grid-template-columns:1fr 1fr}.catalog-journeys{grid-template-columns:auto 1fr}.catalog-journeys .catalog-primary{grid-column:1/-1;width:100%}}
@media(max-width:430px){.catalog-view{padding-top:14px}.catalog-intro h1{font-size:2.45rem}.catalog-intro p{font-size:.84rem}.catalog-tools{margin-top:11px}.catalog-search{height:43px}.catalog-filters summary{height:43px;font-size:0}.catalog-filters summary::before{margin:0}.catalog-feature{height:430px;min-height:430px}.catalog-feature h2{font-size:2.2rem}.catalog-meta{margin:8px 0;line-height:1.55}.catalog-feature-copy>span{padding:4px 10px}.catalog-feature p{display:none}.catalog-secondary{margin-left:5px}.catalog-primary,.catalog-secondary{min-height:44px;padding-inline:14px}.catalog-card-art{height:330px}.mood-grid{grid-template-columns:1fr}.catalog-journeys{grid-template-columns:1fr}.journey-seal{width:64px;height:64px}}

/* v0.7.7 — E1 cinematic system across library, setup, and play. */
.site-header{position:relative;z-index:12;background:linear-gradient(180deg,rgba(3,13,18,.82),rgba(3,13,18,.2));backdrop-filter:blur(14px);border-color:rgba(214,177,110,.24)}
.wordmark-sigil{filter:drop-shadow(0 0 18px rgba(216,182,106,.2))}.wordmark span{letter-spacing:.22em}.icon-button,.quiet-button,.layout-switch{background:rgba(5,18,23,.62);backdrop-filter:blur(10px)}
.setup-view{position:relative;isolation:isolate;align-items:start;padding-top:58px}.setup-view:before{content:"";position:absolute;z-index:-2;inset:0 calc(50% - 50vw);background:radial-gradient(circle at 15% 26%,rgba(40,115,128,.2),transparent 31rem),radial-gradient(circle at 88% 18%,rgba(194,145,74,.12),transparent 28rem)}
.setup-view:after{content:"";position:absolute;z-index:-1;top:4%;right:-8%;width:min(42vw,560px);aspect-ratio:1;background:url("assets/rpg-studio-oath-sigil.svg") center/contain no-repeat;opacity:.035;pointer-events:none}
.module-cover{border-color:rgba(224,189,115,.58);box-shadow:-18px 20px 0 rgba(27,50,57,.7),0 42px 95px rgba(0,0,0,.5)}
.setup-panel{padding:clamp(24px,3vw,42px);border:1px solid rgba(216,182,106,.24);background:linear-gradient(145deg,rgba(10,31,39,.88),rgba(4,15,20,.7));box-shadow:0 34px 90px rgba(0,0,0,.24);backdrop-filter:blur(12px)}
.setup-panel h2{text-wrap:balance;letter-spacing:-.045em}.module-selector{gap:8px}.module-option span,.role-card,.trope-option span{transition:transform .22s ease,border-color .22s ease,background .22s ease}.module-option:hover span,.role-option:hover .role-card,.trope-option:hover span{transform:translateY(-2px);border-color:rgba(224,189,115,.72)}
.play-view{position:relative}.play-view:before{content:"";position:absolute;z-index:-1;inset:-14px;background:radial-gradient(circle at 50% 0,rgba(48,112,125,.14),transparent 42rem);pointer-events:none}.state-card,.resource-card,.story-column,.action-column{border-color:rgba(216,182,106,.24);box-shadow:0 22px 55px rgba(0,0,0,.2)}
.story-column{background:linear-gradient(155deg,rgba(10,31,39,.94),rgba(5,17,22,.96))}.action-column{background:linear-gradient(180deg,rgba(15,33,39,.96),rgba(7,20,26,.98))}.narrative-card{border-color:rgba(216,182,106,.2);background:linear-gradient(145deg,rgba(6,23,29,.7),rgba(5,16,21,.45))}.choice-button{transition:transform .22s ease,border-color .22s ease,background .22s ease,box-shadow .22s ease}.choice-button:hover{box-shadow:0 12px 32px rgba(0,0,0,.22)}
.studio-view{position:relative}.studio-view:before{content:"";position:absolute;z-index:-1;top:0;right:-9%;width:min(48vw,650px);height:520px;background:url("assets/unbroken-card-ilyan.webp") 50% 18%/cover no-repeat;opacity:.065;mask-image:linear-gradient(90deg,transparent,#000 35%,transparent 92%);pointer-events:none}
@media(max-width:760px){.setup-panel{padding:24px 18px}.setup-view:after{width:82vw;right:-30%}.site-header{position:sticky;top:0}}
