@import url("dice.css?v=20260731-play-ui");

:root {
  --bg0: #100c0a;
  --bg1: #1c1410;
  --bg2: #2a1c16;
  --ink: #f0e4d4;
  --ink-dim: #c4b09a;
  --muted: #9a8474;
  --ember: #e85d4c;
  --ember-deep: #a33a2e;
  --brass: #d4a574;
  --brass-hot: #f0b878;
  --ok: #7ecf8a;
  --panel: rgba(18, 12, 10, 0.82);
  --sheet: #1a1210;
  --line: rgba(240, 228, 212, 0.12);
  --line-strong: rgba(212, 165, 116, 0.35);
  --stage-edge: rgba(0, 0, 0, 0.55);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-story: "Literata", "Georgia", serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --dock-h: 3.1rem;
  --topbar-h: 3.25rem;
  --sheet-w: min(22rem, 34vw);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-mono);
  background: var(--bg0);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(120, 48, 32, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(60, 36, 20, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 10% 60%, rgba(40, 24, 16, 0.4) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
  background-attachment: fixed;
}

a { color: var(--brass); }

.hidden { display: none !important; }

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.nav-escape,
.nav-dev {
  position: fixed;
  top: 0.55rem;
  z-index: 40;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}
.nav-escape { left: 0.75rem; }
.nav-dev { right: 0.75rem; }
.nav-escape:hover,
.nav-dev:hover {
  opacity: 1;
  color: var(--brass-hot);
}

body.mode-play .nav-escape,
body.mode-play .nav-dev {
  opacity: 0.45;
}

.status-line {
  position: fixed;
  top: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  margin: 0;
  max-width: min(36rem, calc(100vw - 8rem));
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.status-line:empty { display: none; }
.status-line.error { color: #ff8d7d; }
.status-line.ok { color: var(--ok); }

/* ——— Screens ——— */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.screen-enter {
  animation: screen-in 0.55s var(--ease-out) both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(0.6rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ——— Create ——— */
.screen-create {
  display: grid;
  place-items: center;
  padding: 3.5rem 1.25rem 2.5rem;
}

.create-stage {
  width: min(28rem, 100%);
  text-align: center;
  animation: brand-rise 0.7s var(--ease-out) both;
}

@keyframes brand-rise {
  from {
    opacity: 0;
    transform: translateY(1.1rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.create-kicker {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
  text-shadow:
    0 0 40px rgba(232, 93, 76, 0.18),
    0 2px 0 rgba(0, 0, 0, 0.4);
}

.brand-hero {
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  line-height: 1.05;
  margin-bottom: 0.5rem;
}

.tagline {
  margin: 0 0 2.25rem;
  font-family: var(--font-story);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-style: italic;
  color: var(--ink-dim);
  line-height: 1.45;
}

.create-ritual {
  display: grid;
  gap: 0.85rem;
  text-align: left;
  padding: 1.35rem 1.25rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(42, 28, 22, 0.55) 0%, rgba(16, 12, 10, 0.72) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.create-progress-wrap { margin-bottom: 0.15rem; }

.create-dots {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.create-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(240, 228, 212, 0.18);
  border: 1px solid rgba(240, 228, 212, 0.2);
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.create-dots span.done {
  background: var(--brass);
  border-color: var(--brass-hot);
}
.create-dots span.current {
  background: var(--ember);
  border-color: #ff8a78;
  transform: scale(1.2);
}

.create-progress {
  margin: 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.create-q {
  display: grid;
  gap: 0.45rem;
  font-family: var(--font-story);
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.35;
}

.create-q span {
  font-weight: 600;
}

.create-q input {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.7rem 0.8rem;
  background: #0c0806;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 1px;
}
.create-q input:focus {
  outline: none;
  border-color: var(--brass);
}

.create-select {
  display: grid;
  gap: 0.4rem;
}
.create-option {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: #0c0806;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-story);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.create-option:hover, .create-option:focus-visible {
  border-color: var(--brass);
  background: rgba(201, 157, 93, 0.06);
}
.create-option strong {
  font-size: 1rem;
}
.create-option-blurb {
  font-size: 0.78rem;
  color: var(--muted, #b9a090);
  line-height: 1.3;
}

.btn-ritual {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.create-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.btn-random {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted, #b9a090);
  cursor: pointer;
}
.btn-random:hover {
  border-color: var(--brass);
  color: var(--ink);
}

/* ——— Start (mode select) ——— */
.screen-start {
  display: grid;
  place-items: center;
  padding: 3.5rem 1.25rem 2.5rem;
}

.start-stage {
  width: min(28rem, 100%);
  text-align: center;
  animation: brand-rise 0.7s var(--ease-out) both;
  display: grid;
  gap: 0.4rem;
}

.btn-start-primary {
  margin-top: 1.5rem;
  padding: 1.05rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(232, 93, 76, 0.25);
}

.start-lab {
  margin-top: 2.25rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.start-lab-label {
  margin: 0 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.start-lab-actions {
  display: grid;
  gap: 0.5rem;
}

.btn-lab {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted, #b9a090);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-lab:hover {
  border-color: var(--brass);
  color: var(--ink);
}

.create-back {
  justify-self: start;
  margin-bottom: 0.5rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0.2rem 0;
}
.create-back:hover { color: var(--brass-hot); }

/* ——— Loading ——— */
.screen-loading {
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.loading-stage {
  width: min(26rem, 100%);
}

.brand-loading {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.loading-title {
  font-family: var(--font-story);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  color: var(--ink-dim);
}

.loading-bar {
  margin-top: 1.25rem;
  height: 6px;
  background: #0c0806;
  border: 1px solid var(--line);
  overflow: hidden;
  border-radius: 1px;
}
.loading-bar > span {
  display: block;
  height: 100%;
  width: 28%;
  background: linear-gradient(90deg, var(--ember), var(--brass));
  animation: slide 1.35s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}

/* LE-MODES-001: detailed step-by-step loader for shared adventure map gen. */
.loading-steps {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  text-align: left;
  display: grid;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
}

.loading-step {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  align-items: baseline;
  gap: 0.15rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  transition: color 0.25s;
}

.loading-step-icon {
  text-align: center;
  font-weight: 700;
}

.loading-step-detail {
  grid-column: 2;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.85;
}

.loading-step--pending { color: var(--muted); opacity: 0.55; }
.loading-step--running { color: var(--brass-hot); }
.loading-step--running .loading-step-icon { animation: slide-pulse 1s ease-in-out infinite; }
.loading-step--done { color: var(--ok); }
.loading-step--done .loading-step-icon { color: var(--ok); }
.loading-step--error { color: #ff8d7d; }
.loading-step--error .loading-step-icon { color: #ff8d7d; }

@keyframes slide-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ——— Shared controls ——— */
input, textarea, select, button {
  font: inherit;
  color: var(--ink);
  background: #120c0a;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  border-radius: 1px;
}

textarea { min-height: 5rem; resize: vertical; }

button {
  cursor: pointer;
  background: linear-gradient(180deg, #5a2e24, #301812);
  border-color: #7a4538;
  transition: border-color 0.15s, color 0.15s, filter 0.15s;
}
button:hover:not(:disabled),
button:focus-visible {
  border-color: var(--brass);
  color: var(--brass-hot);
}
button.primary {
  background: linear-gradient(180deg, var(--ember), var(--ember-deep));
  border-color: #ff8a78;
  color: var(--ink);
}
button.primary:hover:not(:disabled),
button.primary:focus-visible {
  filter: brightness(1.08);
  color: #fff;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.muted { color: var(--muted); }
.error { color: #ff8d7d; }
.ok { color: var(--ok); }

/* ——— Play: one composition ——— */
.screen-play {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-top: var(--topbar-h);
  /* Always clear fixed play-dock (all widths) */
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
}

.play-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 0 1.1rem;
  z-index: 30;
  background: rgba(18, 12, 10, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
.play-topbar > * { pointer-events: auto; }

.brand-play {
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  letter-spacing: 0.1em;
  line-height: 1;
}

.play-top-meta {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
  min-width: 0;
}

.facing-chip {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  background: rgba(12, 8, 6, 0.6);
}
.facing-chip strong {
  color: var(--brass-hot);
  font-weight: 500;
  margin-left: 0.2rem;
}

.topbar-hp,
.topbar-gold {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.55rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-hp {
  color: var(--ember);
  border: 1px solid rgba(232, 93, 76, 0.28);
  background: rgba(12, 8, 6, 0.6);
}
.topbar-hp.is-low {
  color: #ff9a8a;
  border-color: rgba(232, 93, 76, 0.55);
}

.topbar-gold {
  color: #d4a726;
  border: 1px solid rgba(212, 167, 38, 0.3);
  background: rgba(12, 8, 6, 0.6);
}

.topbar-quests {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  color: #e8d48a;
  border-color: rgba(200, 170, 80, 0.35);
  background: rgba(42, 28, 22, 0.85);
}
.topbar-quests.hidden { display: none !important; }

#btn-sheet-toggle,
.btn-new-game {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  background: rgba(42, 28, 22, 0.85);
}

.btn-new-game {
  border-color: var(--line);
  color: var(--muted);
}
.btn-new-game:hover,
.btn-new-game:focus-visible {
  border-color: var(--ember);
  color: var(--ink);
}

.play-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sheet-w);
  overflow: hidden;
}

.play-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(14rem, 1fr);
  overflow: hidden;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  background: #050302;
  border-bottom: 1px solid var(--line);
}

.stage-frame {
  position: relative;
  /* Cap height first; derive width from 16:10 so max-height never warps the frame */
  width: min(100%, calc(min(48vh, 560px) * 16 / 10));
  aspect-ratio: 16 / 10;
  height: auto;
  max-height: min(48vh, 560px);
  margin: 0;
  background: #050302;
  box-shadow: inset 0 0 80px var(--stage-edge);
  overflow: hidden;
  flex-shrink: 0;
}

.view-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050302;
}

.view-stage img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: contrast(1.06) saturate(0.88) brightness(0.92);
}

.view-stage .overlay {
  position: absolute;
  bottom: 8%;
  width: 36%;
  max-height: 55%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6));
  background: transparent;
  pointer-events: none;
}

.view-stage .overlay.overlay-clickable,
.view-stage button.overlay {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* LE-P1-041: processed sprites — rely on PNG alpha, no matte box */
.view-stage .overlay.overlay-transparent {
  background: transparent;
  mix-blend-mode: normal;
}

.view-stage .overlay.anchor-center { left: 50%; transform: translateX(-50%); }
.view-stage .overlay.anchor-left { left: 12%; }
.view-stage .overlay.anchor-right { right: 12%; }
.view-stage .overlay.anchor-near-exit {
  left: 50%;
  transform: translateX(-50%);
  bottom: 18%;
  width: 28%;
}

/* Relative movement pad — bottom-right of room view */
.stage-move {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, 2.35rem);
  grid-template-rows: repeat(2, 2.35rem);
  gap: 0.22rem;
  pointer-events: none;
}

.stage-move button {
  pointer-events: auto;
  padding: 0;
  min-height: 0;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--ink);
  background: rgba(12, 8, 6, 0.78);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.stage-move button:hover {
  border-color: var(--brass-hot);
  color: var(--brass-hot);
}

.stage-move button:active {
  transform: translateY(1px);
}

.stage-move .turn-l { grid-column: 1; grid-row: 1; }
.stage-move .fwd { grid-column: 2; grid-row: 1; }
.stage-move .turn-r { grid-column: 3; grid-row: 1; }
.stage-move .back { grid-column: 2; grid-row: 2; }

/* LE-CBT-023: dice-theater overlay/HUD in dice.css; physics meshes in dice-theater.js.
   Shared with adventure/dev/combat-arena.html. Keep only stage-layout rules here. */

.stage-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: stretch;
  gap: 0.28rem;
  padding: 0.4rem 0.65rem;
  background: linear-gradient(180deg, #14100e 0%, #100c0a 100%);
  border-top: 1px solid var(--line);
}

.stage-quick > button,
.stage-quick > .ctx-chip {
  padding: 0.32rem 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #16100e;
  border-color: rgba(240, 228, 212, 0.16);
  min-height: 1.9rem;
}

.stage-quick > button:hover,
.stage-quick > .ctx-chip:hover {
  border-color: rgba(212, 165, 116, 0.45);
  color: var(--brass-hot);
}

.ctx-chip--dir {
  background: rgba(126, 207, 138, 0.06) !important;
  border-color: rgba(126, 207, 138, 0.25) !important;
  color: var(--ok) !important;
}
.ctx-chip--dir:hover {
  border-color: rgba(126, 207, 138, 0.5) !important;
  color: #b0f0bb !important;
}
.ctx-chip--verb {
  border-color: rgba(212, 165, 116, 0.25) !important;
  color: var(--brass) !important;
}
.ctx-chip--tab {
  border-color: rgba(200, 170, 80, 0.35) !important;
  color: #e8d48a !important;
}
.ctx-chip--tab:hover {
  border-color: rgba(232, 212, 138, 0.6) !important;
}

/* IF spine: transcript + command */
.if-spine {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  background: linear-gradient(180deg, #14100e 0%, #0e0a08 100%);
  border-top: 1px solid var(--line-strong);
  z-index: 5;
}

.room-text-wrap {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.room-text {
  margin: 0;
  padding: 0.55rem 2.2rem 0.4rem 1rem;
  font-family: var(--font-story);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-dim);
  white-space: pre-wrap;
  max-height: 4.2rem;
  overflow: hidden;
  scrollbar-width: thin;
  transition: max-height 0.25s var(--ease-out);
}

.room-text-wrap.expanded .room-text {
  max-height: 20rem;
  overflow: auto;
}

.room-collapse-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 1.6rem;
  height: 1.6rem;
  min-height: 0;
  min-width: 0;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  background: rgba(12, 8, 6, 0.7);
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}
.room-collapse-btn:hover {
  border-color: var(--brass);
  color: var(--brass-hot);
}
.room-text-wrap.expanded .room-collapse-btn {
  transform: rotate(180deg);
}

.log {
  min-height: 0;
  overflow: auto;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  line-height: 1.55;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.log .player { color: var(--brass-hot); }
.log .narrator {
  color: var(--ink);
  font-family: var(--font-story);
}
.log .system {
  color: var(--muted);
  font-style: italic;
}
.log .check,
.log .combat {
  color: var(--ok);
  font-family: var(--font-mono);
  border-left: 2px solid var(--ok);
  padding-left: 0.45rem;
  margin: 0.2rem 0;
}
.log .combat {
  border-left-color: var(--brass);
  color: var(--brass-hot);
}
.log .combat-miss {
  border-left-color: var(--muted);
  color: var(--muted);
  font-style: italic;
}
/* LE-QST-009: quest log lines */
.log .quest-log-line {
  border-left: 2px solid rgba(200, 170, 80, 0.5);
  padding-left: 0.45rem;
  margin: 0.2rem 0;
}

/* LE-UI-P2-006: expandable combat dice math — collapsible, reduced-motion safe */
.combat-dice-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.combat-dice-toggle:hover,
.combat-dice-toggle:focus-visible {
  color: var(--brass-hot);
}
.dice-toggle-caret {
  display: inline-block;
  font-size: 0.7em;
  color: var(--muted);
  transition: transform 0.18s var(--ease-out);
}
.combat-dice-toggle[aria-expanded="true"] .dice-toggle-caret {
  transform: rotate(90deg);
}
.combat-dice-detail {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-dim);
  border-left: 2px solid rgba(212, 165, 116, 0.3);
  padding-left: 0.5rem;
  margin-top: 0;
  transition: max-height 0.22s var(--ease-out), opacity 0.18s var(--ease-out), margin-top 0.22s var(--ease-out);
}
.combat-dice-detail.is-open {
  max-height: 8rem;
  opacity: 1;
  margin-top: 0.3rem;
}
.dice-detail-row + .dice-detail-row { margin-top: 0.15rem; }
.dice-detail-row strong {
  color: var(--brass);
  font-weight: 500;
  margin-right: 0.3rem;
}

/* LE-CBT-022: effectEvent chips in log (brass/ink; not a second combat panel). */
.log .effect {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.25rem 0;
  padding: 0;
  border: none;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  border: 1px solid rgba(212, 165, 116, 0.4);
  color: var(--brass-hot);
  background: linear-gradient(180deg, rgba(28, 20, 14, 0.92) 0%, rgba(12, 8, 5, 0.95) 100%);
}

.effect-chip--applied {
  border-color: rgba(212, 165, 116, 0.55);
  color: var(--brass-hot);
}

.effect-chip--cleared {
  border-color: rgba(138, 122, 106, 0.55);
  color: var(--muted);
}

.effect-chip--downed {
  border-color: rgba(180, 90, 70, 0.65);
  color: #e8a090;
}

.effect-chip--disarmed {
  border-color: rgba(200, 160, 90, 0.6);
  color: var(--brass);
}

.effect-chip--damage {
  border-color: rgba(180, 90, 70, 0.5);
  color: #d4a090;
}

.effect-chip--neutral {
  border-color: rgba(212, 165, 116, 0.35);
  color: var(--ink);
}

.effect-chip--victory {
  border-color: rgba(124, 184, 124, 0.7);
  color: #7cb87c;
  text-shadow: 0 0 8px rgba(124, 184, 124, 0.3);
}

/* LE-CBT-011: initiative log line */
.log .initiative-log {
  border-left: 2px solid rgba(180, 160, 120, 0.5);
  padding-left: 0.45rem;
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  margin: 0.15rem 0;
}
.initiative-chip {
  margin-right: 0.3em;
  font-size: 0.85em;
}

/* LE-CBT-050: in-combat indicator — pulsing border glow on the stage. */
.in-combat .view-stage {
  box-shadow: inset 0 0 18px 2px rgba(180, 60, 40, 0.18);
  transition: box-shadow 0.4s ease;
}

.in-combat .topbar-hp {
  animation: combat-pulse 2s ease-in-out infinite;
}

@keyframes combat-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; text-shadow: 0 0 6px rgba(224, 112, 112, 0.5); }
}

/* LE-CBT-050: damage numbers — float up from stage center then fade. */
.damage-number {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translateX(-50%) translateY(0);
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.6rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.damage-number--foe {
  color: #f0c070;
}

.damage-number--player {
  color: #e07070;
  left: 25%;
  top: 55%;
}

.damage-number--heal {
  color: #7cb87c;
}

/* LE-CBT-050: player-hit red border flash. */
.player-hit-flash {
  animation: player-hit-flash-anim 0.5s ease-out !important;
}

@keyframes player-hit-flash-anim {
  0% { box-shadow: inset 0 0 40px 8px rgba(220, 50, 30, 0.55); }
  100% { box-shadow: inset 0 0 0 0 rgba(220, 50, 30, 0); }
}

/* LE-CBT-050: entity hit white flash. */
.entity-hit-flash {
  animation: entity-hit-flash-anim 0.4s ease-out !important;
}

@keyframes entity-hit-flash-anim {
  0% { filter: brightness(2.2) saturate(0.3); }
  100% { filter: brightness(1) saturate(1); }
}

/* ==========================================================================
 * REUSABLE MOTION PRIMITIVES — LE-CBT-052 / combat UI juice
 * Use these classes anywhere for intentional feedback. Apply via JS, remove
 * after animationend. All respect prefers-reduced-motion at bottom of file.
 * ========================================================================== */

/* juice-shake: horizontal micro-shake (enemy hit, error feedback) */
.juice-shake {
  animation: juice-shake-anim 0.4s ease-out;
}
@keyframes juice-shake-anim {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(5px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(3px); }
  75%  { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

/* juice-flash: brief white brightness flash (impact moment) */
.juice-flash {
  animation: juice-flash-anim 0.3s ease-out;
}
@keyframes juice-flash-anim {
  0%   { filter: brightness(2.5) saturate(0.2); }
  50%  { filter: brightness(1.4) saturate(0.6); }
  100% { filter: brightness(1) saturate(1); }
}

/* juice-recoil: knocked-back spring (player hurt feedback) */
.juice-recoil {
  animation: juice-recoil-anim 0.35s ease-out;
}
@keyframes juice-recoil-anim {
  0%   { transform: translateY(0) scale(1); }
  25%  { transform: translateY(3px) scale(0.97); }
  60%  { transform: translateY(-2px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}

/* juice-float-number: floats element up + fades out (damage numbers) */
.juice-float-number {
  animation: juice-float-number-anim 1.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes juice-float-number-anim {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-14px) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.9); }
}

/* juice-spark: radial burst of particles (hit sparks) — applied to a container. */
.juice-spark {
  position: absolute;
  pointer-events: none;
  width: 0;
  height: 0;
}
.juice-spark::before,
.juice-spark::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass);
  animation: juice-spark-burst 0.5s ease-out forwards;
}
.juice-spark::before {
  animation-delay: 0s;
  --spark-x: -12px;
  --spark-y: -10px;
}
.juice-spark::after {
  animation-delay: 0.04s;
  --spark-x: 10px;
  --spark-y: -14px;
}
.juice-spark-extra {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  animation: juice-spark-burst 0.45s ease-out forwards;
}
@keyframes juice-spark-burst {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--spark-x, 8px), var(--spark-y, -12px)) scale(0.3); }
}

/* juice-victory: gold glow pulse (combat cleared) */
.juice-victory {
  animation: juice-victory-anim 0.8s ease-out;
}
@keyframes juice-victory-anim {
  0%   { box-shadow: inset 0 0 30px 6px rgba(200, 170, 80, 0.4); }
  50%  { box-shadow: inset 0 0 20px 3px rgba(200, 170, 80, 0.2); }
  100% { box-shadow: inset 0 0 0 0 rgba(200, 170, 80, 0); }
}

/* Bigger damage numbers (upgrade from original) */
.damage-number--big {
  font-size: 2.2rem;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 20px currentColor;
}
.damage-number--crit {
  font-size: 2.6rem;
  color: #f5d050;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8), 0 0 24px rgba(245, 208, 80, 0.5);
}

/* Stage flash strip — sits above move pad, shares dice overlay plane. */
.effect-flash {
  position: absolute;
  left: 50%;
  bottom: 3.4rem;
  transform: translateX(-50%) translateY(0.35rem);
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  max-width: min(92%, 22rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s var(--ease-out, ease), transform 0.22s var(--ease-out, ease);
}

.effect-flash.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.effect-flash[hidden] {
  display: none !important;
}

.effect-flash .effect-chip {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  animation: effect-chip-in 0.35s var(--ease-out, ease) both;
}

/* LE-QST-009: quest flash strip */
.quest-flash {
  position: absolute;
  left: 50%;
  top: 0.6rem;
  transform: translateX(-50%) translateY(-0.35rem);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  max-width: min(92%, 24rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease-out, ease), transform 0.25s var(--ease-out, ease);
}
.quest-flash.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.quest-flash[hidden] { display: none !important; }

.quest-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25em 0.65em;
  border-radius: 0.35em;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  animation: quest-chip-in 0.35s var(--ease-out, ease) both;
}
.quest-chip--offered {
  border-color: rgba(200, 170, 80, 0.6);
  color: #e8d48a;
}
.quest-chip--completed {
  border-color: rgba(100, 200, 120, 0.6);
  color: #8fd9a0;
}
.quest-chip--failed {
  border-color: rgba(200, 80, 80, 0.6);
  color: #d99090;
}
.quest-chip--objective {
  border-color: rgba(120, 180, 220, 0.5);
  color: #a0cce8;
}
.quest-chip--reward {
  border-color: rgba(200, 170, 80, 0.5);
  color: #e8d48a;
}
.quest-chip--stage {
  border-color: rgba(160, 130, 200, 0.5);
  color: #c4b0e0;
}

@keyframes quest-chip-in {
  from { opacity: 0; transform: translateY(-0.4rem) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes effect-chip-in {
  from {
    opacity: 0;
    transform: translateY(0.4rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.log .log-line-enter {
  animation: log-in 0.35s var(--ease-out) both;
}

@keyframes log-in {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.command-bar {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
  padding: 0.4rem 0.75rem 0.65rem;
  border-top: 1px solid var(--line);
}

.command-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  background: #0a0705;
  border: 1px solid var(--line-strong);
  padding-left: 0.55rem;
  border-radius: 1px;
  box-shadow: inset 0 1px 0 rgba(212, 165, 116, 0.08);
}
.command-label .prompt {
  color: var(--brass-hot);
  font-weight: 500;
  font-size: 1.05rem;
  user-select: none;
}
.command-label input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.6rem 0.55rem 0.6rem 0;
  min-width: 0;
  font-size: 0.9rem;
}
.command-label input:focus { outline: none; }
.command-label:focus-within {
  border-color: var(--brass-hot);
  box-shadow:
    inset 0 1px 0 rgba(212, 165, 116, 0.12),
    0 0 0 1px rgba(240, 184, 120, 0.15);
}

#btn-act {
  font-family: var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 0 1.1rem;
}

/* ——— Character sheet rail ——— */
.sheet-aside {
  position: relative;
  min-height: 0;
  background:
    linear-gradient(180deg, #1e1512 0%, #14100e 40%, #100c0a 100%);
  border-left: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 25;
}

/* LE-UI-P2-001: tabbed sheet rail — Character / Gear / Quests / Trade / Combat */
.rail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.6rem 2.4rem 0 0.75rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.rail-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.42rem 0.55rem;
  border-radius: 2px 2px 0 0;
  cursor: pointer;
}
.rail-tab:hover:not(.active) {
  color: var(--brass);
}
.rail-tab.active {
  color: var(--brass-hot);
  border-color: var(--line-strong);
  border-bottom-color: transparent;
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.14) 0%, transparent 100%);
}
.rail-tab[hidden] { display: none; }

.rail-panel {
  padding-top: 0.8rem;
}
.rail-panel[hidden] { display: none; }

.rail-empty {
  margin: 0;
  padding: 1.1rem 0.25rem;
  text-align: center;
  font-family: var(--font-story);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Quests tab */
.quest-section + .quest-section { margin-top: 1rem; }
.quest-section h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}
.quest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.quest-item {
  border: 1px solid var(--line);
  padding: 0.5rem 0.6rem;
  background: rgba(0, 0, 0, 0.22);
}
.quest-item--offered { border-color: rgba(200, 170, 80, 0.4); }
.quest-item--done { opacity: 0.75; }
.quest-item--failed { opacity: 0.65; }
.quest-item-title {
  font-size: 0.82rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.quest-item-desc {
  margin-top: 0.25rem;
  font-family: var(--font-story);
  font-size: 0.76rem;
  color: var(--ink-dim);
  line-height: 1.35;
}
.quest-status {
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  background: rgba(126, 207, 138, 0.12);
  color: var(--ok);
}
.quest-obj-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}
.quest-obj {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-dim);
}
.quest-obj--met {
  color: var(--muted);
  text-decoration: line-through;
}
.quest-obj-check {
  color: var(--brass);
  margin-right: 0.2rem;
}
.quest-item-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.quest-item-actions button {
  font-size: 0.66rem;
  padding: 0.3rem 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Trade tab */
.trade-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.trade-trader-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--brass-hot);
  letter-spacing: 0.03em;
}
.trade-gold {
  font-size: 0.72rem;
  color: #d4a726;
}
.trade-section + .trade-section {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.trade-section h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}
.trade-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.trade-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}
.trade-row:last-child { border-bottom: none; }
.trade-row--out { opacity: 0.55; }
.trade-item-name { color: var(--ink-dim); min-width: 0; }
.trade-item-price { color: var(--brass); font-size: 0.72rem; white-space: nowrap; }
.trade-row button {
  font-size: 0.64rem;
  padding: 0.28rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-height: 0;
}
.trade-empty {
  padding: 0.4rem 0;
  font-style: italic;
  font-family: var(--font-story);
  font-size: 0.78rem;
}
.trade-browse-btn {
  margin-top: 0.5rem;
  width: 100%;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Combat tab */
.combat-section + .combat-section {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.combat-section h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}
.combat-foe {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.combat-foe:last-child { border-bottom: none; }
.combat-foe-name {
  font-size: 0.8rem;
  color: var(--ember);
  font-weight: 600;
}
.combat-foe-hp {
  font-size: 0.7rem;
  color: var(--ink-dim);
  margin-top: 0.1rem;
}
.hp-bar {
  height: 4px;
  background: var(--bg2, rgba(0, 0, 0, 0.4));
  border-radius: 2px;
  margin-top: 0.25rem;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ember) 0%, var(--brass) 100%);
  border-radius: 2px;
}
.combat-foe-conds,
.combat-player-conds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}
.cond-tag {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  background: rgba(232, 169, 76, 0.15);
  border: 1px solid rgba(232, 169, 76, 0.35);
  color: #e8c98a;
  text-transform: lowercase;
}
.combat-recent-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--ink-dim);
}

/* LE-MAP-001/003/014: Map tab — CSS-grid room graph, fog-of-war, click-to-navigate */
.map-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.map-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--brass-hot);
  letter-spacing: 0.03em;
}
.map-progress {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--font-mono);
}
.map-grid {
  display: grid;
  gap: 0.15rem;
  overflow: auto;
  padding: 0.3rem 0.15rem 0.6rem;
  max-height: 22rem;
}
.map-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  cursor: pointer;
  text-align: center;
  border-radius: 2px;
}
.map-node:hover:not(:disabled) {
  border-color: rgba(212, 165, 116, 0.5);
  color: var(--brass-hot);
}
.map-node:disabled {
  cursor: default;
}
.map-node-label {
  font-size: 0.66rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  word-break: break-word;
}
.map-node--current {
  border-color: var(--ember);
  background: linear-gradient(180deg, rgba(232, 93, 76, 0.22) 0%, rgba(0, 0, 0, 0.28) 100%);
  color: var(--ember);
  box-shadow: 0 0 0 1px rgba(232, 93, 76, 0.35);
}
.map-node--current .map-node-label::before {
  content: "\2605 ";
}
.map-node--visited {
  border-color: rgba(212, 165, 116, 0.4);
  color: var(--brass);
}
.map-node--unknown {
  border-style: dashed;
  border-color: rgba(154, 132, 116, 0.4);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.12);
}
.map-node--quest {
  border-color: rgba(200, 170, 80, 0.6);
  box-shadow: inset 0 0 0 1px rgba(232, 212, 138, 0.25);
}
.map-node-markers {
  display: flex;
  gap: 0.18rem;
  flex-wrap: wrap;
  justify-content: center;
}
.map-edge {
  align-self: center;
  justify-self: center;
}
.map-edge--h {
  width: 100%;
  height: 2px;
  background: rgba(212, 165, 116, 0.4);
}
.map-edge--v {
  width: 2px;
  height: 100%;
  background: rgba(212, 165, 116, 0.4);
}
.map-edge--fog {
  background: repeating-linear-gradient(
    90deg,
    rgba(154, 132, 116, 0.45) 0,
    rgba(154, 132, 116, 0.45) 3px,
    transparent 3px,
    transparent 6px
  );
}
.map-edge--v.map-edge--fog {
  background: repeating-linear-gradient(
    180deg,
    rgba(154, 132, 116, 0.45) 0,
    rgba(154, 132, 116, 0.45) 3px,
    transparent 3px,
    transparent 6px
  );
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.5rem;
  margin-top: 0.3rem;
  border-top: 1px solid var(--line);
  font-size: 0.64rem;
  color: var(--muted);
  align-items: center;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.map-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  border: 1px solid rgba(240, 228, 212, 0.25);
}
.map-swatch--current { background: rgba(232, 93, 76, 0.5); border-color: var(--ember); }
.map-swatch--visited { background: rgba(212, 165, 116, 0.35); border-color: rgba(212, 165, 116, 0.5); }
.map-swatch--unknown { background: transparent; border-style: dashed; border-color: rgba(154, 132, 116, 0.6); }
.map-marker {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted);
}
.map-marker--hostile { background: var(--ember); }
.map-marker--npc { background: var(--ok); }
.map-marker--trade { background: #d4a726; }
.map-marker--quest { background: #e8d48a; box-shadow: 0 0 0 1px rgba(232, 212, 138, 0.6); }
.map-text-btn {
  margin-top: 0.6rem;
  width: 100%;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 0.85rem calc(1.25rem + var(--dock-h));
  scrollbar-width: thin;
}

.sheet-close {
  display: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.85rem;
  background: rgba(12, 8, 6, 0.85);
}

.sheet-hero {
  position: relative;
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.portrait-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 280px;
  background:
    radial-gradient(ellipse at 50% 30%, #2a1c18 0%, #0a0706 75%);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45);
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  image-rendering: pixelated;
}

.portrait-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0.45rem;
  border: 1px dashed var(--line);
}

.sheet-meta h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sheet-meta .muted {
  margin: 0.25rem 0 0.5rem;
  font-family: var(--font-story);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.35;
}

.hp-line {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--ember);
  letter-spacing: 0.04em;
}
.gold-line {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: #d4a726;
  letter-spacing: 0.04em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  font-size: 0.72rem;
}
.stats div {
  padding: 0.3rem 0.35rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  text-align: center;
}
.stats strong {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.1rem;
}

.gear-toggle {
  display: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.gear-body {
  display: grid;
  gap: 1rem;
}

.panel-head {
  display: grid;
  gap: 0.1rem;
  margin-bottom: 0.35rem;
}
.panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}
.panel-sub {
  margin: 0;
  font-size: 0.68rem;
}

.equip-grid {
  display: grid;
  font-size: 0.78rem;
}
.equip-grid .slot {
  display: grid;
  grid-template-columns: 5.25rem 1fr auto;
  gap: 0.35rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.38rem 0;
  min-height: 2rem;
}
.equip-grid .slot:last-child { border-bottom: none; }
.equip-grid .slot-name {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}
.equip-grid .slot-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
}
.equip-grid .slot-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.inv-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.inv-list .inv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.item-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 2px;
}

/* Pending asset overlay — spinner.svg over missing room/NPC/item art (LE-P1-062) */
.asset-frame {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 2px;
}
.asset-frame .item-thumb {
  width: 100%;
  height: 100%;
  background: transparent;
}
.asset-pending {
  background: rgba(20, 14, 12, 0.55);
}
.asset-loading {
  width: 1.35rem;
  height: 1.35rem;
  image-rendering: auto;
  opacity: 0.9;
  animation: asset-spin 0.9s linear infinite;
  transform-origin: 50% 50%;
}
.asset-loading-lg {
  width: 3rem;
  height: 3rem;
}
@keyframes asset-spin {
  to { transform: rotate(360deg); }
}
.view-pending {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 0.65rem;
  color: #b9a090;
  padding: 1rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(60, 40, 32, 0.45), transparent 65%),
    linear-gradient(180deg, #1a1210 0%, #0e0a08 100%);
}
.view-pending span {
  font-family: var(--font-ui, inherit);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.view-stage .overlay.overlay-pending {
  display: grid;
  place-items: center;
  width: 28%;
  max-height: 40%;
  background: transparent;
  pointer-events: none;
}
.item-modal-thumb-empty.asset-pending {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: 7rem;
}
.equip-grid .slot-empty .slot-item {
  color: var(--muted);
  font-style: italic;
  opacity: 0.7;
}

.inv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 0.82rem;
  scrollbar-width: thin;
}
.inv-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 0.38rem 0;
}
.inv-list li:last-child { border-bottom: none; }
.inv-list .inv-empty {
  display: block;
  padding: 0.7rem 0.2rem;
  text-align: center;
  border: none;
  font-style: italic;
  font-family: var(--font-story);
}
.inv-list .inv-meta { font-size: 0.68rem; }

