:root {
  --ink: #eee7da;
  --muted: #aaa093;
  --night: #14110f;
  --panel: #1d1815;
  --panel-strong: #29211c;
  --line: #493b32;
  --moss: #b29a79;
  --moss-bright: #d2b991;
  --danger: #df9587;
  --radius: 4px;
  --adventure-sidebar-width: clamp(15rem, 19vw, 18rem);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--night);
}

* { box-sizing: border-box; }

body {
  /* Resolve these where room palettes override the base colors. */
  --control-line: color-mix(in srgb, var(--muted) 80%, var(--night));
  --inset: color-mix(in srgb, var(--night) 92%, transparent);
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  transition: background-color 420ms ease, color 420ms ease;
}

.account-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0;
  padding: .75rem 1rem;
  color: var(--muted);
  font-size: .75rem;
}
.account-bar > div { display: grid; min-width: 0; max-width: 100%; overflow-wrap: anywhere; text-align: right; }
.account-bar strong { color: var(--ink); }
.account-bar .quiet { padding: .38rem .65rem; text-decoration: none; }
.account-bar a.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  font-size: .82rem;
  font-weight: 600;
}
.account-bar a.quiet:hover { filter: brightness(1.08); }
.account-games { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.account-games h3 { margin: 0 0 .55rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.profile-dialog {
  width: min(70rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid rgba(194, 174, 153, .32);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 97%, #080604);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .78);
}
.profile-dialog::backdrop { background: rgba(7, 5, 4, .82); backdrop-filter: blur(8px); }
.profile-shell { display: grid; max-height: calc(100vh - 2rem); grid-template-rows: auto 1fr; }
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--line);
}
.profile-header h2 { margin: .18rem 0 0; font: 500 1.65rem/1.2 Georgia, "Times New Roman", serif; }
.profile-content { display: grid; grid-template-columns: minmax(15rem, 18rem) 1fr; min-height: 0; overflow: auto; }
.profile-summary { padding: 1.35rem; border-right: 1px solid var(--line); background: rgba(10, 8, 7, .3); }
.profile-identity { display: grid; gap: .2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.profile-identity strong { color: var(--ink); font: 500 1.25rem/1.2 Georgia, "Times New Roman", serif; }
.profile-identity span { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; }
.profile-balance { display: grid; gap: .35rem; padding: 1.2rem 0; }
.profile-balance strong { color: var(--moss-bright); font: 500 1.7rem/1.15 Georgia, "Times New Roman", serif; }
.profile-balance > span { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.gift-key-form { display: grid; gap: .35rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.gift-key-form label { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.gift-key-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.gift-key-form input { min-width: 0; margin: .5rem 0 0; border-radius: 6px 0 0 6px; }
.gift-key-form button { border-radius: 0 6px 6px 0; }
.gift-key-message { min-height: 1rem; margin: 0; color: var(--muted); font-size: .68rem; }
.gift-key-message.error { color: var(--danger); }
.credit-store { padding: clamp(1.35rem, 3vw, 2.2rem); }
.credit-store-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.credit-store-heading h3 { margin: .18rem 0 0; font: 500 1.8rem/1.2 Georgia, "Times New Roman", serif; }
.checkout-preview {
  padding: .35rem .55rem;
  color: var(--moss-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.credit-store-lede { max-width: 62ch; margin: .7rem 0 1.25rem; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.store-section { display: grid; gap: .75rem; }
.store-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.store-section-heading h4 { margin: .18rem 0 0; font: 500 1.2rem/1.2 Georgia, "Times New Roman", serif; }
.membership-note {
  padding: .3rem .5rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.top-up-section { margin-top: 1.35rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.credit-packages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.subscription-packages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.credit-package {
  display: grid;
  align-content: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 8, 7, .42);
}
.credit-package.featured { border-color: var(--moss); background: rgba(178, 154, 121, .08); }
.credit-package-kicker { margin: 0 0 .4rem; color: var(--moss); font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.credit-package h4 { margin: 0; font: 500 1.3rem/1.2 Georgia, "Times New Roman", serif; }
.credit-package-price { margin: .75rem 0 .2rem; color: var(--ink); font-size: 1.45rem; }
.credit-package-price small { color: var(--muted); font-size: .65rem; font-weight: 500; }
.credit-package p:not(.credit-package-kicker) { margin: .12rem 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.credit-package .credit-package-time { min-height: 2.1rem; margin: .6rem 0 .9rem; color: var(--moss-bright); }
.credit-package button { align-self: end; width: 100%; margin-top: auto; padding: .65rem; }
.membership-terms { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.store-note { margin: 1rem 0 .45rem; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.account-game-list { display: grid; gap: .45rem; }
.account-game {
  display: grid;
  gap: .18rem;
  width: 100%;
  padding: .65rem;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(12, 10, 9, .52);
}
.account-game strong { color: var(--ink); }
.account-game small { color: var(--muted); }
.account-game[data-status="active"] { border-color: var(--moss); }
.save-status { color: var(--muted); font-size: .7rem; }
.save-status.saved { color: #a9c992; }
.save-status.failed, .save-status.unsaved { color: var(--danger); }

.scene-stage {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: var(--night);
  pointer-events: none;
}

.scene-layer {
  position: absolute;
  inset: -1.5rem;
  background-position: center;
  background-size: cover;
  filter: sepia(.08) saturate(.68) contrast(1.06) brightness(.86);
  opacity: 0;
  transform: scale(1.045);
  animation: scene-drift 48s ease-in-out infinite alternate;
  transition: filter 700ms ease, opacity 900ms ease;
}

.scene-layer:first-child { background-image: url("/images/harrow-keep.jpg"); }
.scene-layer-active { opacity: 1; }

.scene-shade,
.scene-ambience {
  position: absolute;
  inset: 0;
}

.scene-shade {
  background:
    radial-gradient(circle at 50% 30%, rgba(43, 32, 23, .12), rgba(15, 11, 9, .5) 62%),
    linear-gradient(180deg, rgba(15, 11, 9, .28), rgba(13, 9, 7, .76));
  transition: background 500ms ease;
}

.scene-ambience { overflow: hidden; opacity: 0; pointer-events: none; transition: opacity 700ms ease; }

body.room-active .scene-layer {
  filter: blur(8px) saturate(.92) contrast(1.02);
}

body.room-active .scene-shade {
  background:
    radial-gradient(circle at 50% 35%,
      color-mix(in srgb, var(--panel-strong) 18%, transparent), transparent 62%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--night) 46%, transparent),
      color-mix(in srgb, var(--night) 74%, transparent));
}

/* Individual particles are rendered without repeating texture tiles. */
.scene-ambience.ambience-enabled { opacity: 1; }
.scene-ambience canvas { display: block; width: 100%; height: 100%; }

@keyframes scene-drift {
  from { transform: scale(1.045) translate3d(-.3%, -.15%, 0); }
  to { transform: scale(1.075) translate3d(.35%, .2%, 0); }
}

main {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem);
}

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

.landing-shell {
  display: block;
  min-height: calc(100vh - clamp(2rem, 8vw, 6rem));
}
.adventure-rail {
  position: fixed;
  z-index: 4;
  inset: 0 auto 0 0;
  width: var(--adventure-sidebar-width);
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(194, 174, 153, .24);
  border-radius: 0;
  background: rgba(17, 13, 11, .9);
  backdrop-filter: blur(13px) saturate(.82);
  box-shadow: 12px 0 48px rgba(0, 0, 0, .32);
  transform: translateX(0);
  transition: transform 220ms ease;
}
.adventure-rail.collapsed { transform: translateX(-100%); }
.adventure-sidebar-scroll { height: 100%; padding: clamp(1rem, 3vw, 1.5rem) 1rem; overflow: auto; }
.adventure-sidebar-toggle {
  position: absolute;
  top: 1.25rem;
  right: -3rem;
  display: grid;
  justify-items: center;
  width: 3rem;
  min-height: 8.5rem;
  padding: .65rem .45rem;
  color: #d8c5ae;
  border: 1px solid rgba(194, 174, 153, .3);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(23, 17, 14, .94);
  box-shadow: 8px 5px 24px rgba(0, 0, 0, .28);
}
.adventure-sidebar-toggle:hover { color: #f0e3d3; border-color: rgba(213, 187, 157, .5); }
.adventure-sidebar-toggle-label {
  align-self: center;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}
.adventure-sidebar-toggle-icon { font: 1.25rem/1 Georgia, "Times New Roman", serif; }
.adventure-sidebar-backdrop { display: none; }
.adventure-rail-heading { padding: .2rem .25rem .85rem; }
.adventure-rail-heading h2 {
  margin: .25rem 0 0;
  color: #eee5d8;
  font: 500 1.25rem/1.2 Georgia, "Times New Roman", serif;
}
.adventure-list { display: grid; gap: .5rem; }
.adventure-choice {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  width: 100%;
  gap: .7rem;
  align-items: center;
  padding: .55rem;
  color: #d7cfc3;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}
.adventure-choice:hover { border-color: rgba(194, 174, 153, .34); filter: none; }
.adventure-choice.active {
  border-color: #9d7e62;
  background: rgba(154, 113, 78, .18);
  box-shadow: inset 3px 0 #c6a47e;
}
.adventure-choice-art {
  width: 3.25rem;
  height: 3.25rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: #17110e;
}
.adventure-choice-art img { width: 100%; height: 100%; object-fit: cover; }
.adventure-choice > span:last-child { display: grid; min-width: 0; gap: .2rem; }
.adventure-choice strong {
  overflow: hidden;
  color: #eee5d8;
  font: 600 .82rem/1.25 Georgia, "Times New Roman", serif;
  text-overflow: ellipsis;
}
.adventure-choice small { color: #b2a79c; font-size: .7rem; line-height: 1.3; }

.gate {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(23rem, 30rem);
  width: 100%;
  min-height: calc(100vh - clamp(2rem, 8vw, 6rem));
  align-items: center;
  gap: clamp(2.5rem, 7vw, 7rem);
  margin: 0 auto;
}

.landing-hero { max-width: 44rem; text-shadow: 0 3px 22px rgba(0, 0, 0, .72); }
.gate h1 {
  margin: 0;
  color: #f2ebde;
  font: 500 clamp(3.8rem, 7.8vw, 7.4rem)/.86 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em;
}
.gate h1 span,
.gate h1 strong { display: block; }
.gate h1 span { font-size: .52em; font-weight: 400; letter-spacing: .015em; }
.gate h1 strong { color: #dfbea5; font-weight: 500; }
.landing-description {
  max-width: 42rem;
  margin: 1.2rem 0 0;
  color: #ded4c8;
  font: 1.05rem/1.65 Georgia, "Times New Roman", serif;
}
.landing-tagline {
  margin: 1.15rem 0 0;
  color: #bdb4a8;
  font-size: .85rem;
  font-weight: 400;
  letter-spacing: 0;
}

.entry-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 3vw, 2rem);
  border: 1px solid rgba(194, 174, 153, .22);
  border-radius: var(--radius);
  background: rgba(23, 19, 16, .94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}
.entry-panel:has(#code-step:not(.hidden)) {
  width: min(25rem, 100%);
  justify-self: end;
  padding: 1.2rem;
  border-radius: var(--radius);
}
.gate-step { animation: gate-step-in 260ms ease both; }
@keyframes gate-step-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
.gate-step h2 {
  margin: 0 0 .9rem;
  color: #eee5d8;
  font: 500 clamp(1.65rem, 3vw, 2.15rem)/1.15 Georgia, "Times New Roman", serif;
}
.code-field label {
  display: block;
  color: #c2b6a8;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.gate .code-field input {
  width: 100%;
  margin: .45rem 0 1rem;
  padding: .9rem 1rem;
  color: #f0e7da;
  border: 1px solid rgba(171, 145, 120, .46);
  border-radius: var(--radius);
  outline: none;
  background: rgba(15, 11, 9, .54);
  font: 650 .91rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.gate .code-field input::placeholder { color: #aaa093; }
.gate .code-field input:focus { border-color: #c0a17c; box-shadow: 0 0 0 3px rgba(185, 148, 107, .14); }
.character-name-fields,
.character-detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.character-name-fields label,
.character-detail-fields label {
  display: grid;
  gap: .4rem;
  color: #c2b6a8;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.gate .character-name-fields input,
.gate .character-detail-fields select {
  width: 100%;
  margin: 0;
  padding: .78rem .85rem;
  color: #f0e7da;
  border: 1px solid rgba(171, 145, 120, .46);
  border-radius: var(--radius);
  outline: none;
  background: rgba(15, 11, 9, .54);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.character-detail-fields { margin-top: .85rem; }
.gate .character-name-fields input:focus,
.gate .character-detail-fields select:focus {
  border-color: #c0a17c;
  box-shadow: 0 0 0 3px rgba(185, 148, 107, .14);
}
.character-creation-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .65rem;
  margin-top: 1rem;
}
.character-creation-actions:has(#back-to-code.hidden) .entry-primary { grid-column: 1 / -1; }
.entry-primary {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: .82rem 1rem;
  color: #211812;
  border: 1px solid #d1b58f;
  background: #d2b991;
}
.entry-primary span { font-size: 1.2rem; line-height: 1; }
.entry-primary:hover:not(:disabled) { filter: brightness(1.06); }
#code-step .entry-primary {
  width: auto;
  gap: 2.5rem;
  margin-left: auto;
  padding: .65rem .85rem;
  color: #e8dccd;
  border-color: rgba(190, 158, 126, .54);
  background: rgba(146, 105, 72, .15);
  box-shadow: none;
}

/* Keep the class heading and navigation visible while the twelve choices scroll. */
.class-grid {
  display: grid;
  grid-auto-rows: max-content;
  gap: .65rem;
  min-inline-size: 0;
  max-height: clamp(8rem, calc(100dvh - 17rem), 32rem);
  margin: 0;
  padding: .3rem;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--line) transparent;
  scroll-padding-block: .3rem;
}
.gate .class-choice {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: center;
  padding: .9rem;
  overflow: hidden;
  color: #ded5c9;
  border: 1px solid #55453a;
  border-radius: var(--radius);
  background: rgba(16, 12, 10, .56);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.gate .class-choice:hover { border-color: #8b705b; }
.gate .class-choice:has(input:checked) {
  border-color: #b79772;
  background: rgba(159, 119, 82, .14);
  box-shadow: inset 3px 0 #c4a47c;
}
.gate .class-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; scroll-margin-block: 3rem; }
.gate .class-choice:focus-within { outline: 2px solid var(--moss-bright); outline-offset: 2px; }
.class-icon {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  color: #bcb0a4;
  border: 1px solid #625044;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .035);
}
.class-icon svg { width: 1.55rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.class-choice:has(input:checked) .class-icon { color: #e0c8a8; border-color: #95765e; background: rgba(166, 126, 90, .12); }
.class-copy { display: grid; gap: .18rem; }
.gate .class-copy strong { color: #eee6da; font: 600 1.05rem/1.2 Georgia, "Times New Roman", serif; }
.gate .class-copy small { color: #b2a79c; font-size: .72rem; line-height: 1.35; }
.class-select {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  color: transparent;
  border: 1px solid #625044;
  border-radius: 50%;
  font-size: .7rem;
}
.class-choice:has(input:checked) .class-select { color: #211812; border-color: #d0b48d; background: #d0b48d; }
.class-actions { display: grid; grid-template-columns: auto 1fr; gap: .65rem; margin-top: 1rem; }
.entry-back { padding: .75rem .9rem; color: #b7aa9e; border: 1px solid #59483d; background: transparent; }
.entry-back:hover:not(:disabled) { border-color: #92745c; filter: none; }
.gate-error { margin-bottom: 0; font-size: .78rem; }
.gate-error:empty { display: none; }

h1 { margin: .15rem 0 .75rem; font-family: Georgia, serif; font-size: clamp(2.4rem, 8vw, 4.8rem); font-weight: 500; }
.eyebrow { margin: 0; color: var(--moss); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.lede { max-width: 42ch; margin: 0 0 2.25rem; color: var(--muted); font-family: Georgia, serif; font-size: 1.15rem; line-height: 1.6; }

label, legend { color: var(--muted); font-size: .9rem; font-weight: 650; }
input, select, button { font: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--moss-bright);
  outline-offset: 3px;
}
input[type="text"], input:not([type]) {
  width: 100%;
  margin: .5rem 0 1.25rem;
  padding: .9rem 1rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--inset);
}
input:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(159, 189, 121, .13); }

fieldset { display: grid; gap: .7rem; margin: 0 0 1.4rem; padding: 0; border: 0; }
legend { margin-bottom: .6rem; }
.class-choice { display: flex; align-items: center; gap: .8rem; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.class-choice:has(input:checked) { border-color: var(--moss); background: rgba(159, 189, 121, .08); }
.class-choice span { display: grid; gap: .15rem; }
.class-choice strong { color: var(--ink); }
.class-choice small { color: var(--muted); font-weight: 400; }

button {
  padding: .85rem 1.2rem;
  color: #10140f;
  border: 0;
  border-radius: var(--radius);
  background: var(--moss-bright);
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { cursor: not-allowed; opacity: .45; }
button.quiet { padding: .55rem .7rem; color: var(--muted); border: 1px solid var(--line); background: transparent; font-size: .82rem; }

.error { min-height: 1.3em; margin: .8rem 0 0; color: var(--danger); font-size: .9rem; }

.game {
  display: grid;
  grid-template-rows: auto minmax(20rem, 1fr) auto;
  height: calc(100vh - clamp(2rem, 8vw, 6rem));
  min-height: 40rem;
}
.game header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.game header h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.7rem); }
.status-block { display: flex; align-items: center; gap: .8rem; }
.session-actions { display: flex; gap: .45rem; }
.status { color: var(--muted); font-size: .86rem; }
.status.ready { color: var(--moss-bright); }

.play-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr) minmax(16rem, 20rem);
  gap: 1rem;
  min-height: 0;
}

.room-panel,
.character-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: 100%;
  padding: 1.15rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 97%, transparent);
}
.character-panel-empty .character-section { display: none; }
.character-panel h2 {
  margin: .3rem 0 .2rem;
  color: var(--moss-bright);
  font: 500 1.45rem/1.2 Georgia, "Times New Roman", serif;
}
.character-summary { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.character-vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .9rem; }
.vital-card, .ability-card {
  display: grid;
  justify-items: center;
  padding: .45rem .2rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.vital-label, .ability-name { color: var(--muted); font-size: .62rem; font-weight: 600; letter-spacing: .08em; }
.vital-value { margin-top: .12rem; color: var(--ink); font-size: .92rem; }
.character-section { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.character-section h3 {
  margin: 0 0 .6rem;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.character-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.character-action {
  padding: .42rem .55rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .7rem;
}
.character-action:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.character-action:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.character-action:disabled { opacity: .55; }
.character-wild-shape { display: grid; gap: .45rem; }
.wild-shape-current { margin: 0; color: #d5d0c2; font-size: .76rem; }
.wild-shape-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.wild-shape-option {
  display: grid;
  gap: .12rem;
  padding: .48rem .52rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  text-align: left;
}
.wild-shape-option:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.wild-shape-option:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.wild-shape-option:disabled { opacity: .55; }
.wild-shape-name { font-size: .72rem; }
.wild-shape-details { color: var(--muted); font-size: .62rem; }
.ability-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.ability-modifier { color: var(--moss-bright); font-size: .9rem; }
.ability-score { color: var(--muted); font-size: .62rem; }
.character-list { display: grid; gap: .34rem; margin: 0; padding: 0; list-style: none; }
.character-list-item { color: #d5d0c2; font-size: .78rem; line-height: 1.35; }
.character-list-empty { color: var(--muted); font-size: .76rem; font-style: italic; }
.character-copy { color: #d5d0c2; font-size: .76rem; line-height: 1.45; }
.spell-stat, .spell-line { margin: 0; }
.spell-line + .spell-line, .spell-stat + .spell-line { margin-top: .35rem; }
.character-spellbook { display: grid; gap: .4rem; margin-top: .65rem; }
.character-spell {
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.character-spell-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: baseline;
  padding: .48rem .55rem;
  cursor: pointer;
}
.character-spell-summary::marker { color: var(--moss); }
.character-spell[open] > .character-spell-summary {
  border-bottom: 1px solid var(--line);
  background: rgba(159, 189, 121, .06);
}
.character-spell-name { color: var(--ink); font-size: .78rem; font-weight: 700; }
.character-spell-level { color: var(--muted); font-size: .65rem; }
.character-spell-body { padding: .55rem; }
.character-spell-description { margin: 0; color: #c6c0b1; font-size: .72rem; line-height: 1.45; }
.character-spell-target-title {
  margin: .55rem 0 .35rem;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.character-spell-targets { display: flex; flex-wrap: wrap; gap: .35rem; }
.character-spell-target {
  padding: .38rem .48rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .68rem;
}
.character-spell-target:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.character-spell-target:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.character-carrying { margin: .5rem 0 0; color: var(--muted); font-size: .7rem; }
.character-item {
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.character-item-summary {
  padding: .46rem .52rem;
  color: #d5d0c2;
  cursor: pointer;
  font-size: .76rem;
  list-style-position: inside;
}
.character-item-summary::marker { color: var(--moss); }
.character-item[open] > .character-item-summary {
  border-bottom: 1px solid var(--line);
  background: rgba(159, 189, 121, .06);
}
.character-item-body { padding: .5rem; }
.character-item-description { margin: 0 0 .45rem; color: var(--muted); font-size: .68rem; line-height: 1.4; }
.character-item-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.character-item-action {
  padding: .38rem .48rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .68rem;
}
.character-item-action:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.character-item-action:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.character-item-action:disabled { opacity: .55; }
.room-panel-empty .room-section { display: none; }
.room-panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .65rem;
}
.room-panel-heading > div { min-width: 0; }
.room-panel-heading .quiet {
  flex: 0 0 auto;
  padding: .38rem .48rem;
  font-size: .68rem;
}
.room-panel h2 {
  margin: .3rem 0 .75rem;
  color: var(--moss-bright);
  font: 500 1.55rem/1.2 Georgia, "Times New Roman", serif;
}
.current-room-description {
  margin: 0;
  color: #d5d0c2;
  font: .9rem/1.55 Georgia, "Times New Roman", serif;
  white-space: pre-wrap;
}
.room-section { margin-top: 1.15rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.room-section h3 {
  margin: 0 0 .65rem;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.room-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.room-list-item { display: grid; gap: .08rem; }
.room-list-name { color: var(--ink); font-size: .87rem; font-weight: 650; }
.room-list-detail { color: var(--muted); font-size: .74rem; line-height: 1.35; }
.room-list-empty { color: var(--muted); font-size: .8rem; font-style: italic; }
.room-exit-action {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: .08rem;
  width: 100%;
  padding: .5rem .6rem;
  overflow: hidden;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 14, 11, .55);
  text-align: left;
}
.room-exit-action-preview {
  min-height: 4.5rem;
  align-content: end;
  padding: .7rem .75rem;
  border-color: #526256;
  text-shadow: 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, .9);
}
.room-exit-action-preview::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(to bottom, rgba(7, 10, 8, .08) 10%, rgba(7, 10, 8, .92) 100%);
}
.room-exit-preview {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
  transition: transform 220ms ease, filter 220ms ease;
}
.room-exit-action-unknown .room-exit-preview {
  filter: blur(7px) brightness(.72) saturate(.65);
  transform: scale(1.14);
}
.room-exit-action-preview .room-list-name { color: #fff8e8; }
.room-exit-action-preview .room-list-detail { color: #ddd8cc; }
.room-exit-action:hover:not(:disabled) {
  border-color: var(--moss);
  background: rgba(159, 189, 121, .09);
  filter: none;
}
.room-exit-action-preview:hover:not(:disabled) .room-exit-preview {
  filter: brightness(1.12);
  transform: scale(1.07);
}
.room-exit-action-preview.room-exit-action-unknown:hover:not(:disabled) .room-exit-preview {
  filter: blur(7px) brightness(.8) saturate(.65);
  transform: scale(1.18);
}
.room-exit-action:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.room-exit-action:disabled { opacity: .55; }
.room-exit-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .45rem 0 0; }
.room-exit-option {
  padding: .38rem .5rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .68rem;
}
.room-exit-option:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.room-exit-option:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.room-exit-option:disabled { opacity: .55; }
.room-object-menu,
.room-actor-menu {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}
.room-object-summary,
.room-actor-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  cursor: pointer;
  list-style: none;
}
.room-entity-summary-preview {
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  padding: .35rem .6rem .35rem .35rem;
}
.room-entity-thumbnail {
  display: block;
  width: 3.2rem;
  height: 3.2rem;
  border: 1px solid #536055;
  border-radius: 5px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.room-entity-copy { display: grid; gap: .08rem; min-width: 0; }
.room-object-summary::-webkit-details-marker,
.room-actor-summary::-webkit-details-marker { display: none; }
.room-object-summary::after,
.room-actor-summary::after {
  content: "";
  width: .5rem;
  height: .5rem;
  margin: 0 .2rem .25rem;
  border-right: 2px solid var(--moss-bright);
  border-bottom: 2px solid var(--moss-bright);
  transform: rotate(45deg);
}
.room-object-menu[open] > .room-object-summary::after,
.room-actor-menu[open] > .room-actor-summary::after {
  margin-top: .25rem;
  margin-bottom: 0;
  transform: rotate(225deg);
}
.room-object-summary:hover,
.room-actor-summary:hover { background: var(--inset); }
.room-object-summary:focus-visible,
.room-actor-summary:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: -3px;
}
.room-object-menu[open] > .room-object-summary,
.room-actor-menu[open] > .room-actor-summary {
  border-bottom: 1px solid var(--line);
  background: rgba(159, 189, 121, .06);
}
.room-object-actions,
.room-actor-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem; }
.room-object-action,
.room-actor-action {
  padding: .42rem .55rem;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .73rem;
}
.room-object-action:hover:not(:disabled),
.room-actor-action:hover:not(:disabled) { border-color: var(--moss); filter: none; }
.room-object-action:focus-visible,
.room-actor-action:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

.entity-preview {
  position: fixed;
  z-index: 8;
  top: var(--entity-preview-top, 1rem);
  left: var(--entity-preview-left, 1rem);
  width: var(--entity-preview-size, 22.5rem);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--moss) 72%, #c8c1ad);
  border-radius: var(--radius);
  background: #0d120f;
  box-shadow: 0 18px 54px rgba(0, 0, 0, .72);
  opacity: 0;
  pointer-events: none;
  transform: translateY(.35rem) scale(.985);
  transition: opacity 140ms ease, transform 140ms ease;
}
.entity-preview-visible { opacity: 1; transform: translateY(0) scale(1); }
.entity-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}
.entity-preview-unknown img {
  filter: blur(18px) brightness(.72) saturate(.65);
  transform: scale(1.1);
}
.entity-preview span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.25rem .8rem .65rem;
  color: #fff8e8;
  background: linear-gradient(transparent, rgba(5, 8, 6, .92));
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-shadow: 0 1px 3px #000;
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas:
    "initiative"
    "transcript"
    "decision"
    "speech"
    "command";
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--night) 96%, transparent);
}

.initiative-roll-banner {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  color: #f8f1d6;
  background:
    radial-gradient(circle at center, rgba(91, 43, 31, .86), rgba(8, 11, 9, .96) 55%);
  backdrop-filter: blur(9px);
  font: 800 clamp(1.4rem, 4vw, 2.4rem)/1.1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .07em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}
.initiative-die {
  display: grid;
  width: 5rem;
  height: 5rem;
  place-items: center;
  color: #17100c;
  background: var(--moss-bright);
  clip-path: polygon(50% 0, 96% 24%, 82% 80%, 50% 100%, 18% 80%, 4% 24%);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--moss-bright) 55%, transparent));
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  animation: initiative-roll 650ms cubic-bezier(.4, 0, .2, 1) infinite;
}
@keyframes initiative-roll {
  0% { transform: rotate(-12deg) scale(.94); }
  45% { transform: rotate(16deg) scale(1.08); }
  100% { transform: rotate(348deg) scale(.94); }
}

.initiative-bar {
  grid-area: initiative;
  display: flex;
  min-width: 0;
  align-items: center;
  padding: .42rem .65rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-strong) 92%, transparent);
}
.initiative-order {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .45rem;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}
.initiative-combatant {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  overflow: hidden;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(8, 12, 10, .42);
  font-size: .69rem;
  line-height: 1.2;
}
.initiative-portrait {
  display: grid;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  place-items: center;
  overflow: hidden;
  color: #e8e2cf;
  border: 0;
  border-radius: 4px;
  background: #182018;
  object-fit: cover;
  font-size: .62rem;
  font-weight: 900;
}
.initiative-combatant.active {
  color: #f5efd9;
  border-color: var(--moss-bright);
  background: color-mix(in srgb, var(--moss) 28%, rgba(8, 12, 10, .88));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--moss-bright) 22%, transparent);
  font-weight: 700;
}
.initiative-combatant.active .initiative-portrait {
  box-shadow: inset 0 0 0 2px #f4dc75;
}
.initiative-combatant.defeated { opacity: .4; filter: grayscale(1); }

.combat-mode .chat-panel {
  min-height: 0;
  border-color: rgba(152, 170, 149, .42);
  background: rgba(8, 12, 9, .16);
  backdrop-filter: blur(4px) saturate(1.05);
}
.combat-mode #transcript { display: none; }
.room-view-mode #transcript { display: none; }

.room-board {
  grid-area: transcript;
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(18rem, 1fr) auto;
  gap: .7rem;
  padding: clamp(.7rem, 2vw, 1.15rem);
  overflow: auto;
  color: #eee9d8;
}
.game .room-board-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
}
.room-board-header .eyebrow { margin: 0 0 .12rem; }
.room-board-header h2 {
  margin: 0;
  color: #f2edda;
  font: 500 clamp(1.25rem, 3vw, 1.8rem)/1.1 Georgia, "Times New Roman", serif;
}
.room-map-field { min-height: 18rem; }
.room-map-tokens {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}
.room-map-token {
  pointer-events: auto;
  position: absolute;
  display: grid;
  width: clamp(3.7rem, 7vw, 5rem);
  justify-items: center;
  color: #f6f0dd;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .62));
}
.room-map-token.actor {
  top: var(--room-map-y);
  left: var(--room-map-x);
  transform: translate(-50%, -50%);
}
.room-map-token.object {
  bottom: 1.5rem;
  left: calc(var(--room-map-x) + var(--room-map-object-offset));
  width: 3.25rem;
  transform: translateX(-50%);
}
.room-map-token-image,
.room-map-token-symbol {
  display: grid;
  width: clamp(2.5rem, 4.6vw, 3.35rem);
  height: clamp(2.5rem, 4.6vw, 3.35rem);
  box-sizing: border-box;
  place-items: center;
  overflow: hidden;
  border: 2px solid #92a27c;
  background: rgba(20, 28, 22, .94);
  object-fit: cover;
  box-shadow: 0 0 0 3px rgba(8, 12, 9, .7);
  font-size: .72rem;
  font-weight: 900;
}
.room-map-token.actor .room-map-token-image,
.room-map-token.actor .room-map-token-symbol { border-radius: 50%; }
.room-map-token.object .room-map-token-image,
.room-map-token.object .room-map-token-symbol {
  width: 2.35rem;
  height: 2.35rem;
  color: #e1c990;
  border-color: #b49c68;
  border-radius: 3px;
}
.room-map-token.player .room-map-token-image,
.room-map-token.player .room-map-token-symbol {
  border-color: #f0df83;
  box-shadow: 0 0 0 3px rgba(82, 72, 27, .74), 0 0 14px rgba(240, 223, 131, .35);
}
.room-map-token-name {
  opacity: 0;
  pointer-events: none;
  max-width: 5rem;
  margin-top: .28rem;
  overflow: hidden;
  font-size: .62rem;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}
.room-map-token:is(:hover, :focus) { z-index: 1; }
.room-map-token:is(:hover, :focus) .room-map-token-name { opacity: 1; }
.room-map-token:focus-visible { outline: 2px solid #f0df83; outline-offset: 3px; }
.room-map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1rem;
  color: var(--muted);
  font-size: .66rem;
}
.room-map-legend > span { display: inline-flex; align-items: center; gap: .3rem; }
.room-map-legend-swatch { width: .62rem; height: .62rem; border: 2px solid #92a27c; border-radius: 50%; }
.room-map-legend-swatch.object { border-color: #b49c68; border-radius: 2px; }
.room-map-legend-swatch.exit { border-color: #ded9c5; border-radius: 1px; }

.combat-board {
  grid-area: transcript;
  display: grid;
  grid-template-rows: auto minmax(16rem, 1fr) auto auto;
  gap: .7rem;
  min-height: 0;
  padding: clamp(.7rem, 2vw, 1.15rem);
  overflow: auto;
  color: #eee9d8;
  background: transparent;
}
.game .combat-board-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
}
.combat-board-header .eyebrow { margin: 0 0 .12rem; }
.combat-board-header h2 {
  margin: 0;
  color: #f2edda;
  font: 500 clamp(1.25rem, 3vw, 1.8rem)/1.1 Georgia, "Times New Roman", serif;
}
.combat-round-block {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: .45rem;
  color: #aeb19d;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.combat-round-block strong { color: #f4efd9; font-size: 1.35rem; }

.combat-field {
  position: relative;
  min-height: 16rem;
  overflow: hidden;
  border: 1px solid rgba(177, 194, 173, .38);
  border-radius: var(--radius);
  background: rgba(7, 11, 8, .08);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, .14),
    0 10px 24px rgba(0, 0, 0, .12);
}
.combat-room-image {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .72;
  filter: saturate(.82) contrast(1.04) brightness(.82);
  pointer-events: none;
}
.combat-position-markers {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--combat-position-count), minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}
.combat-position-marker {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  padding-bottom: .35rem;
  color: rgba(207, 216, 198, .62);
  font: 800 .66rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-shadow: 0 1px 3px #0b100d;
}
.combat-position-label { pointer-events: none; }
.combat-position-marker:nth-child(even) { background: rgba(184, 198, 177, .025); }
.combat-position-marker::before {
  position: absolute;
  z-index: -1;
  top: .6rem;
  bottom: 1.5rem;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(190, 204, 183, .42) 12% 88%, transparent);
}
.combat-position-target {
  position: absolute;
  z-index: 1;
  top: .6rem;
  bottom: 1.5rem;
  left: 50%;
  width: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  pointer-events: auto;
  transform: translateX(-50%);
}
.combat-position-marker.available::before {
  width: 3px;
  background: linear-gradient(180deg, transparent, rgba(228, 224, 172, .82) 12% 88%, transparent);
  box-shadow: 0 0 10px rgba(213, 208, 143, .38);
}
.combat-position-marker.available .combat-position-target { cursor: pointer; }
.combat-position-marker.available:has(.combat-position-target:hover)::before {
  background: linear-gradient(180deg, transparent, #f0df83 12% 88%, transparent);
  box-shadow: 0 0 14px rgba(240, 223, 131, .7);
}
.combat-position-target:focus-visible {
  outline: 2px solid #f0df83;
  outline-offset: 2px;
}
.combat-exit-markers {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}
.combat-exit-marker {
  position: absolute;
  left: var(--combat-exit-x);
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  padding: 0;
  color: inherit;
  border: 1px solid rgba(224, 220, 197, .82);
  border-radius: 3px;
  background: rgba(17, 24, 19, .72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .38);
  pointer-events: auto;
  transform: translateX(-50%);
}
.combat-exit-marker.has-preview {
  width: 2.35rem;
  height: 4rem;
  grid-template-rows: 1.35rem 2.35rem;
  gap: .12rem;
  padding: .08rem;
  isolation: isolate;
  overflow: hidden;
  background: #111813;
}
.combat-exit-preview {
  position: relative;
  z-index: 0;
  grid-row: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .78;
  filter: saturate(.82) brightness(.8);
}
.combat-exit-marker.unknown-destination .combat-exit-preview {
  filter: blur(4px) saturate(.55) brightness(.62);
  transform: scale(1.16);
}
.combat-exit-marker.has-preview::after {
  position: absolute;
  z-index: 1;
  right: .08rem;
  bottom: .08rem;
  left: .08rem;
  height: 2.35rem;
  content: "";
  background: linear-gradient(transparent 25%, rgba(5, 8, 6, .6));
}
.combat-exit-marker.available { cursor: pointer; }
.combat-exit-marker.available:hover:not(:disabled),
.combat-exit-marker.available:focus-visible {
  border-color: #f0df83;
  box-shadow: 0 0 14px rgba(240, 223, 131, .62);
  outline: none;
}
.combat-exit-marker:disabled { cursor: default; }
.combat-exit-icon {
  position: relative;
  z-index: 2;
  grid-row: 1;
  display: block;
  width: .75rem;
  height: .9rem;
  border: 1px solid #ded9c5;
  border-bottom: 0;
  filter: drop-shadow(0 1px 2px #000);
}
.room-map-exit-marker { pointer-events: auto; }
.room-map-token.room-map-action {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
}
.room-map-token.room-map-action.available { cursor: pointer; }
.room-map-token.room-map-action.available:hover .room-map-token-image,
.room-map-token.room-map-action.available:hover .room-map-token-symbol { border-color: #f0df83; }
.room-map-field .combat-position-target {
  inset: 0;
  width: 100%;
  border-radius: 0;
  transform: none;
}
.room-map-field .combat-position-target.available:hover { background: rgba(240, 223, 131, .1); }
.combat-exit-icon::after {
  position: absolute;
  right: .1rem;
  top: 48%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  content: "";
  background: #ded9c5;
}
.combat-exit-marker.closed { border-color: #a9a79a; opacity: .78; }
.combat-exit-marker.locked { border-color: #c99374; }
.combat-exit-marker.locked .combat-exit-icon { border-color: #d9aa8d; }
.combat-tokens {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}
.combat-token {
  --combat-token-radius: clamp(1.35rem, 2.5vw, 1.9rem);
  --combat-token-gap: .28rem;
  position: absolute;
  top: var(--combat-y);
  display: grid;
  width: clamp(3.8rem, 7vw, 5.2rem);
  justify-items: center;
  color: #f6f0dd;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .58));
  transform: translate(-50%, -50%);
  transition: left 260ms ease, top 260ms ease, opacity 180ms ease, filter 180ms ease;
}
.combat-token.ally {
  left: calc(var(--combat-x) - var(--combat-token-radius) - var(--combat-token-gap));
}
.combat-token.enemy {
  left: calc(var(--combat-x) + var(--combat-token-radius) + var(--combat-token-gap));
}
.combat-token-portrait,
.combat-token-initials {
  display: grid;
  width: clamp(2.7rem, 5vw, 3.8rem);
  height: clamp(2.7rem, 5vw, 3.8rem);
  box-sizing: border-box;
  place-items: center;
  overflow: hidden;
  border: 3px solid #98a17b;
  border-radius: 50%;
  background: #182018;
  object-fit: cover;
  box-shadow: 0 0 0 3px rgba(9, 13, 9, .72);
  font-size: .9rem;
  font-weight: 900;
}
.combat-token.enemy .combat-token-portrait,
.combat-token.enemy .combat-token-initials { border-color: #b76155; }
.combat-token.enemy.bloodied::before {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: clamp(2.7rem, 5vw, 3.8rem);
  height: clamp(2.7rem, 5vw, 3.8rem);
  border-radius: 50%;
  content: "";
  background:
    radial-gradient(circle at 68% 24%, rgba(107, 15, 10, .86) 0 5%, transparent 6%),
    radial-gradient(circle at 73% 34%, rgba(121, 20, 13, .76) 0 3%, transparent 4%),
    linear-gradient(118deg, transparent 43%, rgba(105, 13, 9, .68) 45% 49%, transparent 52%);
  box-shadow: inset 0 0 15px rgba(74, 6, 5, .62);
  pointer-events: none;
  transform: translateX(-50%);
}
.combat-target-button {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 50%;
  width: clamp(2.7rem, 5vw, 3.8rem);
  height: clamp(2.7rem, 5vw, 3.8rem);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
  transform: translateX(-50%);
}
.combat-token.targetable .combat-target-button {
  cursor: crosshair;
  pointer-events: auto;
}
.combat-token.targetable .combat-token-portrait,
.combat-token.targetable .combat-token-initials {
  border-color: #e4cf6d;
  box-shadow: 0 0 0 4px rgba(228, 207, 109, .24), 0 0 18px rgba(228, 207, 109, .52);
}
.combat-token.selected-target .combat-token-portrait,
.combat-token.selected-target .combat-token-initials {
  border-color: #fff0a1;
  box-shadow: 0 0 0 5px rgba(255, 240, 161, .35), 0 0 24px rgba(255, 224, 106, .75);
}
.combat-token.targetable .combat-target-button:focus-visible {
  outline: 2px solid #fff0a1;
  outline-offset: 5px;
}
.combat-token.active .combat-token-portrait,
.combat-token.active .combat-token-initials {
  border-color: #f4dc75;
  box-shadow: 0 0 0 4px rgba(244, 220, 117, .28), 0 0 22px rgba(244, 220, 117, .65);
}
.combat-token-name {
  max-width: 100%;
  margin-top: .25rem;
  overflow: hidden;
  font-size: clamp(.58rem, 1.3vw, .72rem);
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}
.combat-token-hp {
  width: 76%;
  height: 5px;
  margin-top: .2rem;
  overflow: hidden;
  border: 1px solid rgba(239, 234, 213, .58);
  border-radius: 999px;
  background: rgba(20, 10, 9, .8);
}
.combat-token-hp-fill {
  display: block;
  height: 100%;
  background: #92b66d;
}
.combat-token.defeated { opacity: .32; filter: grayscale(1); }
.combat-token.struck { animation: combat-token-struck 400ms ease; }
.combat-token.reacting { animation: combat-token-reacting 520ms ease; }
@keyframes combat-token-struck {
  0%, 100% { transform: translate(-50%, -50%); }
  35% { transform: translate(calc(-50% + 8px), -50%) rotate(4deg); filter: brightness(1.8); }
}
@keyframes combat-token-reacting {
  0%, 100% { transform: translate(-50%, -50%); }
  42% { transform: translate(-50%, -50%) scale(1.14); filter: brightness(1.55); }
}
.combat-direction {
  position: absolute;
  z-index: 2;
  top: .45rem;
  color: rgba(244, 240, 219, .66);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.combat-direction-left { left: .55rem; }
.combat-direction-right { right: .55rem; }
.combat-log {
  display: grid;
  max-height: 5.8rem;
  gap: .2rem;
  margin: 0;
  padding: .12rem 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
.combat-log:empty { display: none; }
.combat-log-entry {
  padding: .32rem .55rem;
  color: #dfdac8;
  border-left: 3px solid #8e9873;
  border-radius: 3px;
  background: rgba(18, 24, 19, .68);
  font-size: .72rem;
  line-height: 1.3;
}
.combat-log-entry.hit { border-left-color: #bd6959; }
.combat-log-entry.success { border-left-color: #8fab69; }
.combat-log-entry.failure { border-left-color: #bd6959; }
.combat-log-entry.miss { border-left-color: #858b86; }
.combat-log-entry.movement { border-left-color: #7994a2; }
.combat-log-entry.speech { border-left-color: #aa8eb8; }
.combat-log-entry.opportunity {
  color: #ffe5d6;
  border-left-color: #e57c61;
  background: linear-gradient(90deg, rgba(105, 31, 22, .82), rgba(35, 25, 21, .72));
}

.combat-replay-dialog {
  width: min(70rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid rgba(177, 194, 173, .48);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 96%, #080c09);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .72);
}
.combat-replay-dialog::backdrop {
  background: rgba(4, 7, 5, .76);
  backdrop-filter: blur(5px);
}
.combat-replay-shell { display: grid; max-height: calc(100vh - 2rem); grid-template-rows: auto 1fr; }
.combat-replay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.combat-replay-header .eyebrow { margin: 0 0 .12rem; }
.combat-replay-header h2 { margin: 0; font: 500 1.25rem/1.2 Georgia, "Times New Roman", serif; }
.combat-replay-controls { display: flex; align-items: center; gap: .45rem; }
.combat-replay-progress {
  min-width: 4rem;
  color: var(--muted);
  font: 700 .7rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
}
.combat-replay-stage { min-height: 24rem; overflow: auto; }
.combat-replay-frame .initiative-bar { grid-area: auto; }
.combat-replay-frame .combat-board { grid-area: auto; min-height: 25rem; }
.combat-replay-frame .combat-field { min-height: 18rem; }
.combat-replay-frame .combat-attack-picker { display: none; }
.combat-replay-frame button { pointer-events: none; }

#transcript {
  grid-area: transcript;
  min-height: 24rem;
  margin: 0;
  padding: clamp(1rem, 3vw, 1.6rem);
  overflow: auto;
  overflow-wrap: anywhere;
  color: #ddd8ca;
  border: 0;
  background: transparent;
  font: 16px/1.62 Georgia, "Times New Roman", serif;
}

.transcript-entry { white-space: pre-wrap; }
.study-phrase-link {
  display: inline;
  margin: 0;
  padding: 0;
  color: #d8bd7a;
  border: 0;
  border-bottom: 1px dotted currentColor;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  text-transform: none;
  letter-spacing: inherit;
  cursor: pointer;
}
.study-phrase-link:hover,
.study-phrase-link:focus-visible {
  color: #f0d99e;
  border-bottom-style: solid;
  outline: none;
  text-shadow: 0 0 .7rem rgba(216, 189, 122, .32);
}
.study-phrase-link:disabled { color: #8e8267; cursor: wait; opacity: .72; }
.transcript-entry + .transcript-entry { margin-top: 1rem; }
.transcript-spacer { height: .4rem; }
.transcript-entry.previous-room,
.transcript-spacer.previous-room {
  opacity: .32;
  filter: grayscale(.75);
  transition: opacity 160ms ease;
}
.transcript-entry.previous-room:hover,
.transcript-entry.previous-room:focus-within { opacity: .68; }

.player-input {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  gap: .35rem;
  padding: .7rem .8rem;
  color: var(--moss-bright);
  border-left: 2px solid var(--moss);
  background: rgba(159, 189, 121, .065);
  font: italic 1rem/1.55 Georgia, "Times New Roman", serif;
}
.input-marker { color: var(--moss); font-weight: 700; }

.combat-replay-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem .9rem;
  border: 1px solid rgba(143, 171, 105, .52);
  border-left: 4px solid var(--moss);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(29, 41, 31, .9), rgba(14, 20, 16, .9));
  font-family: ui-sans-serif, system-ui, sans-serif;
  white-space: normal;
}
.combat-replay-copy { display: grid; min-width: 0; gap: .1rem; }
.combat-replay-kicker {
  color: var(--moss);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.combat-replay-name { color: var(--ink); font: 600 1rem/1.25 Georgia, "Times New Roman", serif; }
.combat-replay-summary { color: var(--muted); font-size: .68rem; }
.combat-replay-open {
  flex: 0 0 auto;
  padding: .48rem .7rem;
  color: #16170f;
  border: 1px solid #d8cf82;
  border-radius: var(--radius);
  background: #c7c06f;
  font-size: .72rem;
  font-weight: 700;
}
.combat-replay-open:hover { background: #ded581; }

.speech {
  padding: .75rem 1rem .85rem;
  border-left: 3px solid #6f8b68;
  background: rgba(255, 255, 255, .025);
}
.speech-with-portrait {
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr);
  gap: .8rem;
  align-items: start;
}
.speech-portrait {
  display: block;
  width: 3.35rem;
  height: 3.35rem;
  border: 1px solid #536055;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .5);
}
.speech-copy { min-width: 0; }
.speech-heading { display: flex; align-items: baseline; gap: .55rem; margin-bottom: .3rem; }
.speaker { color: var(--moss-bright); font: 700 .78rem/1.3 ui-sans-serif, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.speech-detail { color: var(--muted); font: italic .76rem/1.3 ui-sans-serif, system-ui, sans-serif; }
.dialogue { margin: 0; color: #f1ead9; font-size: 1.08rem; line-height: 1.55; }
.subject-event { cursor: default; }
.subject-event-name { color: #f1ead9; font-size: 1.02rem; line-height: 1.45; }
.subject-event-detail, .summary-event-detail {
  margin: .28rem 0 0;
  color: #c8c1af;
  font-size: .9rem;
  line-height: 1.48;
  white-space: pre-wrap;
}
.subject-event.discovery { border-left-color: var(--moss-bright); }
.subject-event.take { border-left-color: #b89b69; }
.subject-event.inspect { border-left-color: #829b8b; }
.subject-event.open, .subject-event.unlock { border-left-color: #a78c65; }
.subject-event.free, .subject-event.following { border-left-color: #739b71; }
.subject-event.damage { border-left-color: #a45d55; }
.subject-event.healing { border-left-color: #69a17a; }
.summary-event {
  padding: .7rem .9rem;
  border-left: 3px solid #718271;
  background: rgba(255, 255, 255, .022);
  cursor: default;
}
.summary-event-label {
  color: var(--moss-bright);
  font: 700 .78rem/1.3 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.event-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.event-badge {
  padding: .18rem .45rem;
  border: 1px solid #586354;
  border-radius: 999px;
  color: #d9d2c0;
  background: rgba(10, 14, 11, .45);
  font: 700 .68rem/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .035em;
}

.prologue { padding-bottom: 1.3rem; border-bottom: 1px solid var(--line); }
.prologue-title, .room-title {
  margin: 0 0 .65rem;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}
.prologue-title { font-size: 1.7rem; letter-spacing: .04em; }
.prologue-text { color: #d8d1c0; white-space: normal; }
.prologue-paragraph { margin: 0; }
.prologue-paragraph + .prologue-paragraph { margin-top: 1rem; }

.room-entry { padding: 1.05rem 0 .25rem; }
.room-title { color: var(--moss-bright); font-size: 1.35rem; }

.help-reference {
  padding: 1rem;
  border: 1px solid #46594a;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(32, 43, 35, .78), rgba(17, 23, 19, .88));
  font-family: ui-sans-serif, system-ui, sans-serif;
  white-space: normal;
}
.help-title { margin: 0; color: var(--moss-bright); font: 600 1.35rem/1.3 Georgia, "Times New Roman", serif; }
.help-intro { margin: .55rem 0 1rem; color: #d8d1c0; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; }
.help-section { border-top: 1px solid var(--line); }
.help-section:last-child { border-bottom: 1px solid var(--line); }
.help-section-title {
  padding: .78rem .2rem;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .025em;
  cursor: pointer;
}
.help-section-title::marker { color: var(--moss); }
.help-section[open] > .help-section-title { color: var(--moss-bright); }
.help-section-description { margin: 0 .2rem .7rem; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.help-entries { display: grid; gap: .55rem; margin: 0 0 .9rem; padding: 0 .2rem; list-style: none; }
.help-entry { display: grid; grid-template-columns: minmax(12rem, 2fr) 3fr; gap: .8rem; align-items: start; }
.help-command-block { display: grid; gap: .3rem; }
.help-command,
.help-command-label {
  display: block;
  width: 100%;
  padding: .48rem .6rem;
  overflow-wrap: anywhere;
  color: var(--moss-bright);
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: rgba(9, 14, 11, .72);
  font: 600 .78rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
}
.help-command { cursor: pointer; }
.help-command:hover { border-color: var(--moss); background: rgba(159, 189, 121, .09); filter: none; }
.help-command:disabled { opacity: .5; cursor: default; }
.help-command-label { color: #c9c4b6; }
.help-example {
  padding-inline: .25rem;
  overflow-wrap: anywhere;
  color: #8f998c;
  font: .72rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.help-description { padding-top: .35rem; color: #c6c0b1; font-size: .82rem; line-height: 1.45; }

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .8rem;
  align-items: baseline;
  padding: .65rem .8rem;
  border: 1px solid #3e5042;
  border-radius: var(--radius);
  background: rgba(159, 189, 121, .055);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.check-title { color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.check-details { color: var(--ink); font-size: .88rem; font-weight: 650; }
.check-note { grid-column: 2; color: var(--muted); font-size: .82rem; }

.check-card {
  display: grid;
  width: min(100%, 34rem);
  gap: .55rem;
  padding: .75rem .85rem;
  border: 1px solid #536256;
  border-left: 4px solid #8f9b91;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(29, 38, 32, .94), rgba(14, 19, 16, .94));
  box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
  font-family: ui-sans-serif, system-ui, sans-serif;
  white-space: normal;
}
.check-card.success { border-left-color: var(--moss-bright); }
.check-card.failure { border-left-color: #ba7064; }
.check-action {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid #39463c;
  cursor: default;
}
.check-action-badge {
  display: block;
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  border: 1px solid #536055;
  border-radius: var(--radius);
  object-fit: cover;
}
.check-action-text { color: var(--moss-bright); font-size: .78rem; font-weight: 600; }
.check-card-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.check-name { color: var(--ink); font-size: .9rem; }
.check-outcome,
.check-roll span,
.check-consequence-defeated {
  padding: .2rem .46rem;
  border: 1px solid #4d5a50;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.check-outcome.success { color: #dff1be; border-color: #758f5c; background: rgba(109, 141, 77, .2); }
.check-outcome.failure { color: #ffd2c8; border-color: #925f55; background: rgba(146, 69, 57, .2); }
.check-outcome.rolled { color: #d9ddd8; background: rgba(102, 108, 103, .17); }
.check-roll { display: flex; flex-wrap: wrap; gap: .32rem; color: var(--muted); }
.check-roll span { font-weight: 650; text-transform: none; }
.check-consequences { display: grid; gap: .36rem; }
.check-consequences:empty { display: none; }
.check-consequence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  padding-top: .45rem;
  color: #d8d5ca;
  border-top: 1px solid #39463c;
  font-size: .78rem;
  line-height: 1.4;
}
.check-consequence.damage .check-consequence-text { color: #ffd4c9; font-weight: 700; }
.check-consequence.alarm .check-consequence-text { color: #f0c889; font-weight: 600; }
.check-consequence-detail { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.check-consequence-defeated { color: #fff0cf; border-color: #a17845; background: rgba(155, 102, 44, .25); }

.mechanic, .system, .vocalization {
  color: var(--muted);
  font: 14px/1.5 ui-sans-serif, system-ui, sans-serif;
}
.mechanic {
  width: fit-content;
  padding: .42rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
}
.mechanic-damage, .mechanic-defeat { color: #e8afa5; }
.combat-action {
  display: grid;
  width: min(100%, 34rem);
  gap: .48rem;
  padding: .75rem .85rem;
  border: 1px solid #596259;
  border-left: 4px solid #a6aea1;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(31, 39, 33, .94), rgba(14, 19, 16, .94));
  box-shadow: 0 5px 16px rgba(0, 0, 0, .2);
  font-family: ui-sans-serif, system-ui, sans-serif;
  white-space: normal;
}
.combat-action.hit { border-left-color: var(--moss-bright); }
.combat-action.miss { border-left-color: #858b86; }
.combat-action-sentence { color: var(--ink); font-size: .9rem; }
.combat-actor { color: var(--moss-bright); }
.combat-target { color: #efd4ca; }
.combat-action-badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.combat-action-badges span {
  padding: .22rem .48rem;
  border: 1px solid #4c574e;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.combat-opportunity {
  color: #ffe5d6;
  border-color: #bd6959 !important;
  background: rgba(146, 52, 39, .3);
}
.combat-outcome.hit { color: #dff1be; border-color: #758f5c; background: rgba(109, 141, 77, .2); }
.combat-outcome.miss { color: #c5c8c4; background: rgba(102, 108, 103, .17); }
.combat-damage { color: #ffd4c9; border-color: #925f55 !important; background: rgba(146, 69, 57, .2); }
.combat-defeated { color: #fff0cf; border-color: #a17845 !important; background: rgba(155, 102, 44, .25); }
.combat-weapon { color: var(--muted); font-size: .68rem; }
.conclusion { padding: 1rem; color: var(--moss-bright); border: 1px solid var(--moss); border-radius: var(--radius); }

.decision-panel {
  grid-area: decision;
  padding: .85rem 1rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-strong) 90%, transparent);
}
.decision-panel h2 { margin: 0; color: var(--moss-bright); font: 600 1rem/1.3 Georgia, "Times New Roman", serif; }
.decision-panel p { margin: .3rem 0 .65rem; color: #d5d0c2; font-size: .78rem; line-height: 1.4; }
.decision-options { display: flex; flex-wrap: wrap; gap: .42rem; }
.decision-group {
  flex: 1 1 11rem;
  min-width: min(100%, 11rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 12, 10, .42);
}
.decision-group[open] { flex-basis: 100%; }
.decision-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .55rem .7rem;
  color: var(--moss-bright);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
}
.decision-group-summary:hover { background: rgba(120, 151, 105, .08); }
.decision-group-count {
  min-width: 1.35rem;
  padding: .08rem .35rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .66rem;
  text-align: center;
}
.decision-group-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .42rem;
  padding: 0 .55rem .55rem;
}
.decision-group:not([open]) > .decision-group-options { display: none; }
.decision-option {
  padding: .48rem .65rem;
  color: var(--moss-bright);
  border: 1px solid #526956;
  border-radius: var(--radius);
  background: var(--inset);
  font-size: .75rem;
  text-align: left;
}
.decision-option-single {
  flex: 1 1 11rem;
  min-width: min(100%, 11rem);
}
.combat-attack-start.active {
  color: #16170f;
  border-color: #eadb82;
  background: #d8c96e;
}
.combat-attack-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 2.45rem;
  padding: .35rem .5rem;
  border: 1px solid rgba(222, 215, 161, .5);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
.combat-attack-intent {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.combat-weapon-target {
  color: #f2edda;
  font-size: .76rem;
  font-weight: 700;
}
.combat-weapon-options { display: flex; flex-wrap: wrap; justify-content: center; gap: .42rem; }
.combat-weapon-option { text-transform: capitalize; }
.decision-option:hover:not(:disabled) { border-color: var(--moss-bright); filter: none; }
.decision-option:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.decision-option-secondary { color: var(--muted); border-color: var(--line); }
.decision-option:disabled { opacity: .5; }
.decision-text-form { display: grid; gap: .5rem; }
.decision-text-form textarea {
  width: 100%;
  min-height: 5rem;
  resize: vertical;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 12, 10, .7);
}
.decision-text-form button { justify-self: end; }
.speech-context {
  grid-area: speech;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 2rem;
  padding: .35rem .65rem .3rem 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  font-size: .68rem;
}
.speech-context .quiet { padding: .28rem .45rem; font-size: .64rem; }

.command-form { display: grid; grid-area: command; grid-template-columns: 1fr auto; border: 0; background: color-mix(in srgb, var(--panel) 92%, transparent); }
.command-form input { margin: 0; padding: 1rem; border: 0; border-radius: 0; background: transparent; }
.command-form input:focus { box-shadow: inset 0 0 0 2px var(--moss); }
.command-form button { margin: .45rem; padding-inline: 1.4rem; }
.combat-mode .speech-context,
.combat-mode .command-form { display: none; }
.combat-mode.combat-speech-entry .command-form { display: grid; }
.game-footer { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }

@media (prefers-reduced-motion: reduce) {
  body,
  .scene-layer,
  .scene-ambience,
  .scene-shade { transition: none; }
  .scene-layer,
  .scene-ambience,
  .scene-ambience::before,
  .scene-ambience::after,
  .initiative-die,
  .combat-token { animation: none !important; transition: none; }
  .entity-preview,
  .adventure-rail { transition: none; }
}

@media (hover: none), (max-width: 860px) {
  .entity-preview { display: none; }
}

@media (max-width: 620px) {
  main { padding: .75rem; }
  .account-bar { padding: .75rem; }
  .profile-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
  .profile-shell { max-height: calc(100vh - 1rem); }
  .profile-content { grid-template-columns: 1fr; }
  .profile-summary { border-right: 0; border-bottom: 1px solid var(--line); }
  .credit-packages { grid-template-columns: 1fr; }
  .credit-package .credit-package-time { min-height: 0; }
  .gate { gap: 1rem; }
  .gate h1 { font-size: clamp(3rem, 15vw, 4.25rem); }
  .entry-panel { padding: 1.15rem; border-radius: var(--radius); }
  .character-name-fields,
  .character-detail-fields { grid-template-columns: 1fr; }
  .game { min-height: calc(100vh - 1.5rem); }
  .game header { align-items: start; flex-wrap: wrap; }
  .status-block { align-items: center; flex-wrap: wrap; gap: .4rem; }
  #transcript { font-size: 16px; }
  .help-reference { padding: .8rem; }
  .help-entry { grid-template-columns: 1fr; gap: .25rem; }
  .help-description { padding: 0 .25rem .25rem; }
  .command-form { grid-template-columns: 1fr; }
  .command-form input { border-radius: 0; }
  .command-form button { margin-top: 0; }
  .combat-board { padding: .55rem; }
  .combat-field { min-height: 16rem; }
  .combat-token { width: 4rem; }
  .combat-token-name { max-width: 4rem; }
}

@media (max-height: 700px) and (min-width: 621px) {
  main { padding-block: .75rem; }
  .gate { min-height: calc(100vh - 1.5rem); }
  .gate h1 { font-size: clamp(3.8rem, 7vw, 5.4rem); }
  .entry-panel { padding: 1.2rem 1.35rem; }
  .gate .class-choice { padding-block: .65rem; }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .game { height: auto; }
  .play-layout { grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr); }
  .room-panel { position: static; max-height: none; }
  .chat-panel { min-height: 42rem; }
  .character-panel { position: static; grid-column: 1 / -1; max-height: none; }
}

@media (max-width: 860px) {
  .landing-shell { min-height: auto; }
  .adventure-rail { width: min(18rem, calc(100vw - 3.5rem)); }
  .adventure-list { display: grid; overflow: visible; }
  .adventure-sidebar-backdrop:not(.hidden) {
    position: fixed;
    z-index: 3;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(7, 5, 4, .58);
    backdrop-filter: blur(2px);
  }
  .gate {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 1.4rem;
    padding-block: .5rem 1.25rem;
  }
  .landing-hero { margin-inline: auto; text-align: center; }
  .landing-hero::after {
    margin-inline: auto;
    background: linear-gradient(90deg, transparent, #8999a8, transparent);
  }
  .gate h1 { font-size: clamp(3.35rem, 12vw, 5.2rem); }
  .entry-panel { width: min(32rem, 100%); margin-inline: auto; }
  .entry-panel:has(#code-step:not(.hidden)) { justify-self: center; }
  .game { height: auto; min-height: calc(100vh - 1.5rem); }
  .play-layout { grid-template-columns: 1fr; }
  .room-panel { position: static; max-height: none; }
  .chat-panel { min-height: 70vh; }
}

@media (max-width: 620px) {
  .gate { padding-top: 4rem; }
  .adventure-sidebar-toggle {
    top: .75rem;
    right: -8rem;
    display: flex;
    justify-content: space-between;
    width: 8rem;
    min-height: 2.5rem;
    padding: .6rem .8rem;
  }
  .adventure-sidebar-toggle-label { writing-mode: horizontal-tb; }
  .adventure-rail:not(.collapsed) .adventure-sidebar-toggle {
    right: -3rem;
    width: 3rem;
    justify-content: center;
  }
  .adventure-rail:not(.collapsed) .adventure-sidebar-toggle-label { display: none; }
}

.study-phrase-known { background: rgba(214, 166, 93, .16); color: #e0c58f; border-bottom: 1px dotted currentColor; cursor: help; position: relative; }
.study-lore-recap { display: none; position: absolute; bottom: calc(100% + .5rem); left: 0; z-index: 30; width: max-content; max-width: min(22rem, 75vw); padding: .75rem; border: 1px solid #786748; border-radius: .4rem; background: #181d1b; color: #e9e5dc; font: 400 .85rem/1.5 sans-serif; box-shadow: 0 .4rem 1.2rem #0008; }
.study-phrase-known:hover > .study-lore-recap, .study-phrase-known:focus > .study-lore-recap { display: block; }
.study-phrase-known:focus-visible { outline: 2px solid #d6a65d; outline-offset: 2px; }

/* Adventure interface: quieter surfaces and a clear reading hierarchy. */
.account-bar { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--night) 94%, transparent); padding: .65rem clamp(1rem, 3vw, 2.5rem); gap: .5rem; }
.account-bar > div { margin-right: auto; text-align: left; }
.gate { max-width: 88rem; gap: clamp(2rem, 5vw, 5rem); }
.gate h1 { line-height: 1.02; letter-spacing: -.045em; }
.landing-hero > .eyebrow { margin-bottom: 1.5rem; letter-spacing: .18em; }
.landing-description { max-width: 46ch; font-size: 1.15rem; line-height: 1.75; }
.landing-tagline { padding-top: 1.25rem; border-top: 1px solid #d4b68b40; max-width: 38rem; }
.entry-panel, .entry-panel:has(#code-step:not(.hidden)) { padding: clamp(1.35rem, 3vw, 2rem); border-radius: 16px; border-color: #c8b08d4d; box-shadow: 0 24px 70px #0005; }
.gate-step h2 { font-size: 1.65rem; margin-bottom: 1.35rem; }
.gate .class-choice { border-radius: 9px; padding: .9rem; }
.gate .class-choice:has(input:checked) { box-shadow: inset 3px 0 var(--moss-bright); }
.gate .class-copy small { line-height: 1.5; }
.adventure-choice, .account-game { border-radius: 9px; }
.game > header { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.game > header h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.room-panel, .character-panel { padding: var(--ui-space); box-shadow: var(--ui-shadow); }
.room-panel h2, .character-panel h2 { line-height: 1.25; }
.current-room-description, .character-summary { line-height: 1.65; }
.room-section, .character-section { padding-top: 1rem; }
.chat-panel { box-shadow: var(--ui-shadow); }
#transcript { padding: clamp(1rem, 2vw, 1.75rem); line-height: 1.75; }
.speech-context { padding-block: .65rem; }
.credit-package { border-radius: 12px; padding: 1.25rem; }
.profile-header, .combat-replay-header { background: var(--panel); }
.profile-content, .profile-summary, .credit-store { min-width: 0; }
@media (min-width: 1181px) {
  .play-layout { grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr) minmax(15rem, 18rem); }
}
@media (max-width: 860px) {
  .landing-description, .landing-tagline { margin-inline: auto; }
  .game > header, .status-block { flex-wrap: wrap; }
  .room-panel, .character-panel { max-height: none; }
}
@media (max-width: 620px) {
  .account-bar { padding-left: 1rem; }
  .account-bar > div { flex-basis: 100%; }
  .gate h1 { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .landing-description { font-size: 1rem; }
  .landing-hero > .eyebrow { margin-bottom: .85rem; }
  .session-actions { flex-wrap: wrap; }
  .profile-content, .credit-packages, .subscription-packages { grid-template-columns: minmax(0, 1fr); }
  .profile-summary { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-header, .credit-store-heading, .store-section-heading { flex-wrap: wrap; }
  .gift-key-form > div { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .gift-key-form input, .gift-key-form button { border-radius: 8px; }
}
/* A pinned adventure library reserves space instead of covering the title. */
@media (min-width: 861px) {
  body:has(#landing-shell:not(.hidden) .adventure-rail:not(.collapsed)) > main {
    margin-left: var(--adventure-sidebar-width);
    width: calc(100% - var(--adventure-sidebar-width));
  }
  .gate h1 { font-size: clamp(3rem, 5.8vw, 6rem); }
  .gate { grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem); }
}
@media (min-width: 861px) and (max-width: 1150px) {
  body:has(.adventure-rail:not(.collapsed)) .gate { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  body:has(.adventure-rail:not(.collapsed)) .entry-panel { width: min(32rem, 100%); justify-self: start; }
}
.setup-progress { display: flex; gap: .75rem; list-style: none; padding: 0; margin: 0 0 1.5rem; counter-reset: setup; }
.setup-progress li { flex: 1; counter-increment: setup; border-bottom: 2px solid var(--line); padding-bottom: .6rem; color: var(--muted); font: 650 .75rem/1.4 ui-sans-serif, system-ui, sans-serif; }
.setup-progress li::before { content: counter(setup) "  "; font-variant-numeric: tabular-nums; }
.setup-progress li[aria-current="step"] { color: var(--moss-bright); border-color: var(--moss-bright); }
.room-board, .combat-board { border-radius: var(--radius); }
.combat-board-header, .room-board-header { padding: 1rem; border-bottom: 1px solid var(--line); }
.combat-log { line-height: 1.6; }
.decision-panel { border-top: 1px solid var(--moss); }
.decision-options { gap: .65rem; }
/* Inline lore and spatial map controls keep their content-sized geometry. */
.study-phrase-link, .combat-position-target { min-height: 0; }
.gift-key-form > div { align-items: start; }
.gift-key-form input, .gift-key-form button { margin: 0; min-height: 2.75rem; }

.game-opening {
  width: min(26rem, calc(100vw - 2rem));
  box-sizing: border-box;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel);
  color: var(--ink);
  text-align: center;
}
.game-opening::backdrop { background: rgb(0 0 0 / 80%); }
.game-opening h2 { margin: 1rem 0 .75rem; font-size: 1.4rem; }
.game-opening p { margin: 0; line-height: 1.6; color: var(--muted); }
.game-opening button { margin-top: 1.5rem; min-width: 6rem; }
.game-opening-spinner {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: game-opening-spin 1s linear infinite;
}
@keyframes game-opening-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .game-opening-spinner { animation: none; }
}

.signed-out #account-bar, .signed-out #landing-shell, .signed-out #game, .signed-out #gate { display: none; }
body.player-app.signed-out > main#main-content { width: 100%; max-width: none; margin: 0; padding: 0; }
.welcome {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: var(--night);
}
.welcome-copy > .theme-toggle { margin-bottom: 1.5rem; }
.welcome-copy { align-self: center; padding: clamp(2rem, 6vw, 7rem); }
.welcome-copy .elsewhere-wordmark { display: block; float: none; margin: 0 0 2rem; font-size: clamp(3.5rem, 6vw, 6.5rem); line-height: 1.2; }
.welcome-copy > p { max-width: 34rem; color: var(--muted); font-size: 1rem; line-height: 1.75; }
.welcome-copy .welcome-tagline { max-width: 24rem; color: var(--ink); font-family: Georgia, serif; font-size: clamp(1.4rem, 2.2vw, 2.2rem); line-height: 1.35; }
.welcome-sign-in { display: inline-flex; align-items: center; gap: 1rem; margin-top: 1.3rem; padding: .9rem 1.2rem; border-radius: .4rem; background: var(--moss); color: var(--on-accent); text-decoration: none; font-weight: 600; }
.welcome-sign-in:hover { background: var(--moss-bright); }
.welcome-copy small { display: block; margin-top: 1rem; color: var(--muted); line-height: 1.5; }
.welcome-adventure { position: relative; min-height: 38rem; overflow: hidden; display: flex; align-items: flex-end; background: var(--panel); }
.welcome-adventure > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.welcome-adventure::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, var(--night) 100%); }
.welcome-adventure-copy { position: relative; z-index: 1; padding: clamp(1.5rem, 4vw, 4rem); width: 100%; background: color-mix(in srgb, var(--night) 96%, transparent); color: var(--ink); }
.welcome-adventure-copy h2 { margin: .75rem 0; font-family: Georgia, serif; font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.8rem); }
.welcome-adventure-copy > p:not(.eyebrow) { max-width: 40rem; color: var(--muted); line-height: 1.6; }
#welcome-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
#welcome-controls button { min-width: 44px; min-height: 44px; padding: .5rem .75rem; background: var(--panel); border: 1px solid var(--control-line); color: var(--ink); }
#welcome-count { font-size: .8rem; color: var(--muted); }
#welcome-pause { margin-left: auto; font-size: .75rem; }
@media (max-width: 640px) {
  .welcome { grid-template-columns: minmax(0, 1fr); }
  .welcome-copy > .theme-toggle { margin-bottom: 1.5rem; }
.welcome-copy { padding: 1.5rem; }
  .welcome-copy .elsewhere-wordmark { margin-bottom: 1rem; }
  .welcome-copy > p { font-size: .9rem; }
  .welcome-sign-in { margin-top: .6rem; }
  .welcome-adventure { min-height: 28rem; }
}
.blueprint-inspector { margin: 1rem; padding: 1rem; border: 1px solid currentColor; border-radius: .5rem; font: .85rem/1.5 system-ui; }
.blueprint-inspector summary { cursor: pointer; }

.character-source { display: flex; gap: .75rem; flex-wrap: wrap; margin-block: 1rem 1.5rem; }
.character-source [aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 2px; }
#personal-sheet-picker { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
#personal-sheet-picker.hidden { display: none; }
#personal-sheet-select { display: block; width: 100%; margin-top: .5rem; }
