/* ===========================================================================
   realm.css — The look of the whole website (dark & gothic).

   LESSON: CSS describes how things LOOK. The ":root" block below defines
   "variables" — named colors and fonts — and the rest of the file uses them.
   Want a different red everywhere? Change --blood once.
   =========================================================================== */

:root {
  --bg: #0E0B0A;          /* page background, almost black */
  --panel: #17110F;       /* boxes */
  --panel-dark: #120E0C;  /* side panels and bars */
  --line: #2A1F19;        /* thin dividers */
  --frame: #4A3628;       /* box borders */
  --bone: #E8DFD0;        /* main text */
  --muted: #A89C8C;       /* quieter text */
  --faint: #8C8072;       /* quietest text */
  --gold: #C2A36B;
  --gold-bright: #E3C78F;
  --blood: #7A1515;       /* buttons */
  --blood-edge: #A33A2A;
  --monster: #E0483A;     /* creature names */
  --display: 'Cinzel', Georgia, serif;
  --body: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--bone); font-family: var(--body); }
a { color: var(--gold); }
a:hover { color: var(--gold-bright); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- shared pieces ---------- */

.label {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.18em;
  color: var(--muted); text-transform: uppercase;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.input {
  height: 48px; padding: 0 14px; background: var(--bg); border: 1px solid var(--frame);
  border-radius: 0; color: var(--bone); font: inherit; font-size: 19px; width: 100%;
}
.input::placeholder { color: #7A6E62; }
.btn-blood {
  height: 52px; padding: 0 24px; border: 1px solid var(--blood-edge); border-radius: 0;
  background: var(--blood); color: #F3EADB; font-family: var(--display); font-weight: 700;
  font-size: 15px; letter-spacing: 0.22em; cursor: pointer;
}
.btn-blood:hover { background: #8E1E1A; }
.btn-blood:disabled { opacity: 0.6; cursor: wait; }
.btn-ghost {
  min-height: 44px; padding: 0 16px; background: transparent; border: 1px solid #3A2A22;
  color: var(--muted); font-family: var(--display); font-size: 12px; letter-spacing: 0.16em;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn-ghost:hover { color: var(--bone); border-color: var(--frame); }
.error { min-height: 1.4em; margin: 0; color: var(--monster); font-size: 18px; text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: #C9BFAF; }

/* ---------- landing / sign-in / characters pages ---------- */

.page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.topnav {
  width: 100%; max-width: 1200px; padding: 28px 32px; display: flex; flex-wrap: wrap;
  gap: 32px; justify-content: center; font-family: var(--display); font-size: 13px; letter-spacing: 0.22em;
}
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--bone); }
.hero { padding: 32px 32px 8px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.hero h1 {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(40px, 7vw, 68px);
  letter-spacing: 0.12em; line-height: 1.05;
}
.tagline { margin: 0; font-style: italic; font-size: 24px; color: var(--muted); max-width: 560px; line-height: 1.4; }
.divider { width: min(320px, 80%); height: auto; }

.panel {
  width: calc(100% - 48px); max-width: 440px; margin: 40px 24px 0; background: var(--panel);
  border: 1px solid var(--frame); outline: 1px solid var(--line); outline-offset: 6px;
  padding: 40px 36px; display: flex; flex-direction: column; gap: 22px;
}
.panel h2 {
  margin: 0; text-align: center; font-family: var(--display); font-size: 20px; font-weight: 500;
  letter-spacing: 0.2em; color: var(--gold);
}
.panel .switch { margin: 0; text-align: center; font-size: 18px; color: var(--muted); }
.panel .mudlet { margin: 0; text-align: center; font-size: 15px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 16px; }
.linklike { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; cursor: pointer; font: inherit; }
.linklike:hover { color: var(--gold-bright); }

/* The sign-in and character pages' "Today in the March" (common.js showNews).
   LESSON: .front-row is a "flexbox": its boxes sit side by side, and
   flex-wrap lets the news drop below the main box when the screen is too
   narrow for both (phones). */
.front-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; width: 100%; max-width: 1040px; }
.front-row > .panel { flex: 1 1 360px; }
.today-panel { gap: 14px; padding: 28px 32px; max-width: 400px; }
.today-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.today-list li { font-size: 18px; line-height: 1.45; color: #B8AC9C; padding-left: 16px; border-left: 2px solid var(--line); }
.today-list li strong { color: var(--bone); font-weight: 600; }
.today-list li.today-raid { border-left-color: var(--blood); }
.today-list li.today-quiet { border-left: 0; padding-left: 0; text-align: center; font-style: italic; color: var(--muted); }
.today-foot { margin: 0; text-align: center; font-size: 14px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 12px; }
.today-foot a { color: var(--gold); }

.features {
  width: 100%; max-width: 1100px; padding: 88px 32px 72px; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 48px; text-align: center;
}
.features h3 { margin: 0 0 12px; font-family: var(--display); font-size: 17px; font-weight: 500; letter-spacing: 0.16em; color: var(--gold); }
.features p { margin: 0; font-size: 19px; line-height: 1.55; color: #B8AC9C; }
.footer {
  margin-top: auto; width: 100%; border-top: 1px solid var(--line); padding: 24px 32px; text-align: center;
  font-family: var(--display); font-size: 12px; letter-spacing: 0.2em; color: var(--faint);
}

.char-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.char-btn {
  width: 100%; min-height: 56px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--frame); color: var(--bone); cursor: pointer;
  font-family: var(--display); font-size: 17px; letter-spacing: 0.1em;
}
.char-btn:hover { border-color: var(--gold); }
.char-btn .go { font-size: 12px; letter-spacing: 0.2em; color: var(--gold); }
.empty { margin: 0; text-align: center; font-style: italic; font-size: 19px; color: var(--muted); }
.row { display: flex; gap: 10px; }
.row .input { flex: 1; min-width: 0; }
.row .btn-blood { height: 48px; font-size: 13px; padding: 0 18px; }
.account-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; color: var(--muted); }

/* ---------- play screen ---------- */

.play { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.play-header {
  border-bottom: 1px solid var(--line); background: var(--panel-dark); padding: 10px 20px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: 0.18em; }
.room-name { font-family: var(--display); font-size: 14px; letter-spacing: 0.16em; color: var(--gold); text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; background: transparent; border: 1px solid var(--frame); color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--bone); border-color: var(--frame); }

.play-body { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--left-w, 270px) 6px minmax(0, 1fr) 6px var(--right-w, 290px); }
.side {
  background: var(--panel-dark); padding: 22px 20px; display: flex; flex-direction: column; gap: 26px;
  overflow-y: auto; min-height: 0;
}
.side.left { border-right: 1px solid var(--line); }
.side.right { border-left: 1px solid var(--line); }
.block { display: flex; flex-direction: column; gap: 10px; }
.block .label { font-size: 11px; }

.minimap { width: 100%; max-width: 260px; align-self: center; height: auto; background: var(--bg); border: 1px solid var(--line); }
.exits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.exit-btn {
  height: 44px; background: var(--panel); border: 1px solid var(--frame); color: var(--bone);
  font-family: var(--display); font-size: 12px; letter-spacing: 0.06em; cursor: pointer;
}
.exit-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.exit-btn:disabled { background: transparent; border-color: var(--panel); color: var(--faint); cursor: default; }
.extra-exits { display: flex; flex-wrap: wrap; gap: 6px; }
.extra-exits .exit-btn { padding: 0 12px; flex: 1 1 auto; }
.who { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 18px; }
.who li { display: flex; align-items: center; gap: 10px; }
.who li::before { content: ''; width: 7px; height: 7px; background: #8FA87A; flex: none; }

.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.output {
  flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px; font-size: var(--story-size, 20px); line-height: 1.55;
  font-family: var(--story-font, var(--body)); white-space: pre-wrap; overflow-wrap: anywhere;
}
.output .line { margin: 0 0 6px; }
.output .echo { color: var(--faint); font-size: 16px; font-style: italic; }
.cmd-bar { border-top: 1px solid var(--line); background: var(--panel-dark); padding: 14px 20px; display: flex; gap: 12px; align-items: center; }
.cmd-bar label { font-family: var(--display); font-size: 22px; color: var(--gold); }
.cmd-bar .input { flex: 1; min-width: 0; font-size: 20px; }
.cmd-bar .btn-blood { height: 48px; font-size: 13px; letter-spacing: 0.2em; }

.char-name { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: 0.08em; }
.char-sub { font-style: italic; font-size: 17px; color: var(--muted); }
.vital { display: flex; flex-direction: column; gap: 6px; }
.vital-top { display: flex; justify-content: space-between; font-family: var(--display); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); }
.vital-top span:last-child { color: var(--bone); }
.bar { height: 8px; background: var(--panel); border: 1px solid var(--frame); }
.bar > div { height: 100%; width: 0; transition: width 0.3s ease; }
.bar-health > div { background: #A62B22; }
.bar-mana > div { background: #5A6FB0; }
.bar-stamina > div { background: var(--gold); }
.bar-spirit > div { background: #8C7AA8; }
.pips { display: flex; gap: 4px; }
.pips div { flex: 1; height: 10px; background: var(--panel); border: 1px solid var(--frame); }
.pips div.on { background: var(--gold); border-color: var(--gold); }
.small { font-size: 16px; color: var(--muted); }
.hands { font-size: 17px; line-height: 1.5; }

.injury-wrap { display: flex; gap: 16px; align-items: center; }
.body-part { fill: var(--panel); stroke: var(--frame); stroke-width: 1.5; }
.body-part.minor { fill: var(--gold); stroke: var(--gold-bright); }
.body-part.serious { fill: #A62B22; stroke: var(--monster); }
.body-part.grievous { fill: #5A0D0D; stroke: var(--monster); stroke-width: 2; }
/* A part that is gone (severed, put out): empty, dashed red, crossed out (common.js markDollPart). */
.body-part.severed { fill: transparent; stroke: var(--monster); stroke-dasharray: 3 2; }
.sever-x { stroke: var(--monster); stroke-width: 2.5; stroke-linecap: round; pointer-events: none; }
.injury-list { display: flex; flex-direction: column; gap: 10px; font-size: 16px; line-height: 1.35; }
.injury-list .minor { color: var(--gold-bright); font-weight: 600; }
.injury-list .serious { color: var(--monster); font-weight: 600; }
.injury-list .grievous { color: var(--monster); font-weight: 700; }
.injury-list .severed { color: var(--monster); font-weight: 700; text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; display: inline-block; }
.swatch.ok { background: var(--panel); border: 1px solid var(--frame); }
.swatch.minor { background: var(--gold); }
.swatch.serious { background: #A62B22; }
.swatch.grievous { background: #5A0D0D; border: 1px solid var(--monster); }
.swatch.severed { background: transparent; border: 1px dashed var(--monster); }
/* Injuries panel extras: optional vitals + round timer (InjuryExtras in js/ui-layout.js).
   Same bar colors as the Vitals panel; the panel's own gap spaces them, and
   hidden boxes take no room at all. */
.inj-extra { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); container-type: inline-size; }
.mini-vital, .mini-rt { display: grid; grid-template-columns: 4.6em minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.mini-rt { grid-template-columns: 4.6em minmax(0, 1fr); }
.mv-name { font-family: var(--display); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.mv-num { font-size: 14px; color: var(--bone); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-vital .bar { height: 6px; }
.mini-rt .pips div { height: 8px; }
.inj-extra .rt-text { font-size: 14px; }
/* A very narrow column: name and number on one line, the bar full width under them. */
@container (max-width: 210px) {
  .mini-vital { grid-template-columns: minmax(0, 1fr) auto; row-gap: 3px; }
  .mini-vital .bar { grid-column: 1 / -1; grid-row: 2; }
  .mini-rt { grid-template-columns: minmax(0, 1fr); row-gap: 3px; }
}
.inj-toggles { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.inj-toggle {
  padding: 3px 8px; background: transparent; border: 1px solid var(--line); color: var(--faint); cursor: pointer;
  font-family: var(--display); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.2;
}
.inj-toggle:hover { color: var(--bone); border-color: var(--frame); }
.inj-toggle.on { color: var(--gold-bright); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.inj-toggle:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

.notice {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 10;
  background: var(--panel); border: 1px solid var(--frame); padding: 14px 20px; font-size: 18px;
}


/* ---------- colors inside the story text (from the game's color tags) ---------- */

.c-room { color: var(--gold); font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.1em; }
.c-exits { color: #8FA87A; }
.c-speech { color: #9FB6C9; }
.c-tell { color: #C99FD6; }
.c-chat { color: #7FD0D6; }
.c-shout { color: #E0C060; font-weight: 700; }
.c-gsay { color: #8FD18A; }
.c-mail { color: #C2A36B; }
.c-monster { color: var(--monster); font-weight: 700; }
.c-player { color: var(--bone); font-weight: 600; }
/* "You" in combat lines meant for you (the {you} tag; color picked in Settings → Look) */
.c-you { color: #F0C75E; font-weight: 700; }
.c-item { color: #D9C27A; }
/* Item rarity colors (keep in step with content/items/rarity.json) */
.c-uncommon { color: #8FC97A; }
.c-rare { color: #7AA7E0; font-weight: 600; }
.c-epic { color: #B88AE6; font-weight: 600; }
.c-legendary { color: #F0A04B; font-weight: 700; text-shadow: 0 0 6px rgba(240, 160, 75, 0.35); }
.c-system { color: var(--muted); font-style: italic; }
.c-warn { color: #D9A35A; }
.c-good { color: #8FA87A; font-weight: 600; }
.c-emote { color: var(--muted); font-style: italic; }
.c-bold { font-weight: 700; }
.c-red, .c-bred { color: var(--monster); }
.c-green, .c-bgreen { color: #8FA87A; }
.c-yellow, .c-byellow { color: #D9C27A; }
.c-blue, .c-bblue { color: #8FA8D9; }
.c-magenta { color: #B58FC9; }
.c-cyan, .c-bcyan { color: #9FB6C9; }
.c-white, .c-bwhite { color: var(--bone); }
.c-gray { color: var(--faint); }
.c-gold { color: var(--gold); }
.mono-block { font-family: ui-monospace, Consolas, 'Courier New', monospace; font-size: 15px; line-height: 1.6; }
.c-bred, .c-bgreen, .c-byellow, .c-bblue, .c-bcyan, .c-bwhite { font-weight: 700; }

/* ---------- character creation wizard ---------- */

.hero-small { padding-top: 28px; gap: 10px; }
.hero-small h1 { font-size: clamp(28px, 5vw, 44px); }
.center { text-align: center; margin: 24px 0 0; }
.invisible { visibility: hidden; }

.steps {
  list-style: none; margin: 24px 0 0; padding: 0 16px; display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center;
  font-family: var(--display); font-size: 12px; letter-spacing: 0.18em; color: #6E6356; counter-reset: step;
}
.steps li { text-transform: uppercase; counter-increment: step; }
.steps li::before { content: counter(step) ". "; }
.steps li.done { color: var(--muted); }
.steps li.now { color: var(--gold); }

.panel.wizard { max-width: 980px; }
.sub-h { margin-top: 18px !important; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.card {
  text-align: left; background: var(--bg); border: 1px solid var(--frame); color: var(--bone); padding: 16px 18px;
  cursor: pointer; display: flex; flex-direction: column; gap: 8px; font-family: var(--body); font-size: 17px; line-height: 1.4;
}
.card:hover { border-color: var(--gold); }
.card[aria-pressed="true"] { border-color: var(--gold); background: #1E1612; box-shadow: inset 0 0 0 1px var(--gold); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.08em; }
.card[aria-pressed="true"] .card-title { color: var(--gold-bright); }
.card-tag { font-family: var(--display); font-size: 11px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.card-desc { color: #C9BFAF; }
.card-meta { font-size: 15px; color: var(--gold); }
.card-perk { font-size: 15px; font-style: italic; color: var(--muted); }

.stat-head, .stat-row { display: grid; grid-template-columns: minmax(120px, 1fr) 170px 60px 60px; gap: 12px; align-items: center; }
.stat-head { font-family: var(--display); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.stat-row { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 19px; }
.stat-row.prime .stat-name, .prime-word { color: var(--gold-bright); }
.stat-ctl { display: flex; gap: 6px; align-items: center; }
.step-btn {
  width: 44px; height: 44px; background: #241A16; border: 1px solid #7A6450; color: var(--bone); font-size: 20px; cursor: pointer;
}
.step-btn:hover { border-color: var(--gold); }
.stat-input { height: 44px; width: 70px; text-align: center; padding: 0 4px; font-size: 19px; }
.stat-final { text-align: center; }
.stat-bonus { text-align: center; color: var(--gold); }
.stat-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 19px; padding-top: 8px; }
#points-left.bad { color: var(--monster); }

.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
select.input { appearance: auto; }
.preview { background: var(--bg); border: 1px solid var(--line); padding: 16px 20px; font-size: 19px; line-height: 1.5; }
.preview p { margin: 0 0 8px; }
.review-title { font-family: var(--display); font-size: 20px; letter-spacing: 0.08em; color: var(--gold-bright); }
.wizard-nav { display: flex; justify-content: space-between; gap: 12px; }
.char-btn .summary { font-family: var(--body); font-size: 15px; letter-spacing: 0; color: var(--muted); display: block; }

@media (max-width: 600px) {
  .stat-head, .stat-row { grid-template-columns: 1fr 150px 44px 44px; gap: 6px; font-size: 17px; }
  .step-btn { width: 40px; }
  .stat-input { width: 58px; }
}
.btn-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-link:hover { color: #F3EADB; }
.cards-two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; margin: 0 auto; width: 100%; }
.cards-two .card { align-items: center; }
.review-look p, .review-look { margin: 0 0 8px; white-space: pre-wrap; }
#look-preview { white-space: pre-wrap; }

/* Stat pop-ups: hidden until you hover the stat's name or tab into its row. */
.stat-name { position: relative; cursor: help; text-decoration: underline dotted rgba(194, 163, 107, 0.5); text-underline-offset: 4px; }
.stat-tip {
  display: none; position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; width: min(340px, 80vw);
  background: #1E1612; border: 1px solid var(--gold); padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-family: var(--body); font-size: 16px; line-height: 1.45; color: var(--bone); text-decoration: none; cursor: default;
}
.stat-name:hover .stat-tip, .stat-row:focus-within .stat-tip { display: block; }
.stat-tip-title { font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; color: var(--gold-bright); text-transform: uppercase; margin-bottom: 6px; }
.stat-tip-tp { margin-top: 6px; font-size: 14px; font-style: italic; color: var(--muted); }
.wizard section[data-step] { display: flex; flex-direction: column; gap: 18px; }
.look-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.look-grid [data-field="scars"] { grid-column: 1 / -1; }

/* ---- Step 5: status line, group panel, bleeding ---- */
.status-line { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 15px; color: var(--muted); margin-top: 4px; }
.status-line .st-silver { color: var(--gold, #C2A36B); }
.status-line .st-dead { color: #E0483A; font-weight: 700; letter-spacing: .08em; }
.status-line .st-chill { color: #8FB4D9; }
.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 17px; }
.group-list li { display: flex; flex-direction: column; gap: 3px; }
.group-list .gm-name.away { opacity: .55; font-style: italic; }
.group-list li.dead .gm-name { color: #E0483A; text-decoration: line-through; }
.group-list .gm-bar { height: 5px; }
#body .body-part.bleeding, svg.doll .body-part.bleeding { animation: bleed-pulse 1.2s ease-in-out infinite; }
@keyframes bleed-pulse { 50% { opacity: .45; } }

/* ---- Targeting ---- */
.status-line .st-target { color: #E0483A; }
.group-list .gm-target { font-size: 14px; color: #E0483A; font-style: italic; }
.creature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.creature-btn { width: 100%; text-align: left; background: var(--panel-dark); border: 1px solid var(--line); color: var(--bone);
  padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; }
.creature-btn:hover { border-color: var(--frame); }
.creature-btn.mine { border-color: #7A1515; box-shadow: inset 3px 0 0 #E0483A; }
.creature-btn .cr-name { color: #E0483A; font-weight: 700; font-size: 16px; }
.creature-btn .cr-info { color: var(--muted); font-size: 14px; font-style: italic; }

/* ---- Shop panel ---- */
.shop-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.shop-btn { width: 100%; display: flex; justify-content: space-between; gap: 8px; background: var(--panel-dark); border: 1px solid var(--line);
  color: var(--bone); padding: 4px 8px; cursor: pointer; font: inherit; font-size: 15px; text-align: left; }
.shop-btn:hover { border-color: var(--frame); }
.shop-btn .sh-price { color: var(--gold-bright); white-space: nowrap; }
.shop-btn .sh-price::after { content: ' s'; color: var(--muted); }
.sh-name.r-common { color: #D9C27A; } .sh-name.r-uncommon { color: #8FC97A; } .sh-name.r-rare { color: #7AA7E0; } .sh-name.r-epic { color: #B88AE6; } .sh-name.r-legendary { color: #F0A04B; }

/* ---- Creation: Skills step ---- */
.tp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 6px 0 14px; }
.tp-bar strong { color: var(--gold-bright); font-size: 20px; }
.tp-bar strong.bad { color: #E0483A; }
.skill-head, .skill-row { display: grid; grid-template-columns: 1fr 90px 150px 60px; align-items: center; gap: 10px; }
.skill-head { font-size: 11px; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; padding: 0 4px 6px; border-bottom: 1px solid var(--line); }
.skill-group { font-family: var(--display); color: var(--gold); font-size: 12px; letter-spacing: .18em; margin: 14px 0 4px; }
.skill-row { padding: 4px; border-bottom: 1px solid var(--line); }
.skill-row.trained .skill-name { color: var(--gold-bright); }
.skill-name { position: relative; cursor: help; }
.skill-name:focus .stat-tip { display: block; }
.skill-cost { color: var(--muted); font-variant-numeric: tabular-nums; }
.skill-cost.dim { opacity: .45; }
.skill-ranks { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.step-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 640px) { .skill-head, .skill-row { grid-template-columns: 1fr 60px 120px 40px; } }

/* ---- Magic: spells and effects ---- */
.status-line .st-hidden { color: #8FA3B8; font-style: italic; }
.spell-list, .effect-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.spell-list li { display: flex; gap: 4px; }
.spell-btn { flex: 1; display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; text-align: left;
  background: var(--panel-dark); border: 1px solid var(--line); color: var(--bone); padding: 4px 8px; font: inherit; font-size: 15px; cursor: pointer; }
.spell-btn:hover { border-color: var(--frame); }
.spell-btn .sp-num { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.spell-btn .sp-mana { color: #8FB4D9; font-variant-numeric: tabular-nums; font-size: 13px; }
.spell-btn.kind-bolt .sp-name, .spell-btn.kind-warding .sp-name { color: #E8A07A; }
.spell-btn.kind-heal .sp-name { color: #9FD39A; }
/* The prepared spell: its whole row turns gold (after the kind colors, so it wins). */
.spell-btn.ready { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 26%, var(--panel-dark)); box-shadow: inset 4px 0 0 var(--gold); }
.spell-btn.ready .sp-name, .spell-btn.ready .sp-num, .spell-btn.ready .sp-mana { color: var(--bone); font-weight: 700; }
.spell-group { width: 30px; background: var(--panel-dark); border: 1px solid var(--line); color: var(--gold); font: inherit; font-size: 13px; cursor: pointer; }
.spell-group:hover { border-color: var(--gold); }
.g-key { color: var(--gold); border: 1px solid var(--line); padding: 0 4px; }
.effect-list li { display: flex; justify-content: space-between; font-size: 15px; color: #9FD39A; }
.effect-list li.harmful { color: #E0483A; }
.effect-list .fx-time { color: var(--muted); font-variant-numeric: tabular-nums; }
/* Quests panel (read-only; click for QUESTS <n>) */
.quest-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.quest-btn { width: 100%; text-align: left; background: none; border: 1px solid var(--line, #3a2f28); border-radius: 4px; padding: 4px 6px; color: inherit; font: inherit; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 0 6px; }
.quest-btn:hover, .quest-btn:focus-visible { border-color: var(--gold, #C2A36B); }
.quest-btn .q-title { color: var(--gold, #C2A36B); }
.quest-btn .q-kind { color: var(--muted); font-size: 13px; }
.quest-btn .q-now { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }

/* Explore panel (read-only; click for EXPLORE <zone>) */
.explore-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.explore-btn { width: 100%; text-align: left; background: none; border: 1px solid var(--line, #3a2f28); border-radius: 4px; padding: 3px 6px; color: inherit; font: inherit; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.explore-btn:hover, .explore-btn:focus-visible { border-color: var(--gold, #C2A36B); }
.explore-btn .e-name { color: var(--gold, #C2A36B); }
.explore-btn .e-count { color: var(--muted); font-size: 14px; }
.explore-btn.done .e-count { color: var(--good, #7fae6a); }
.group-list .gm-effects { font-size: 13px; color: #9FD39A; font-style: italic; }

/* ---- World: map label, world map page ---- */
.map-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.world-link { font-size: 12px; letter-spacing: .08em; color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--line); }
.world-link:hover { color: var(--gold-bright); border-color: var(--gold); }

/* ---- World map page ---- */
.page-wide .panel { max-width: 960px; }
.world-map { width: 100%; height: auto; display: block; margin: 8px 0 12px; }
.wm-road { stroke: #7A6450; stroke-width: 2; }
.wm-road.later { stroke-dasharray: 6 5; opacity: .55; }
.wm-region rect { fill: #17110F; stroke: #7A6450; stroke-width: 1.5; }
.wm-region.open rect { stroke: #C2A36B; stroke-width: 2; }
.wm-region.town rect { fill: #2A1610; stroke: #B5562F; stroke-width: 2; }
.wm-region.later rect { stroke-dasharray: 6 5; stroke-opacity: .6; }
.wm-region.later text { opacity: .55; }
.wm-region.here rect { fill: #3A0E0E; stroke: #E0483A; stroke-width: 3; }
.wm-name { fill: #E8DFD0; font-family: 'Cinzel', serif; font-size: 13px; font-weight: 700; }
.wm-band { fill: #A89A86; font-size: 13px; font-style: italic; }
.world-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; color: #A89A86; font-size: 15px; }
.world-legend .lg { display: inline-block; width: 18px; height: 12px; border: 2px solid #C2A36B; vertical-align: middle; margin-right: 4px; }
.world-legend .lg-town { border-color: #B5562F; background: #2A1610; border-radius: 6px; }
.world-legend .lg-later { border-color: #7A6450; border-style: dashed; }
.world-legend .lg-here { border-color: #E0483A; background: #3A0E0E; }

/* "Player Guide & Lore" link under the sign-in and character forms. */
.guide-link { text-align: center; margin: 14px 0 0; font-family: var(--display); letter-spacing: .12em; font-size: 15px; }
.guide-link a { color: var(--gold-bright); text-decoration: none; border-bottom: 1px solid var(--frame); padding-bottom: 2px; }
.guide-link a:hover { color: #fff; border-bottom-color: var(--gold); }

/* The hidden attribute always wins over a panel's display rule. */
[hidden] { display: none !important; }


/* ===========================================================================
   Play screen extras: movable panels, Chat tab, clickable words, Settings,
   alerts, phone layout, plain-text mode. (js/ui-*.js)
   =========================================================================== */

/* ---------- panels ---------- */
.side { gap: 18px; padding: 16px 16px; }
.dock { gap: 8px; }
.dock.user-hidden, .dock[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: grab; user-select: none; }
.panel-head:active { cursor: grabbing; }
.panel-btn {
  width: 24px; height: 24px; padding: 0; background: transparent; border: 1px solid transparent; color: var(--faint);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.panel-btn:hover { color: var(--bone); border-color: var(--frame); }
.dock.collapsed .panel-body { display: none; }
.dock.collapsed .panel-head .label { color: var(--faint); }
.panel-body { display: flex; flex-direction: column; gap: 10px; }
.dock.dragging { opacity: 0.4; }
.drop-mark { height: 3px; background: var(--gold); flex: none; }
.side:empty { padding: 0; }

.col-resizer { background: var(--panel-dark); cursor: col-resize; position: relative; touch-action: none; }
.col-resizer::after { content: ''; position: absolute; inset: 0 2px; background: var(--line); }
.col-resizer:hover::after, .col-resizer.active::after, .col-resizer:focus-visible::after { background: var(--gold); }
body.no-left .side.left, body.no-right .side.right { display: none; }
body.no-left .play-body { grid-template-columns: 0 6px minmax(0, 1fr) 6px var(--right-w, 290px); }
body.no-right .play-body { grid-template-columns: var(--left-w, 270px) 6px minmax(0, 1fr) 6px 0; }
body.no-left.no-right .play-body { grid-template-columns: 0 6px minmax(0, 1fr) 6px 0; }

.mini-btn {
  min-width: 28px; height: 28px; padding: 0 6px; background: var(--panel); border: 1px solid var(--frame);
  color: var(--bone); cursor: pointer; font-size: 15px; line-height: 1;
}
.mini-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.mini-select { background: var(--bg, #0E0B0A); color: var(--bone, #E8DFD0); border: 1px solid var(--line, #3a2f28); border-radius: 3px; font: inherit; font-size: 0.85em; padding: 1px 4px; margin-left: 6px; }
.mini-select:hover, .mini-select:focus-visible { border-color: var(--gold); }
.map-wrap { display: flex; justify-content: center; }
.map-tools { display: flex; gap: 6px; align-items: center; }
.map-tools .world-link { margin-left: auto; font-size: 15px; }
.map-link { stroke: var(--frame); stroke-width: 2; }
.map-room { fill: var(--panel); stroke: var(--muted); stroke-width: 1.5; }
.map-room.here { fill: var(--blood); stroke: var(--gold); stroke-width: 2; }
.map-dot { fill: var(--bone); }

/* ---------- inventory ---------- */
.inventory { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.inv-head { font-family: var(--display); font-size: 10px; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; margin-top: 6px; }
.inv-item {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 3px 6px;
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--bone);
}
.inv-item:hover { border-color: var(--frame); background: var(--panel); }
.inv-item.inside { padding-left: 18px; }
.inv-wear { font-size: 13px; font-style: italic; flex: none; }

/* ---------- story / chat tabs ---------- */
.story-tabs { display: flex; gap: 2px; padding: 6px 20px 0; border-bottom: 1px solid var(--line); background: var(--panel-dark); }
.story-tab {
  background: transparent; border: 1px solid transparent; border-bottom: 0; color: var(--faint); cursor: pointer;
  font-family: var(--display); font-size: 11px; letter-spacing: 0.18em; padding: 6px 14px; text-transform: uppercase;
}
.story-tab.active { color: var(--gold); border-color: var(--line); background: var(--bg); margin-bottom: -1px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; background: var(--blood); color: #F3EADB; font-family: var(--body); font-size: 12px; letter-spacing: 0; border-radius: 9px; text-align: center; }
.badge[hidden] { display: none; }
.chat-output .stamp { color: var(--faint); font-size: 0.75em; margin-right: 8px; font-style: normal; }
.main { position: relative; }
.new-text {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 5;
  background: var(--blood); color: #F3EADB; border: 1px solid var(--blood-edge); padding: 6px 16px; cursor: pointer;
  font-family: var(--display); font-size: 12px; letter-spacing: 0.12em; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.search-bar { display: flex; gap: 8px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--panel-dark); }
.search-bar .input { flex: 1; min-width: 0; height: 36px; font-size: 17px; }
.search-bar[hidden] { display: none; }
.output .line.found { background: color-mix(in srgb, var(--gold) 10%, transparent); }
.output .line.found-now { background: color-mix(in srgb, var(--gold) 28%, transparent); outline: 1px solid var(--gold); }

/* ---------- clickable words and the pop-up menu ---------- */
.clk { cursor: pointer; text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
.clk:hover { text-decoration-style: solid; text-decoration-color: currentColor; }
body.no-click .clk { cursor: text; text-decoration: none; }
.exit-word { color: inherit; }
mark.hl { color: inherit; background: color-mix(in srgb, var(--gold) 25%, transparent); padding: 0 2px; }
/* Friends' and enemies' names (the Highlights window). UI.apply() writes their colors. */
mark.ppl { color: inherit; background: transparent; padding: 0 1px; border-radius: 2px; font-weight: 700; }
mark.ppl-friend { color: #7FD98A; }
mark.ppl-enemy { color: #FF6B5E; }
/* The Highlights window (a .settings dialog made by ui-text.js) */
.hl-window .hl-sample { flex: 0 0 auto; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ppl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ppl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--line); background: var(--panel-dark); }
.ctx-menu {
  position: fixed; z-index: 50; min-width: 160px; display: flex; flex-direction: column; padding: 4px;
  background: var(--panel); border: 1px solid var(--frame); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}
.ctx-menu[hidden] { display: none; }
.ctx-menu button { text-align: left; background: transparent; border: 0; color: var(--bone); padding: 8px 12px; cursor: pointer; font-size: 17px; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--blood); color: #F3EADB; outline: none; }

/* ---------- alerts ---------- */
body.low-health .play { box-shadow: inset 0 0 0 3px #A62B22; }
body.hurt-flash .play { animation: hurt 0.9s ease-out 2; }
@keyframes hurt { 0% { box-shadow: inset 0 0 120px 30px rgba(166, 43, 34, 0.75); } 100% { box-shadow: inset 0 0 0 3px #A62B22; } }

/* ---------- the Settings window ---------- */
.settings {
  width: min(720px, 94vw); max-height: 88vh; padding: 0; background: var(--panel); color: var(--bone);
  border: 1px solid var(--frame); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.settings[open] { display: flex; flex-direction: column; }
.settings::backdrop { background: rgba(0, 0, 0, 0.6); }
.set-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.set-title { font-family: var(--display); font-size: 16px; letter-spacing: 0.18em; color: var(--gold); }
.set-saved { margin-left: auto; font-size: 14px; }
.set-close { width: 36px; height: 36px; font-size: 22px; }
.set-tabs { display: flex; gap: 2px; padding: 8px 18px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-tab { background: transparent; border: 1px solid transparent; border-bottom: 0; color: var(--muted); padding: 8px 14px; cursor: pointer; font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; }
.set-tab.active { color: var(--gold); border-color: var(--line); background: var(--panel-dark); margin-bottom: -1px; }
.set-body { padding: 16px 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; font-size: 18px; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; }
.set-row .set-hint { grid-column: 1 / -1; }
.set-row select, .set-row input[type="range"] { min-width: 200px; }
.set-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); }
.set-hint { font-size: 15px; color: var(--muted); margin: 0; }
.set-section { margin-top: 10px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"], .alias-row input[type="color"] { width: 34px; height: 28px; padding: 0; border: 1px solid var(--frame); background: none; cursor: pointer; }
.color-sample { flex: 1; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-row .btn-ghost { height: 38px; padding: 0 14px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 18px; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 18px; }
.key-row { display: flex; align-items: center; gap: 10px; }
.key-name { font-family: var(--display); font-size: 12px; width: 32px; color: var(--gold); }
.key-row .input, .alias-row .input { height: 34px; font-size: 16px; flex: 1; min-width: 0; }
.alias-list { display: flex; flex-direction: column; gap: 6px; }
.alias-row { display: flex; gap: 8px; align-items: center; }
.alias-row .alias-name { flex: 0 0 110px; }
.settings .btn-ghost { align-self: flex-start; height: 38px; padding: 0 14px; }

/* ---------- phone exits row and bottom tabs (hidden on big screens) ---------- */
.m-exits, .m-nav { display: none; }

/* ---------- Parchment (light) theme: lift dark-only details ---------- */
html[data-theme="parchment"] .c-legendary { text-shadow: none; }
html[data-theme="parchment"] .input { background: #FFFDF6; color: var(--bone); }
html[data-theme="parchment"] .input::placeholder { color: var(--faint); }
html[data-theme="parchment"] .settings::backdrop { background: rgba(60, 40, 20, 0.35); }

/* ---------- Reduced motion ---------- */
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .bar > div { transition: none; } }

/* ---------- Plain text mode: just the story and the command box ---------- */
body.plain-text .side, body.plain-text .col-resizer, body.plain-text .story-tabs, body.plain-text .m-nav, body.plain-text .m-exits { display: none !important; }
body.plain-text .play-body { grid-template-columns: minmax(0, 1fr) !important; }
body.plain-text .output [class^="c-"], body.plain-text .output .clk { color: var(--bone) !important; font-weight: inherit; font-style: normal; text-shadow: none; text-decoration: none; font-family: inherit; font-size: inherit; letter-spacing: 0; }
body.plain-text .output { max-width: 75ch; }

/* ---------- Tablets: narrower sides ---------- */
@media (max-width: 1100px) and (min-width: 801px) {
  .play-body { grid-template-columns: min(var(--left-w, 270px), 230px) 6px minmax(0, 1fr) 6px min(var(--right-w, 290px), 250px); }
  .output { padding: 18px 20px; }
}

/* ---------- Phones: one screen at a time, chosen by the bottom tabs ---------- */
@media (max-width: 800px) {
  .play { height: 100dvh; }
  .play-header { padding: 6px 10px; gap: 6px; }
  .brand { font-size: 13px; }
  .brand svg { display: none; }
  .room-name { order: 3; width: 100%; font-size: 12px; }
  .icon-btn { width: 38px; height: 38px; }
  .play-body, body.no-left .play-body, body.no-right .play-body, body.no-left.no-right .play-body { grid-template-columns: minmax(0, 1fr); }
  .col-resizer, .story-tabs { display: none; }
  .side { border: 0 !important; padding: 14px; display: none !important; }
  body[data-mtab="left"] .side.left, body[data-mtab="right"] .side.right { display: flex !important; }
  body[data-mtab="left"] .main, body[data-mtab="right"] .main { display: none; }
  .panel-head { cursor: default; }
  .inj-toggle { padding: 8px 12px; font-size: 11px; }
  .output { padding: 12px 14px; }
  .m-exits { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--panel-dark); }
  .m-exits:empty { display: none; }
  .m-exits .exit-btn { flex: 1 0 52px; height: 46px; font-size: 13px; }
  .cmd-bar { padding: 8px 10px; gap: 8px; }
  .cmd-bar label { display: none; }
  .cmd-bar .input { font-size: 18px; }
  .cmd-bar .btn-blood { height: 46px; padding: 0 14px; }
  .new-text { bottom: 140px; }
  .m-nav { display: flex; border-top: 1px solid var(--line); background: var(--panel-dark); }
  .m-tab {
    flex: 1; height: 50px; background: transparent; border: 0; color: var(--muted); cursor: pointer; position: relative;
    font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  }
  .m-tab.active { color: var(--gold); box-shadow: inset 0 2px 0 var(--gold); }
  .m-tab[hidden] { display: none; }
  .m-tab[data-badge]:not([data-badge=""])::after {
    content: attr(data-badge); position: absolute; top: 6px; right: 14%; background: var(--blood); color: #F3EADB;
    font-family: var(--body); font-size: 11px; letter-spacing: 0; padding: 0 5px; border-radius: 8px;
  }
  .settings { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; }
  .set-row { grid-template-columns: 1fr; }
  .set-row select, .set-row input[type="range"] { min-width: 0; width: 100%; }
}

/* ---------- Autoplay bar (Game Master test-bot) ---------- */
.autoplay-bar { display: flex; align-items: center; gap: 10px; padding: 6px 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 12%, var(--panel-dark)); font-size: 16px; }
.autoplay-bar[hidden] { display: none; }
.autoplay-label { font-family: var(--display); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
#autoplay-note { flex: 1; color: var(--bone); }

/* ===========================================================================
   Training window (website/js/ui-train.js) — TRAIN at an inn.
   Reuses the creation wizard's skill pieces (.tp-bar, .skill-row, .step-btn,
   .stat-tip...). Both play screens load this file; the font and size are set
   here so the Detailed Screen's small monospace text doesn't leak in.
   =========================================================================== */
.train-dialog {
  width: min(760px, 96vw); height: min(92dvh, 900px); max-height: 92dvh; padding: 0; overflow: hidden;
  background: var(--panel); color: var(--bone); border: 1px solid var(--gold);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  font-family: var(--body); font-size: 18px; line-height: 1.35;
}
/* LESSON (Dec 3 2026): an open window is a column of four parts. Only the
   list (.train-scroll) and the description box scroll; the title bar and the
   TRAIN / CLEAR footer stay put. min-height: 0 lets a flex child shrink
   below its contents, which is what makes it scroll instead of growing. */
.train-dialog[open] { display: flex; flex-direction: column; }
.train-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.train-top {
  flex: none; margin: 0; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel-dark); border-bottom: 1px solid var(--frame);
}
.train-title { margin: 0; font-family: var(--display); font-size: 18px; letter-spacing: 0.2em; color: var(--gold-bright); text-transform: uppercase; }
.train-x { background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; width: 44px; height: 44px; cursor: pointer; }
.train-x:hover { color: var(--bone); }
.train-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 12px; }
.train-note { font-size: 15px; color: var(--muted); margin-top: 12px; margin-bottom: 0; }
.train-bar { margin-top: 10px; }
.train-rows { padding-bottom: 8px; }
.train-dialog .skill-head { font-family: var(--display); position: sticky; top: 0; z-index: 2; background: var(--panel); padding-top: 8px; }
.train-dialog .skill-name { cursor: pointer; }
.train-dialog .skill-name:hover, .train-dialog .skill-name:focus-visible { color: var(--gold-bright); text-decoration: underline dotted; }
.train-dialog .skill-row.drafted { background: rgba(194, 163, 107, 0.08); }
.train-dialog .skill-row.drafted .skill-ranks { color: var(--gold-bright); }
.train-respec { border: 1px solid var(--blood-edge); background: rgba(122, 21, 21, 0.15); padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.train-respec[hidden] { display: none; }
.train-respec-text { flex: 1 1 100%; margin: 0; color: var(--gold-bright); }
.train-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.train-more .btn-ghost:disabled { opacity: 0.35; cursor: default; }
.train-more .train-reroll { margin-left: auto; color: #D98A7E; border-color: var(--blood-edge); }
.train-more .train-reroll:hover { color: #F3EADB; background: var(--blood); }
.train-desc {
  flex: none; max-height: 8.5em; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 20px; background: var(--panel-dark); border-top: 1px solid var(--frame);
}
.train-desc-title { font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; color: var(--gold-bright); text-transform: uppercase; margin-bottom: 4px; }
.train-desc-text { font-size: 16px; }
.train-desc-cost { margin-top: 4px; font-size: 14px; font-style: italic; color: var(--muted); }
.train-actions {
  flex: none; margin: 0; padding: 12px 20px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--panel-dark); border-top: 1px solid var(--gold);
}
.train-actions .train-go { height: 44px; padding: 0 22px; font-size: 13px; }
.train-actions .train-go:disabled { opacity: 0.4; cursor: default; }
.train-actions .btn-ghost:disabled { opacity: 0.35; cursor: default; }
.train-actions .btn-ghost:last-child { margin-left: auto; }
/* Small screens: the window slides up from the bottom as a panel. */
@keyframes train-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (max-width: 640px) {
  .train-dialog {
    width: 100vw; max-width: 100vw; height: 90dvh; max-height: 90dvh;
    margin: auto 0 0; border: 0; border-top: 1px solid var(--gold); border-radius: 12px 12px 0 0; font-size: 16px;
  }
  .train-dialog[open] { animation: train-slide-up .28s ease-out; }
  .train-top { padding: 6px 10px; position: relative; }
  .train-top::before { content: ''; position: absolute; top: 4px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--frame); }
  .train-scroll { padding: 0 10px 10px; }
  .train-desc { padding: 8px 10px; max-height: 6.5em; }
  .train-actions { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .train-dialog .skill-head, .train-dialog .skill-row { grid-template-columns: 1fr 58px 128px 38px; gap: 6px; }
  .train-dialog .step-btn { width: 38px; height: 40px; }
  .train-dialog .skill-ranks { min-width: 40px; font-size: 14px; }
  .train-actions .btn-ghost, .train-actions .train-go { flex: 1 1 28%; padding: 0 8px; }
  .train-actions .btn-ghost:last-child { margin-left: 0; }
  .train-more .train-reroll { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .train-dialog[open] { animation: none; } }
body.reduced-motion .train-dialog[open] { animation: none; }

/* ---- The damage doll shows how you're placed (Nov 20 2026; combat/states.js) ----
   LESSON: the whole body picture turns with a CSS transform: lying down tips it
   onto its side, kneeling and sitting squash it down from the feet, crawling
   leans it forward. Both screens use the same classes (renderPose in play.js
   and classic.js). */
#body, svg.doll { transition: transform .35s ease; transform-origin: 50% 85%; }
#body.pose-kneeling, svg.doll.pose-kneeling { transform: scaleY(.78); }
#body.pose-sitting, svg.doll.pose-sitting { transform: scaleY(.68); }
#body.pose-crawling, svg.doll.pose-crawling { transform: rotate(-60deg) scale(.8); transform-origin: 50% 55%; }
#body.pose-lying, svg.doll.pose-lying { transform: rotate(-90deg) scale(.7); transform-origin: 50% 50%; }
.pose-line { margin-top: .35rem; font-size: .9em; color: var(--bone, #E8DFD0); text-align: center; }
.pose-state { display: inline-block; padding: 0 .4em; border-radius: 3px; border: 1px solid var(--monster, #E0483A); color: var(--monster, #E0483A); font-size: .85em; text-transform: lowercase; }
@media (prefers-reduced-motion: reduce) { #body, svg.doll { transition: none; } }

/* ---- Character portraits (Dec 3 2026; characters/portraits.js, js/ui-portrait.js) ----
   LESSON: a portrait is framed like an old painting: a dark mount, a thin gold
   border and an outer shadow, with the name in Cinzel underneath. The picture
   box has a fixed size (width/height set in ui-portrait.js) so the story
   doesn't jump when it loads. */
.portrait-box {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 8px 0 4px; padding: 8px 8px 6px;
  background: linear-gradient(180deg, #1C1512, var(--panel-dark));
  border: 1px solid var(--gold); box-shadow: 0 0 0 3px var(--panel-dark), 0 0 0 4px var(--frame), 0 6px 18px rgba(0, 0, 0, .6);
}
.portrait-box img { display: block; width: 168px; height: 168px; object-fit: cover; border: 1px solid var(--frame); background: #0A0807; }
.portrait-box figcaption { font-family: var(--display); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-bright); }
.char-portrait { margin: 0 auto 8px; width: 96px; }
.char-portrait[hidden] { display: none; }
.char-portrait img { display: block; width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--gold); box-shadow: 0 0 0 2px var(--panel-dark), 0 0 0 3px var(--frame); }
@media (max-width: 640px) { .portrait-box img { width: 128px; height: 128px; } }
/* Creature pictures (Dec 3 2026): a little larger than portraits, the caption in the monster color. */
.portrait-box.creature-art img { width: 240px; height: 240px; }
.portrait-box.creature-art figcaption { color: var(--c-monster, #E0483A); }
@media (max-width: 640px) { .portrait-box.creature-art img { width: 180px; height: 180px; } }
/* Hover to enlarge (Dec 4 2026; js/ui-portrait.js zoomShow). One gilt-framed copy
   fixed above everything; it never takes the mouse, so it can't flicker. */
.portrait-box img, .char-portrait img, .cl-me-portrait img { cursor: zoom-in; }
.portrait-zoom {
  position: fixed; z-index: 60; pointer-events: none; padding: 6px;
  background: var(--panel-dark, #0E0B0A); border: 1px solid var(--gold);
  box-shadow: 0 0 0 2px #0E0B0A, 0 0 0 3px var(--frame), 0 12px 40px rgba(0,0,0,.75);
  opacity: 0; visibility: hidden; transition: opacity .12s ease, visibility 0s linear .12s;
}
.portrait-zoom.open { opacity: 1; visibility: visible; transition: opacity .12s ease; }
.portrait-zoom img { display: block; object-fit: cover; background: #0A0807; }
@media (prefers-reduced-motion: reduce) { .portrait-zoom, .portrait-zoom.open { transition: none; } }

/* The Characters page: choose a character's portrait (js/characters.js). */
.char-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border: 1px solid var(--frame); margin-right: 12px; background: var(--panel-dark); }
.char-btn .char-who { display: flex; align-items: center; min-width: 0; text-align: left; }
.portrait-form .crop-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.portrait-form canvas.crop { width: 256px; height: 256px; max-width: 100%; border: 1px solid var(--gold); background: #0A0807; cursor: grab; touch-action: none; }
.portrait-form canvas.crop:active { cursor: grabbing; }
.portrait-form .crop-side { flex: 1 1 180px; display: flex; flex-direction: column; gap: 8px; }
.portrait-form input[type=range] { width: 100%; accent-color: var(--gold); }
.portrait-form .current { display: flex; align-items: center; gap: 10px; }
.portrait-form .current img { width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--frame); }
.portrait-form .current[hidden] { display: none; }

/* Lockfall sign-in: the sealed-door mark and the subtitle under the title. */
.hero .subtitle { margin: -8px 0 0; font-style: italic; font-size: 22px; color: var(--bone); }
.hero .door-mark { max-width: 30vw; height: auto; border: 1px solid #3A2A20; }