.inv-list button,
.equip-grid button {
  padding: 0.25rem 0.45rem;
  font-size: 0.65rem;
  flex-shrink: 0;
  min-height: 1.85rem;
  min-width: 3.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.equip-grid .slot-preview,
.inv-list .inv-preview {
  cursor: pointer;
}
.equip-grid .slot-preview:hover,
.inv-list .inv-preview:hover {
  background: rgba(212, 165, 116, 0.06);
}
.equip-grid .slot-preview:focus-visible,
.inv-list .inv-preview:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

/* LE-UI-P1-006: clickable entity/item names in log/room text */
.entity-link {
  color: var(--brass);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(212, 165, 116, 0.35);
  text-underline-offset: 2px;
  transition: color 0.12s, text-decoration-color 0.12s;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  line-height: inherit;
}
.entity-link:hover,
.entity-link:focus-visible {
  color: var(--brass-hot);
  text-decoration-color: var(--brass-hot);
}

/* LE-UI-P1-007: action dock popover */
.action-dock {
  position: fixed;
  bottom: calc(var(--dock-h) + 3.8rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  min-width: 12rem;
  max-width: min(20rem, calc(100vw - 2rem));
  background:
    linear-gradient(165deg, rgba(42, 28, 22, 0.96) 0%, rgba(14, 10, 8, 0.98) 55%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  padding: 0.55rem 0.65rem 0.5rem;
  display: grid;
  gap: 0.4rem;
}
.action-dock.hidden { display: none; }
.action-dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.action-dock-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--brass-hot);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-dock-x {
  width: 1.6rem;
  height: 1.6rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  flex-shrink: 0;
}
.action-dock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.action-dock-actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-height: 1.85rem;
}

/* LE-UI-ACT-004: action wizard (stepped quick-actions) */
.action-wizard {
  position: fixed;
  bottom: calc(var(--dock-h) + 3.8rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 56;
  min-width: 14rem;
  max-width: min(26rem, calc(100vw - 2rem));
  background:
    linear-gradient(165deg, rgba(42, 28, 22, 0.97) 0%, rgba(14, 10, 8, 0.99) 55%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  padding: 0.55rem 0.65rem 0.5rem;
  display: grid;
  gap: 0.4rem;
}
.action-wizard.hidden { display: none; }
.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.4rem;
}
.wizard-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  overflow: hidden;
}
.wizard-crumb {
  padding: 0.15rem 0.35rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brass);
  background: transparent;
  border: 1px solid rgba(212, 165, 116, 0.2);
  cursor: pointer;
  white-space: nowrap;
}
.wizard-crumb:hover {
  border-color: var(--brass);
  color: var(--brass-hot);
}
.wizard-crumb-sep {
  color: var(--muted);
  font-size: 0.65rem;
  user-select: none;
}
.wizard-prompt {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--brass-hot);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wizard-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.wizard-option {
  min-height: 1.85rem;
}
.wizard-footer {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.15rem;
}
.wizard-back,
.wizard-cancel {
  padding: 0.2rem 0.45rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}
.wizard-back:hover,
.wizard-cancel:hover {
  border-color: var(--brass-dim, rgba(212, 165, 116, 0.35));
  color: var(--ink-dim);
}

.wizard-empty {
  color: var(--muted, #888);
  font-style: italic;
  font-size: 0.75rem;
  padding: 0.25rem 0;
}

/* LE-UI-P1-008: stage overlay click targets */
.view-stage .overlay-clickable {
  pointer-events: auto;
  cursor: pointer;
  transition: filter 0.15s;
}
.view-stage .overlay-clickable:hover {
  filter: drop-shadow(0 0 8px rgba(212, 165, 116, 0.6)) drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6));
}

/* LE-P1-051: item preview modal */
.item-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}
.item-modal-backdrop.hidden {
  display: none;
}
.item-modal {
  position: relative;
  width: min(22rem, 100%);
  max-height: min(88vh, 36rem);
  overflow: auto;
  padding: 1rem 1rem 0.85rem;
  background:
    linear-gradient(165deg, rgba(42, 28, 22, 0.95) 0%, rgba(18, 12, 10, 0.98) 55%),
    var(--sheet);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  scrollbar-width: thin;
}
.item-modal-x {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  min-width: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.item-modal-body {
  display: grid;
  gap: 0.55rem;
  padding-right: 1.5rem;
}
.item-modal-thumb {
  width: 100%;
  max-height: 11rem;
  height: 11rem;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}
.item-modal-thumb-empty {
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-style: italic;
}
.item-modal-body h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brass-hot);
  line-height: 1.25;
}
.item-modal-meta {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.item-modal-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}
.item-modal-block {
  display: grid;
  gap: 0.2rem;
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}
.item-modal-block > .muted {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.item-modal-block p {
  margin: 0;
  line-height: 1.45;
  color: var(--ink-dim);
  font-family: var(--font-story);
}
.item-modal-desc {
  white-space: pre-wrap;
}
.item-modal-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}
.item-modal-stats li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.item-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.item-modal-actions button {
  flex: 1 1 auto;
  min-height: 2.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

/* LE-CBT-051: loot picker modal */
.loot-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}
.loot-picker-backdrop.hidden {
  display: none;
}
.loot-picker {
  position: relative;
  width: min(22rem, 100%);
  max-height: min(80vh, 30rem);
  overflow: auto;
  padding: 1.1rem 1rem 0.9rem;
  background:
    linear-gradient(165deg, rgba(38, 32, 18, 0.96) 0%, rgba(16, 12, 8, 0.98) 55%),
    var(--sheet);
  border: 1px solid var(--brass);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(200, 170, 80, 0.12);
  scrollbar-width: thin;
}
.loot-picker-heading {
  margin: 0 0 0.75rem;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}
.loot-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.loot-row {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.4rem 0.5rem;
  transition: border-color 0.15s ease;
}
.loot-row:has(.loot-check:checked) {
  border-color: var(--brass);
  background: rgba(200, 170, 80, 0.06);
}
.loot-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.loot-check {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brass);
  flex-shrink: 0;
}
.loot-thumb {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border-radius: 2px;
  flex-shrink: 0;
}
.loot-thumb-empty {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  background: var(--line);
  border-radius: 2px;
}
.loot-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.loot-name {
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loot-meta {
  font-size: 0.68rem;
}
.loot-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.loot-picker-actions button {
  flex: 1 1 auto;
  min-height: 2.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}
.loot-picker-actions button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ——— LE-ACC-002: Start-screen Continue + Save Picker ——— */

.btn-start-continue {
  margin-top: 0.75rem;
  padding: 0.8rem 1.5rem;
  width: 100%;
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--brass);
  color: var(--brass);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-start-continue:hover {
  background: rgba(212, 165, 116, 0.12);
  border-color: var(--brass-hot);
  color: var(--brass-hot);
}

.save-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.save-picker-backdrop.hidden { display: none; }

.save-picker {
  position: relative;
  width: min(30rem, calc(100vw - 2rem));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.save-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.save-picker-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--brass);
}
.save-picker-x {
  padding: 0.3rem 0.45rem;
  font-size: 1.1rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.save-picker-x:hover { color: var(--ink); }

.save-picker-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 1.1rem;
}

.save-slot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.save-slot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.35rem 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}
.save-slot:hover {
  border-color: var(--brass);
  background: rgba(42, 28, 22, 0.9);
}
.save-slot--dead {
  opacity: 0.55;
}

.save-slot-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.save-slot-meta {
  grid-column: 1;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.45;
}

.save-slot-actions {
  grid-row: 1 / span 2;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-end;
}

.save-slot-load {
  padding: 0.35rem 0.85rem;
  font-size: 0.68rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--ember), var(--ember-deep));
  border: 1px solid #ff8a78;
  color: var(--ink);
  border-radius: 0.2rem;
  cursor: pointer;
}
.save-slot-load:hover { filter: brightness(1.1); }

.save-slot-delete {
  padding: 0.2rem 0.6rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
  border: 1px solid rgba(232, 93, 76, 0.3);
  color: var(--muted);
  border-radius: 0.2rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.save-slot-delete:hover {
  border-color: var(--ember);
  color: var(--ember);
}

.save-picker-empty {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--muted);
  font-family: var(--font-story);
  font-style: italic;
}

/* ——— Report block ——— */

.report-block {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.report-block > button {
  width: 100%;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.report-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.sheet-backdrop {
  display: none;
}

/* LE-P1-034: pinned on ALL widths — never static below the fold */
.play-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.55rem calc(0.4rem + env(safe-area-inset-bottom));
  background: rgba(10, 7, 5, 0.96);
  border: none;
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}
.play-dock.has-quests {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.play-dock button {
  padding: 0.5rem 0.3rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.play-dock .dock-new {
  color: var(--muted);
  border-color: var(--line);
}
.play-dock .dock-quests {
  color: #e8d48a;
  border-color: rgba(200, 170, 80, 0.35);
}
.play-dock .dock-quests.has-quests {
  border-color: rgba(200, 170, 80, 0.55);
  box-shadow: inset 0 0 0 1px rgba(232, 212, 138, 0.08);
}
.play-dock .dock-quests[hidden] {
  display: none;
}

.mobile-dock {
  display: none;
}

/* Desktop: sheet always in composition */
@media (min-width: 960px) {
  body.sheet-open #btn-sheet-toggle {
    border-color: var(--brass);
    color: var(--brass-hot);
  }

  .sheet-hero {
    grid-template-columns: minmax(110px, 42%) 1fr;
    align-items: start;
  }

  .portrait-frame {
    max-height: 240px;
  }

  /* Dock sits over bottom edge of rail — keep sheet content clear */
  .sheet-aside {
    padding-bottom: 0;
  }
}

/* Narrow / tablet: sheet slide-over — sticky play chrome stays reachable */
@media (max-width: 959px) {
  .play-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-aside {
    position: fixed;
    top: 0;
    right: 0;
    /* Leave sticky Command / You·Gear / Log chrome visible */
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
    width: min(22rem, 92vw);
    border-left: 1px solid var(--line-strong);
    transform: translateX(105%);
    transition: transform 0.38s var(--ease-sheet);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
    z-index: 25;
  }

  body.sheet-open .sheet-aside {
    transform: translateX(0);
  }

  .sheet-close {
    display: grid;
    place-items: center;
  }

  .sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
    z-index: 24;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sheet-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .play-main {
    grid-template-rows: auto minmax(12rem, 1fr);
  }

  .stage-frame {
    width: min(100%, calc(min(42vh, 480px) * 16 / 10));
    max-height: min(42vh, 480px);
  }

  #command-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }
}

/* Mobile */
@media (max-width: 859px) {
  :root {
    --cmd-bar-h: 3.35rem;
    --topbar-h: 2.85rem;
  }

  .play-top-meta .topbar-hp,
  .play-top-meta .topbar-gold {
    font-size: 0.65rem;
    padding: 0.22rem 0.4rem;
  }

  .play-top-meta .topbar-quests {
    display: none;
  }

  .screen-play {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: calc(var(--dock-h) + var(--cmd-bar-h) + env(safe-area-inset-bottom));
  }

  .play-layout {
    display: block;
    overflow: visible;
  }

  .play-main {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .stage-frame {
    width: min(100%, calc(min(36vh, 320px) * 16 / 10));
    max-height: min(36vh, 320px);
  }

  .stage-move {
    right: 0.4rem;
    bottom: 0.4rem;
    grid-template-columns: repeat(3, 2.55rem);
    grid-template-rows: repeat(2, 2.55rem);
  }

  .stage-quick {
    padding: 0.4rem 0.55rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, transparent 0, black 0.5rem, black calc(100% - 1.5rem), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 0.5rem, black calc(100% - 1.5rem), transparent 100%);
  }
  .stage-quick::-webkit-scrollbar { display: none; }

  .if-spine {
    display: flex;
    flex-direction: column;
    border-top: none;
  }

  .room-text {
    max-height: none;
    padding: 0.65rem 0.85rem;
  }

  .log {
    max-height: min(38vh, 280px);
    padding: 0.5rem 0.85rem;
    scroll-margin-bottom: calc(var(--dock-h) + var(--cmd-bar-h) + 1rem);
  }

  #command-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
    z-index: 27;
    margin: 0;
    padding: 0.4rem 0.65rem;
    background: rgba(10, 7, 5, 0.96);
    border-top: 1px solid var(--line-strong);
    backdrop-filter: blur(10px);
  }

  .gear-toggle {
    display: block;
  }

  #panel-gear:not(.gear-open) .gear-body {
    display: none;
  }
  #panel-gear.gear-open .gear-toggle::after { content: " ▴"; }
  #panel-gear:not(.gear-open) .gear-toggle::after { content: " ▾"; }

  .sheet-aside {
    padding-top: env(safe-area-inset-top);
    /* Above fixed command bar + dock */
    bottom: calc(var(--dock-h) + var(--cmd-bar-h) + env(safe-area-inset-bottom));
  }

  .sheet-backdrop {
    bottom: calc(var(--dock-h) + var(--cmd-bar-h) + env(safe-area-inset-bottom));
  }

  .sheet-hero {
    grid-template-columns: 88px 1fr;
    padding-top: 0.35rem;
  }

  .portrait-frame {
    max-height: 120px;
  }

  .inv-list {
    max-height: min(36vh, 260px);
  }

  #panel-gear,
  #stage-quick,
  #sheet-hero {
    scroll-margin-bottom: calc(var(--dock-h) + var(--cmd-bar-h) + 1rem);
  }

  .play-top-meta .btn-new-game {
    display: none; /* New is on sticky dock on phones */
  }
}

@media (max-width: 420px) {
  .stage-quick > button {
    font-size: 0.6rem;
    padding: 0.25rem 0.35rem;
  }

  .stage-move {
    grid-template-columns: repeat(3, 2.35rem);
    grid-template-rows: repeat(2, 2.35rem);
  }

  .brand-hero {
    font-size: clamp(2.2rem, 11vw, 3.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.screen-enter,
  .create-stage,
  .log .log-line-enter,
  .sheet-aside,
  .effect-flash,
  .effect-flash .effect-chip,
  .quest-flash,
  .quest-flash .quest-chip,
  .room-text,
  .room-collapse-btn {
    animation: none !important;
    transition: none !important;
  }
  .effect-flash.is-visible {
    transform: translateX(-50%) translateY(0);
  }
  .quest-flash.is-visible {
    transform: translateX(-50%) translateY(0);
  }
  .action-dock,
  .action-dock-actions button,
  .action-wizard,
  .wizard-option {
    animation: none !important;
    transition: none !important;
  }
  .combat-dice-detail,
  .dice-toggle-caret {
    transition: none !important;
  }
  /* LE-CBT-052: motion primitives snap to final state */
  .juice-shake,
  .juice-flash,
  .juice-recoil,
  .juice-float-number,
  .juice-spark,
  .juice-spark::before,
  .juice-spark::after,
  .juice-spark-extra,
  .juice-victory,
  .damage-number,
  .entity-hit-flash,
  .player-hit-flash {
    animation: none !important;
    transition: none !important;
  }
  /* LE-P1-062: spinner stays visible as a static ring, just doesn't spin. */
  .asset-loading {
    animation: none !important;
  }
}
