/* style.css
   Fantasy-UI reskin (2026-07-28) -- replaces the original flat dark-
   terminal look (kept below in comments for history: dark gray, thin
   1px borders, no panel headers, no depth) with an ornate gold/navy
   "carved frame" look, built CSS/SVG-only per Matthew's call -- no
   external image assets. See project memory
   "project_echoes_panel_reskin_design" for the reasoning; the short
   version is: real image assets (textures, icons, portraits) can be
   dropped into these same slots later without touching layout, so
   starting CSS-only doesn't block upgrading to AI-generated art after.

   Design language, in one place so it's easy to re-tune:
   - Panels are "objects": double border (bronze outer, dark inner),
     rounded corners, drop shadow for lift.
   - Every panel gets a labeled header bar: dark gradient, thin gold
     rules top/bottom, title flanked by CSS flourish lines (no markup
     needed beyond the title span itself -- see "Panel header" below).
   - Cinzel (display/headers) + EB Garamond (body/UI text) replace the
     old all-monospace look; command output no longer needs to fake
     fixed-width alignment anywhere, so this is a safe swap.
   - Teal is a secondary accent, used sparingly (compass hover, mana
     glow) -- gold/bronze stays primary so the two don't compete. */

:root {
  /* Surfaces */
  --bg-void: #0a0c11;
  --panel-fill: #1a1f2b;
  --panel-fill-alt: #12151e;
  --header-grad-top: #232a3a;
  --header-grad-bottom: #14171f;

  /* Borders */
  --border-gold: #c9a24b;
  --border-gold-dim: #8a6d3b;
  --border-dark: #2a2f3d;

  /* Text */
  --text-primary: #d8d8d2;
  --text-muted: #8a8f9c;
  --text-faint: #5c6270;

  /* Accents */
  --accent-gold: #d9a441;
  --accent-gold-bright: #e8b657;
  --accent-teal: #3ec9c9;
  --accent-danger: #c24545;
  --accent-danger-bright: #d95c5c;
  --accent-success: #5cbf60;
  --accent-hp: #b0473a;
  --accent-mana: #3a6fb0;
  --accent-vigor: #6a9e3f;
  --accent-fe: #9b6fd9;

  /* Depth */
  --shadow-panel: 0 6px 18px rgba(0, 0, 0, 0.55);
  --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Fonts */
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "EB Garamond", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  /* overflow:hidden (added 2026-07-28, Matthew's feedback: "the whole
     screen scrolls like its a webpage" when moving panels around) --
     #panel-grid already has its own overflow-y:auto for internal
     scrolling, but without this, the OUTER page could still grow a
     scrollbar/scroll as a whole if the grid's content ever computed
     taller than the viewport during a drag. This guarantees the page
     itself never scrolls -- any overflow is contained inside #panel-grid,
     not the document. */
  overflow: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 18px;
  /* Themed scrollbar (added 2026-07-29, bugfix) -- every scroll container
     in the app (#panel-grid, #output, #character-screen, etc.) was using
     the raw unstyled OS scrollbar, which nobody noticed while those
     containers rarely actually overflowed. #character-screen's new
     overflow-y:auto (this same session, see its own comment) made one
     show up plainly for the first time -- and since that box is
     horizontally centered on an otherwise empty --bg-void background, a
     stock gray scrollbar track read as a stray "line down the middle of
     the screen" rather than a normal scrollbar. Themed here globally
     (inherits everywhere) so it reads as part of the gold/navy frame
     instead of a bare OS control. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-gold-dim) var(--panel-fill-alt);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--panel-fill-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--border-gold-dim);
  border-radius: 5px;
  border: 2px solid var(--panel-fill-alt);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-gold);
}

.hidden {
  display: none !important;
}

/* --- Shared "ornate panel" frame -- double border + shadow, reused by
   login/character screens, the grid-stack panels, and the delete
   modal so every surface in the app reads as the same kind of object. --- */

#login-screen,
#password-screen,
#character-screen,
#delete-modal-box,
#training-modal-box,
#levelup-modal-box,
#shop-modal-box,
#order-modal-box,
#journal-modal-box,
#respec-modal-box,
.grid-stack-item-content {
  background: var(--panel-fill);
  /* Thickened 2px->4px and lightened dim->full gold (2026-07-28, Matthew's
     feedback: original felt "super light," wanted panels to feel like a
     real object you're grabbing when dragged). A few extra px of border
     eats slightly into content space but reads far more solid at normal
     viewing distance -- worth the trade per his ask. */
  border: 4px solid var(--border-gold-dim);
  border-radius: 5px;
  box-shadow: var(--shadow-panel), var(--shadow-inset-top);
  position: relative;
}

#login-screen::after,
#password-screen::after,
#delete-modal-box::after,
#training-modal-box::after,
#levelup-modal-box::after,
#shop-modal-box::after,
#order-modal-box::after,
#journal-modal-box::after,
#respec-modal-box::after,
.grid-stack-item-content::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid var(--border-dark);
  border-radius: 3px;
  pointer-events: none;
}

/* #character-screen deliberately excluded from the shared inner-frame
   rule above (2026-08-11 fix) -- unlike the fixed-height login/modal
   screens, #character-screen scrolls internally (max-height:88vh +
   overflow-y:auto for the character-creation form), and this decorative
   ::after doesn't scroll with that content -- it stays pinned to the
   container's own edges while the form scrolls underneath, so its border
   visually cut across whatever field happened to land there. Reported by
   Matthew as a stray line through the Distinguishing Feature dropdown. */

/* --- Grab/drag affordance (added 2026-07-28) -- panels are draggable via
   Gridstack (whole panel is the drag handle, not just the header -- see
   panels.js's ensureGrid(), no `handle` option is set), so the cursor
   reflects that over the whole panel, not just the header. Gridstack
   itself applies `.ui-draggable-dragging` / `.ui-resizable-resizing` to
   the `.grid-stack-item` during a drag/resize (confirmed against its own
   CDN CSS) -- overridden here for a stronger "you're holding this" cue
   than the library's stock 0.8-opacity/faint-shadow default. */

.grid-stack-item-content {
  cursor: grab;
}

.grid-stack-item.ui-draggable-dragging > .grid-stack-item-content,
.grid-stack-item.ui-resizable-resizing > .grid-stack-item-content {
  cursor: grabbing;
  opacity: 1;
  border-color: var(--accent-gold-bright);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 0 2px var(--accent-gold-bright);
}

/* --- Login screen --- */

#login-screen,
#password-screen {
  max-width: 380px;
  margin: 8vh auto 0;
  padding: 28px;
}

#login-screen h1,
#password-screen h1,
#character-screen h1 {
  display: flex;
  align-items: center;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

#login-screen h1::before,
#login-screen h1::after,
#password-screen h1::before,
#password-screen h1::after,
#character-screen h1::before,
#character-screen h1::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border-gold-dim);
  margin: 0 10px;
}

.subtitle {
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 20px;
  font-size: 16px;
  font-style: italic;
}

#login-form label,
#password-form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 15px;
  letter-spacing: 0.02em;
}

#login-form input,
#password-form input {
  width: 100%;
  padding: 7px 9px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
}

#login-form input:focus,
#password-form input:focus {
  outline: none;
  border-color: var(--border-gold);
}

#login-form button,
#password-form button {
  width: 100%;
  margin-top: 20px;
  padding: 9px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
}

#login-form button:hover,
#password-form button:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

.error-text {
  color: var(--accent-danger-bright);
  font-size: 15px;
  min-height: 1em;
  margin-top: 12px;
  text-align: center;
}

/* --- Splash screen (2026-10-26): full-screen artwork, text and buttons over a dark fade at the bottom --- */

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #0a0b10 url("../img/splash.webp") center top / cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-y: auto;
}

#splash-screen.hidden {
  display: none;
}

.splash-content {
  margin-top: auto;
  padding: 120px 24px 24px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(10, 11, 16, 0) 0%, rgba(10, 11, 16, 0.82) 45%, rgba(10, 11, 16, 0.94) 100%);
}

.splash-content > * {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

#splash-screen h1 {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 auto 12px;
}

#splash-screen.has-art h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.splash-hook {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.55;
  margin-bottom: 22px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.splash-hook p {
  margin: 0 0 10px;
}

.splash-hook .splash-hook-last {
  color: var(--accent-gold-bright);
  font-style: italic;
  margin-top: 14px;
  margin-bottom: 0;
}

.splash-buttons {
  display: flex;
  gap: 12px;
  max-width: 420px;
}

.splash-buttons button {
  flex: 1;
  padding: 11px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
}

.splash-buttons button:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

.splash-buttons .splash-secondary {
  background: rgba(10, 11, 16, 0.7);
  color: var(--accent-gold-bright);
}

.splash-buttons .splash-secondary:hover {
  background: rgba(10, 11, 16, 0.95);
  border-color: var(--border-gold);
}

.splash-notice {
  color: var(--text-muted);
  font-style: italic;
  margin-top: 14px;
  margin-bottom: 0;
}

.splash-footer {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 18px;
  margin-bottom: 0;
}

.login-back {
  text-align: center;
  margin: 14px 0 0;
  font-size: 15px;
}

.login-back a {
  color: var(--text-muted);
  text-decoration: none;
}

.login-back a:hover {
  color: var(--accent-gold-bright);
}

/* --- Game screen --- */

#game-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 10px 16px;
  background: linear-gradient(to bottom, var(--header-grad-top), var(--header-grad-bottom));
  border-bottom: 3px solid var(--border-gold-dim);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

#game-title {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
}

#character-name {
  color: var(--text-primary);
  font-style: italic;
}

/* --- Panel toggle dropdown (added 2026-07-29) -- top-bar "Panels" button +
   checkbox list + double-confirm reset. Sits between #character-name and
   #status; #status keeps margin-left:auto so this stays flush left of it
   regardless of where it's placed in the markup. --- */

.panel-toggle {
  margin-left: auto;
  position: relative;
}

.panel-toggle-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.panel-toggle-btn:hover {
  color: var(--accent-gold-bright);
  border-color: var(--accent-gold);
}

.panel-toggle-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  min-width: 220px;
  background: var(--panel-fill);
  border: 2px solid var(--border-gold-dim);
  border-radius: 6px;
  box-shadow: var(--shadow-panel);
}

.panel-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.panel-toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}

.panel-toggle-item input[type="checkbox"] {
  accent-color: var(--accent-gold);
}

.panel-toggle-reset {
  margin-top: 4px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.panel-toggle-reset:hover {
  color: var(--accent-gold-bright);
  border-color: var(--border-gold-dim);
}

/* Armed (awaiting the second confirm click) -- danger-tinted so it reads
   as "about to actually do something," not just a hover state. */
.panel-toggle-reset-armed {
  color: var(--accent-danger-bright);
  border-color: var(--accent-danger-bright);
  background: rgba(160, 40, 40, 0.12);
}

#status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text-muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-faint);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.status-dot.connecting {
  background: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold);
}

.status-dot.connected {
  background: var(--accent-success);
  box-shadow: 0 0 6px var(--accent-success);
}

.status-dot.disconnected {
  background: var(--accent-danger-bright);
  box-shadow: 0 0 6px var(--accent-danger-bright);
}

/* --- Panel grid --- */

#panel-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-void);
  padding: 4px;
}

/* Hidden-panel state (added 2026-07-29, panel-toggle dropdown design) --
   belt-and-suspenders alongside panels.js's grid.removeWidget() call, see
   that function's own comment for why both are used together. */
.grid-stack-item.panel-hidden {
  display: none !important;
}

.grid-stack-item-content {
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  /* Each inner content div (#output, #compass-panel, #vitals-bar) manages
     its own scrolling -- this stays hidden so we never nest two
     independent scrollbars. */
  overflow: hidden;
}

/* --- Panel header (new, 2026-07-28) -- the title bar every panel now
   has. Only the title <span> is real markup; the flanking flourish
   rules are ::before/::after on the title itself, which works because
   the title is its own flex container -- no extra spacer elements
   needed. Sits above .panel-body inside every .grid-stack-item-content. --- */

.panel-header {
  flex-shrink: 0;
  padding: 8px 14px;
  background: linear-gradient(to bottom, var(--header-grad-top), var(--header-grad-bottom));
  border-bottom: 2px solid var(--border-gold-dim);
  box-shadow: var(--shadow-inset-top);
  /* display:flex + position:relative added 2026-07-29 (per-panel font
     settings) -- the title keeps its own internal flourish-line layout
     below, it just no longer claims the full header width itself, leaving
     room for the settings gear button as a sibling. position:relative is
     the anchor the settings popover positions itself against. */
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.panel-header-title {
  display: flex;
  align-items: center;
  flex: 1; /* was width:100% -- now shares the header row with the gear button */
  min-width: 0;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-header-title::before,
.panel-header-title::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border-gold-dim);
  margin: 0 10px;
}

/* --- Per-panel font settings (added 2026-07-29) -- gear icon in every
   panel header opens a small curated font-family/size picker, scoped to
   that ONE panel via --panel-font-family/--panel-font-size custom
   properties set inline on .grid-stack-item-content by panel-settings.js.
   Purely cosmetic, but saved PER CHARACTER server-side (piggybacks on the
   same ui_layout blob the Gridstack panel positions already use, see
   panels.js's setFont()) -- see panel-settings.js's header for the full
   design, including why Map's button is disabled. --- */

.panel-settings-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.panel-settings-btn:hover:not(:disabled) {
  color: var(--accent-gold-bright);
  border-color: var(--accent-gold);
}

.panel-settings-btn:disabled {
  color: var(--text-faint);
  cursor: default;
  opacity: 0.5;
}

.panel-settings-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  min-width: 170px;
  background: var(--panel-fill);
  border: 2px solid var(--border-gold-dim);
  border-radius: 6px;
  box-shadow: var(--shadow-panel);
}

.panel-settings-popover label {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-settings-popover select {
  width: 100%;
  padding: 4px 6px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

.panel-settings-reset {
  margin-top: 2px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
}

.panel-settings-reset:hover {
  color: var(--accent-gold-bright);
  border-color: var(--border-gold-dim);
}

.panel-body {
  flex: 1;
  min-height: 0; /* required for a flex child to scroll internally */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Resize-handle SVG from Gridstack's CDN CSS already uses a mid-gray
   stroke which reads fine against this palette as-is -- no override
   needed there. */

/* --- Vitals bar --- */

#vitals-bar {
  /* 2026-10-27: now lives in #top-bar (was a panel body). Wraps onto extra header lines when the window is narrow. */
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
}

#vitals-bar .vitals-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

#vitals-bar { font-size: 16px; }
/* Header vitals show numbers only (2026-10-27); AT keeps its bar since it moves constantly. */
#vitals-bar .vital:not(.at-vital) .vital-bar-track { display: none; }
#vitals-bar .vital-bar-track { width: 70px; }
#vitals-bar .vital-text { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
#vigor-text { color: #9fd06a; }
#fe-text { color: #b48be0; }
#xp-text { color: #e3b448; }
#vitals-bar .vitals-main { gap: 4px 14px; }
/* Header (and its Panels dropdown) must sit above overlapping panels, whose z-index grows as they are raised. */
#top-bar { position: relative; z-index: 900; }  /* below the 1000+ modals; panels.js keeps panel z-index under 800 */
#vitals-bar .vital-label { width: auto; min-width: 0; font-size: 12px; }
#vitals-bar .vital-label.vital-label-wide { width: auto; }
#vitals-bar .vital { gap: 6px; }
#character-name { display: none; }  /* identity text in the vitals strip already shows the name */

/* Armor & Weapons panel (2026-10-27): inline wrapping rows instead of cards, so the panel can be shrunk freely. */
.gear-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px 22px;
  padding: 6px 12px;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 16px);
}

.gear-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.gear-label {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gear-name {
  color: var(--text-primary);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.gear-item.gear-empty .gear-name {
  color: var(--text-faint);
  font-style: italic;
}

.gear-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gear-chip {
  font-size: 0.8em;
  line-height: 1.25;
  padding: 1px 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip-bonus { color: #8fd694; background: rgba(92, 191, 96, 0.12); border-color: rgba(92, 191, 96, 0.35); }
.chip-cost  { color: #e68a8a; background: rgba(194, 69, 69, 0.13); border-color: rgba(194, 69, 69, 0.38); }
.chip-ok    { color: #7fd6d6; background: rgba(62, 201, 201, 0.10); border-color: rgba(62, 201, 201, 0.30); }
.chip-none  { color: var(--text-faint); border-color: var(--border-dark); }

#vitals-identity {
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

.vital {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vital-label {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* Widened 36px -> 48px (2026-09-22, Matthew's ask) -- "Vigor"/"Focus"
     (5 chars, uppercased + letter-spaced) were getting their last letter
     clipped at the old width; abbreviating them was tried first and
     rejected ("random abbreviations nobody is going to know"). Every
     vital row shares this one class, so widening it shifts the bar-track
     and value text of EVERY row (HP/Mana/Vigor/Focus/XP/AT) to the right
     by the same amount, keeping them all still lined up with each other. */
  width: 48px;
  flex-shrink: 0;
}

/* Explore (2026-10-27): "EXPLORE" is wider than the 48px label column, so the count printed on top of it. This row has no bar, so a wider label is safe. */
.vital-label.vital-label-wide {
  width: 74px;
}

.vital-bar-track {
  width: 130px;
  height: 12px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  display: inline-block;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.vital-bar-fill {
  display: block;
  height: 100%;
  /* Explicit 0% default (added 2026-09-22, belt-and-suspenders alongside
     the real fix in main.js's atReadyAt sentinel -- see that comment for
     the actual root cause). A block-level span with no width set
     defaults to filling its container, so any vital bar JS hasn't
     touched yet would render FULL rather than empty -- HP/Mana/Vigor/FE
     are set unconditionally on every status message so this never bit
     them in practice, but AT is gated and could go untouched on the
     very first status of a session. Costs nothing for the normal case
     (JS always overrides this via .style.width once real data arrives). */
  width: 0%;
  transition: width 0.2s ease-out;
  /* Gradient sheen instead of flat color -- a lighter top edge fading
     into the base tone reads as a rounded/lit pill rather than a flat
     block. */
}

.hp-fill {
  background: linear-gradient(to bottom, #d4685a, var(--accent-hp));
}

.mana-fill {
  background: linear-gradient(to bottom, #5c92d9, var(--accent-mana));
}

/* Vigor pill (added 2026-08-11, grind-throttle pool) -- a mossy green,
   distinct from --accent-success's brighter green (used elsewhere for
   online-status/positive-state dots) so the two don't read as the same
   signal. #vigor-vital.inactive (toggled in main.js while the pool isn't
   in effect yet, below level 10 -- see server/vigor.js) dims the whole
   row rather than just graying the fill, so it reads as "not relevant
   yet" rather than "empty/bad." */
.vigor-fill {
  background: linear-gradient(to bottom, #8fc95f, var(--accent-vigor));
}

#vigor-vital.inactive {
  opacity: 0.45;
}

/* Focused Energy pill (added 2026-09-15, WIZ22 Enchant build) -- a violet
   fill, distinct from every other vital's color (HP red, Mana blue, Vigor
   green, XP gold, AT teal) so it reads as its own resource, not a Vigor
   reskin. Unlike Vigor's row (always present, dimmed via .inactive below
   level 10), this row is WIZARD-CLASS-ONLY per the LOCKED design --
   main.js toggles it fully hidden for every other class via the shared
   .hidden utility rather than dimming it, since it doesn't exist at all
   for a non-Wizard, not just "not active yet." */
.fe-fill {
  background: linear-gradient(to bottom, #b18eea, var(--accent-fe));
}

/* XP pill + AT countdown fills (added 2026-07-29). XP reuses the same gold
   the rest of this UI already uses for progression/reward (training
   points, level-up text) -- distinct from HP's red and Mana's blue. AT
   uses teal, this UI's other secondary accent (compass hover, mana glow)
   -- deliberately NOT red/danger, since a normal few-second AT after any
   swing isn't a warning state, just a status readout. */
.xp-fill {
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
}

.at-fill {
  background: linear-gradient(to bottom, #5fd9d9, var(--accent-teal));
}

.vital-text {
  color: var(--text-muted);
  min-width: 62px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Hand contents lines (added 2026-08-04, split into two rows same day
   after Matthew live-tested the original single combined line and found
   it cluttered) -- reuses .vital's row layout, but each line's text is a
   full item name ("Duskiron Longsword"), not a short number like the
   other vitals, so it needs its own wider label column ("Right Hand" /
   "Left Hand" is longer than HP/Mana/XP/AT) and can't keep .vital-text's
   fixed 62px min-width or nowrap -- a long item name should wrap onto a
   second line inside the panel rather than clip or overflow the edge. */
.vital-hands {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.vital-hands .vital-label {
  width: 82px;
}

.vital-hands .vital-text {
  min-width: 0;
  white-space: normal;
  line-height: 1.4;
}

/* Level Up indicator (added 2026-08-04, leveling/training cadence rework)
   -- reuses .vital-hands' row layout (no bar-track needed, same as the
   hand-contents lines above), gold/clickable to stand out from the plain
   muted vitals around it -- this is a "go do something" cue, not just a
   status readout. */
.levelup-indicator {
  cursor: pointer;
}

.levelup-indicator .vital-label {
  width: 24px;
  color: var(--accent-gold-bright);
}

.levelup-indicator .vital-text {
  color: var(--accent-gold-bright);
  font-weight: 600;
}

.levelup-indicator:hover .vital-text {
  text-decoration: underline;
}

/* --- Compass + room-occupants panel --- */

#compass-panel {
  height: 100%;
  padding: 12px 14px;
  overflow-y: auto;
  box-sizing: border-box;
}

.panel-section {
  margin-bottom: 16px;
}

.panel-section-label {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.compass-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compass-chip {
  padding: 5px 12px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--text-primary);
  /* var()-based (added 2026-07-29, per-panel font settings) */
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 15px);
  text-transform: capitalize;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.compass-chip:hover {
  background: #16323a;
  border-color: var(--accent-teal);
  box-shadow: 0 0 6px rgba(62, 201, 201, 0.35);
}

.compass-occupant-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.occupant-line {
  color: var(--text-primary);
  /* var()-based (added 2026-07-29, per-panel font settings) */
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 16px);
}

.occupant-line.occupant-player {
  color: #3db8ff;
  font-weight: 700;
}

.occupant-line.occupant-monster {
  color: #e0895c;
  /* Clickable (added 2026-08-19, click-to-lock targeting build) -- same
     pointer/hover-feedback treatment as .compass-chip above, reusing the
     same reserved teal accent for the hover state, then a persistent
     (not just hover) version of it for .locked-target below once clicked. */
  cursor: pointer;
  transition: color 0.15s, text-shadow 0.15s;
}

.occupant-line.occupant-monster:hover {
  color: var(--accent-teal);
}

.occupant-line.occupant-monster.locked-target {
  color: var(--accent-teal);
  font-weight: bold;
  text-shadow: 0 0 6px rgba(62, 201, 201, 0.5);
}

.occupant-line.occupant-monster.locked-target::before {
  content: '\25C6 '; /* small diamond glyph marking the locked target -- distinct from
                         output.js's COMBAT_GLYPH set (melee/spell markers), this one's
                         panel-only */
}

/* Corpse listing (added 2026-08-06, corpse/LOOT design) -- deliberately
   muted/dim rather than the live-monster orange above, so a lingering
   corpse reads as "no longer a threat" at a glance in the compass panel,
   matching the distinct wording Story pane already uses for it. */
.occupant-line.occupant-corpse {
  color: var(--text-muted);
  font-style: italic;
}

.panel-empty {
  color: var(--text-faint);
  font-size: 15px;
  font-style: italic;
}

/* --- Map panel (added 2026-07-28, see project memory "map panel design")
   -- plain node-and-line rendering, drawn by panels.js's drawFullMap() into
   the #map-svg element. Deliberately restrained: dim bronze lines/dots
   matching the rest of the chrome, teal reserved (same "sparing secondary
   accent" rule as the compass hover) for the single "you are here"
   highlight so it's unmistakable against everything else on the map.

   Rewritten 2026-07-28 for the persistent-scrollable-map redesign (Matthew's
   feedback: the old fit-the-visible-radius-into-a-fixed-viewBox approach
   made the map "pop in and out" on every move). #map-panel is now the
   SCROLLABLE VIEWPORT -- a fixed-size window onto a larger #map-svg canvas
   that's drawn once per zone at real pixel dimensions (not stretched to
   fill via width:100%/viewBox). panels.js centers the scroll position on
   the player's current room after every move (centerMapOn()) instead of
   redrawing -- scroll-behavior:smooth makes that read as gliding to follow
   the player, while still leaving the pane manually scrollable/draggable
   the rest of the time to look around the rest of the zone. --- */

#map-panel {
  /* flex:1 + min-height:0, NOT height:100% (changed 2026-07-28, real bug
     Matthew found live: the map rendered as a "giant, uncontained" canvas
     spilling past its own panel). #map-panel's parent (.panel-body) is a
     flex column -- height:100% is a percentage that's fragile to resolve
     reliably against a flex-grown ancestor, while flex:1 + min-height:0 is
     the exact same idiom .panel-body itself already uses one level up
     against .grid-stack-item-content, and is the robust way to make a flex
     child fill its share of the space AND still clip/scroll its own
     oversized content instead of growing to fit it. */
  flex: 1;
  min-height: 0;
  padding: 8px;
  box-sizing: border-box;
  overflow: auto;
  position: relative;
  scroll-behavior: smooth;
}

#map-svg {
  display: block;
  /* No width/height:100% here on purpose -- panels.js sets explicit pixel
     width/height attributes on the element itself, sized to the whole
     zone's mapped extent at MAP_SCALE. That's what makes it bigger than
     the viewport and therefore scrollable at all. */
}

.map-room-line {
  stroke: var(--border-gold-dim);
  stroke-opacity: 0.5;
  stroke-width: 1.5;
}

.map-room-line-feature {
  stroke: var(--border-gold-dim);
  stroke-opacity: 0.5;
  stroke-width: 1.5;
  stroke-dasharray: 5, 4;
}

.map-room-dot {
  fill: var(--panel-fill-alt);
  stroke: var(--border-gold-dim);
  stroke-width: 1.5;
}

/* zoneExit marker (2026-09-02) -- a bold red ring instead of the usual dim
   gold one, flagging a room that leads to another zone file. Deliberately
   placed before .map-room-current below so standing on a zone-exit room
   still shows the normal teal "you are here" highlight on top of it,
   rather than the two competing for the same ring. */
.map-room-zone-exit {
  stroke: var(--accent-danger-bright);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 3px var(--accent-danger));
}

.map-room-label {
  fill: var(--text-muted);
  font-family: var(--font-body);
  /* 11px -> 14px (2026-07-28, Matthew's feedback: "font size in the map for
     locations too small") -- this is a plain SVG font-size, unrelated to
     panels.js's map scale/zoom -- it doesn't get bigger or smaller as the
     room-to-room spacing changes, so it needed its own direct bump. */
  font-size: 14px;
  text-anchor: middle;
}

/* Freestanding encounter labels (added 2026-09-03) -- distinct from
   .map-room-label (a room's own function name) both in styling and in
   what it means: this is monster/encounter info floating in open grid
   space, not a place name tied to a node. Italic + the danger-red tone
   (same family as .map-room-zone-exit's ring, unrelated element though)
   signals "combat info" at a glance, kept visually separate from the gold
   room labels so the two categories don't blur together on a busy map. */
.map-area-note {
  fill: var(--accent-danger-bright);
  font-family: var(--font-body);
  font-style: italic;
  /* 13px -> 15px (2026-09-03, Matthew's feedback after seeing it live) --
     same plain-SVG-font-size caveat as .map-room-label above: unrelated to
     panels.js's map scale/zoom, so it needed its own direct bump. */
  font-size: 15px;
  text-anchor: middle;
}

.map-room-current {
  fill: var(--accent-teal);
  stroke: var(--accent-teal);
  stroke-width: 2;
  filter: drop-shadow(0 0 4px var(--accent-teal));
}

/* --- Known Spells panel (added 2026-07-29, panel-toggle + Known Spells
   design session) -- collapsible groups, same visual weight class as the
   compass panel's exit chips/occupant lines. Rendered by
   known-spells-panel.js's render()/renderGroup()/renderSpellLine(). --- */

#spells-panel {
  height: 100%;
  padding: 12px 14px;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 16px);
}

.spell-circle-group {
  margin-bottom: 10px;
}

.spell-circle-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.spell-circle-header:hover {
  background: #16323a;
  border-color: var(--accent-teal);
}

.spell-circle-chevron {
  display: inline-block;
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.spell-circle-header.spell-circle-open .spell-circle-chevron {
  transform: rotate(90deg);
}

.spell-circle-name {
  flex: 1;
  min-width: 0;
}

.spell-circle-rank {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  flex-shrink: 0;
}

.spell-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px 2px 20px;
}

.spell-line {
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.spell-line:hover {
  background: #16323a;
}

.spell-line.spell-locked {
  color: var(--text-faint);
  cursor: default;
}

.spell-line.spell-locked:hover {
  background: none;
}

.spell-line-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* Chevron toggles the flavorText .spell-detail row below (2026-08-17) --
   same visual idiom as .spell-circle-chevron/.buff-expand-chevron, sized
   down to fit inline with a spell's name instead of a group header. The
   "-empty" variant renders a same-size blank space (not display:none) so
   spells without flavorText still line up with ones that have a chevron. */
.spell-expand-chevron {
  display: inline-block;
  color: var(--text-muted);
  font-size: 10px;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.spell-expand-chevron-empty {
  visibility: hidden;
}

.spell-line-expanded .spell-expand-chevron {
  transform: rotate(90deg);
}

.spell-detail {
  margin-top: 3px;
  padding-left: 19px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.spell-name {
  flex: 1;
  min-width: 0;
}

.spell-meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.spell-empty {
  padding: 4px 8px;
}

/* Buff Panel (added 2026-08-04, Earthguard/buffs.js build). Reworked
   2026-08-17 to add a per-row click-to-expand for magnitude detail (see
   buff-panel.js's header) -- rows are interactive again (cursor:pointer,
   hover state, a chevron), same idiom .spell-circle-header already
   established for exactly this kind of "collapsed by default, click for
   more" row. */
#buffs-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  /* Added 2026-09-03, alongside adding 'buffs' to panel-settings.js's
     TEXT_PANELS -- this panel's gear button was sitting disabled with no
     real reason (built 2026-08-04, before the per-panel font picker
     existed, and just never wired up after). Every child font-size below
     is now em, not px, so the setting scales the whole panel's text, not
     just this container -- same fix already applied to the Story pane's
     VERBS block, see .verbs-hint's comment further down this file. */
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 15px);
}

.buff-line {
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.buff-line:hover {
  background: #16323a;
}

.buff-line-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.buff-expand-chevron {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.73em; /* was fixed 11px -- em, see #buffs-panel's comment */
  transition: transform 0.15s;
  flex-shrink: 0;
}

.buff-line-expanded .buff-expand-chevron {
  transform: rotate(90deg);
}

.buff-name {
  flex: 1;
  min-width: 0;
}

.buff-time {
  color: var(--text-muted);
  font-size: 0.8em; /* was fixed 12px -- em, see #buffs-panel's comment */
  white-space: nowrap;
  flex-shrink: 0;
}

.buff-detail {
  margin-top: 3px;
  padding-left: 19px;
  color: var(--text-muted);
  font-size: 0.8em; /* was fixed 12px -- em, see #buffs-panel's comment */
}

/* --- Group Panel (added 2026-08-17, group/party system UI) -- see
   group-panel.js's own header. Same visual weight class as Known Spells/
   Buffs (compass-chip/spell-line/buff-line conventions), plus its own
   small button + inline-form styling since this is the first panel with
   real ACTION controls beyond a single click-target-per-row. --- */

#group-panel {
  height: 100%;
  padding: 12px 14px;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 15px);
  /* This var() wiring predates 'group' actually being added to panel-
     settings.js's TEXT_PANELS (fixed 2026-09-03) -- the gear button was
     disabled this whole time despite the panel already being ready for
     it. Every child font-size below is now em, not px, so the setting
     scales the whole panel, not just this container -- same fix as
     #buffs-panel above and the Story pane's VERBS block. */
}

.group-section {
  margin-bottom: 18px;
}

.group-section:last-child {
  margin-bottom: 0;
}

.group-member-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.group-member-line {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 8px;
  color: var(--text-primary);
}

.group-member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Combat-group HP bar (added 2026-08-17) -- deliberately compact, same
   track/fill idiom as the Vitals panel's HP bar (#hp-bar-fill/.hp-fill in
   index.html) but class-based instead of id-based since group-panel.js
   renders an unbounded number of these rows, not one fixed element. */
.group-hp-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-hp-track {
  flex: 1;
  height: 6px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  overflow: hidden;
}

.group-hp-fill {
  display: block;
  height: 100%;
  /* Same --accent-hp token the Vitals panel's own .hp-fill uses, just a
     left-to-right gradient instead of top-to-bottom to match this bar's
     horizontal (not vertical) fill direction. */
  background: linear-gradient(to right, #d4685a, var(--accent-hp));
  transition: width 0.2s;
}

.group-hp-text {
  color: var(--text-muted);
  font-size: 0.73em; /* was fixed 11px -- em, see #group-panel's comment */
  white-space: nowrap;
  flex-shrink: 0;
}

.group-hp-offline {
  color: var(--text-faint);
  font-size: 0.73em; /* was fixed 11px -- em, see #group-panel's comment */
  font-style: italic;
}

.group-member-line.group-member-offline {
  color: var(--text-faint);
}

.group-member-tags {
  color: var(--text-muted);
  font-size: 0.8em; /* was fixed 12px -- em, see #group-panel's comment */
  font-style: italic;
}

.group-member-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.group-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.group-inline-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.group-inline-form input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

.group-inline-form input:focus {
  outline: none;
  border-color: var(--border-gold);
}

.group-circle-caption {
  margin-bottom: 6px;
}

.group-invite-banner {
  padding: 8px 10px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--accent-gold-bright);
  border-radius: 4px;
}

.group-invite-banner span {
  display: block;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* Base button look for this panel -- .secondary-btn/.danger-btn (defined
   above for the character-select/delete-modal screens) apply their color
   overrides via !important on top of this, so a Kick/Disband/Decline
   button here still gets the right red/gray tint without needing its own
   duplicate color rules. */
#group-panel button {
  padding: 5px 10px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#group-panel button:hover {
  background: #16323a;
  border-color: var(--accent-teal);
}

#group-panel button.mini-btn {
  padding: 3px 8px;
  font-size: 12px;
}

#output {
  height: 100%;
  overflow-y: auto;
  padding: 12px 16px;
  white-space: pre-wrap;
  line-height: 1.5;
  /* var()-based (added 2026-07-29, per-panel font settings) -- font-family
     previously just inherited body's --font-body; now explicit so a saved
     Story-panel setting can override it. */
  font-family: var(--panel-font-family, var(--font-body));
  font-size: var(--panel-font-size, 17px);
  box-sizing: border-box;
}

.output-line {
  min-height: 1.4em;
}

/* Visual "paragraph break" between distinct blocks of Story-pane output
   (added 2026-09-22, Matthew's ask -- POUR/CAST/teleport/room-description
   text was all running together with no break, hard to tell where one
   event ended and the next began). output.js's print* functions tag the
   FIRST line of every top-level render call (a typed-command echo, a
   combat-text block, a plain-text block like a room description, an HTML
   block like VERBS) with this class -- lines WITHIN a call (e.g. every
   line of a single room description, or every line of one combat
   exchange) are left untouched so they still read as one cohesive block.
   Applies across the board, every path through output.js, not just one
   spell/command. */
.output-line.block-start {
  margin-top: 0.85em;
}

.output-line.echo {
  color: var(--text-faint);
}

.output-line.error {
  color: var(--accent-danger-bright);
}

.output-line.system {
  color: var(--accent-gold);
  font-style: italic;
}

/* Server-wide death announcement (added 2026-08-19) -- deliberately bolder
   and more visually loud than .error above (same red accent, but bold +
   a soft glow) so a death notice can't be mistaken for an ordinary error
   line while scrolling past. death.js already wraps the *** markers into
   the text itself and picks one of several phrasings at random -- this is
   purely the visual treatment. */
.output-line.death-announcement {
  color: var(--accent-danger-bright);
  font-weight: bold;
  letter-spacing: 0.02em;
  text-shadow: 0 0 6px rgba(217, 92, 92, 0.45);
}

/* --- Story-pane room highlights (added 2026-07-29) -- the server already
   sends exits/monster as structured data on the side (room-info, see
   commands.js's buildRoomInfo()) for the compass panel; output.js's
   highlightRoomBlock() reuses that same data to re-color the matching
   lines inside the plain-text room description block, instead of the
   compass being the only place this info stands out. Monster color
   matches .occupant-line.occupant-monster's existing orange exactly, for
   consistency between the two panels -- bolded here since inline prose
   needs more visual weight to stand out than a dedicated panel line does. --- */

.output-line.exits-line {
  color: var(--accent-teal);
}

.story-exit {
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
}
.story-exit:hover, .monster-name[data-spawn-id]:hover { text-decoration: underline; }
.monster-name[data-spawn-id] { cursor: pointer; }

/* .monster-name pulled out to a standalone rule (2026-07-29) -- was scoped
   to .monster-line only; now also used inside combat blocks below, and
   potentially anywhere else a monster's name appears in the Story pane
   going forward. Same orange/bold treatment everywhere it's used, so a
   monster's name reads consistently no matter which line it's in. */
.monster-name {
  color: #e0895c;
  font-weight: 700;
}

/* Player names in arrive/leave lines (2026-10-09) -- electric blue so other
   adventurers stand out from monsters (orange). */
.player-name {
  color: #3db8ff;
  font-weight: 700;
}

/* NPC names (2026-10-12) -- gold, distinct from players (blue) and monsters (orange). */
.npc-name {
  color: #f2c94c;
  font-weight: 700;
}

/* .corpse-name (added 2026-08-06, corpse/LOOT design) -- Story-pane
   counterpart to the compass panel's .occupant-corpse: same muted/italic
   treatment, so a corpse reads as "no longer a threat" consistently in
   both places rather than sharing the live-monster orange. */
.corpse-name {
  color: var(--text-muted);
  font-style: italic;
}

/* --- Combat text (added 2026-07-29, "pop" pass -- Matthew's ask after the
   first live combat screenshot: the AV/DV exchange was getting lost in
   the room-description clutter around it). Lines arrive already tagged by
   the server (see output.js's printCombatBlock()) -- actor drives the
   left border color (which SIDE acted: player vs monster), a glyph marks
   the start of each side's turn, and .monster-name (above) gets reused
   here so the monster's name reads the same whether it's in a combat line
   or a room description. --- */

.combat-line {
  border-left: 3px solid transparent;
  padding-left: 10px;
  border-radius: 0; /* no rounded corners on a single-side border */
}

.combat-line.combat-player {
  border-left-color: var(--accent-gold);
}

.combat-line.combat-monster {
  border-left-color: var(--accent-danger);
}

.combat-line.combat-system {
  border-left-color: var(--border-dark);
  color: var(--text-faint);
  /* Was a fixed 14px (small AND not scaling with #output's
     --panel-font-size setting, the same em-vs-px bug the VERBS command
     reference had -- see that block's own comment above). Matthew's ask
     2026-09-22: "Action Timer: Xs." and other throwaway meta text was
     reading too small by default. Bumped close to full body size and
     switched to em so it tracks the per-panel font-size setting like
     everything else in the Story pane. */
  font-size: 0.95em;
}

/* Narrative combat-adjacent lines (e.g. a monster fleeing) -- distinct from
   .combat-system on purpose. That class is for throwaway meta text like
   "Action Timer: 6s." and is deliberately dim/small; a flee line is a real
   story beat players need to actually see, so it gets full-size, full-
   brightness text like a player/monster combat line, just without the
   colored side-border (it's not "an attack from either side"). Added
   2026-08-10 -- flee text was getting lost under .combat-system's styling. */
.combat-line.combat-narrative {
  border-left-color: var(--border-dark);
  color: var(--text-primary);
}

/* Monster hits on OTHER players (added 2026-09-23, Matthew: a one-line
   "X hits Y" was too easy to miss in the scroll). Tinted band + bold victim
   name for any bystander hit; a group member being hit escalates to a
   stronger warning band (⚠ prefix added in output.js) and flashes their
   HP bar in the Group Panel. Misses deliberately left unstyled. */
.combat-line.combat-bystander-hit {
  background: rgba(200, 60, 60, 0.10);
}
.combat-line.combat-group-alert {
  background: rgba(220, 60, 60, 0.26);
  border-left-color: #ff5a5a;
  border-left-width: 5px;
  font-weight: 600;
}
.victim-name {
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: rgba(255, 90, 90, 0.7);
  text-underline-offset: 3px;
}
.group-member-line.group-hp-flash {
  animation: group-hp-flash 0.5s ease-in-out 3;
}
@keyframes group-hp-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(255, 70, 70, 0.35); }
}

/* Blank visual gap between the main-hand and off-hand sections of a
   dual-wield swing (added 2026-08-31, Matthew's ask -- previously the
   off-hand section ran straight into the main-hand block with no break).
   Transparent border, no min-height override -- .output-line's own 1.4em
   is enough to read as a real blank line, not a sliver. */
.combat-line.combat-spacer {
  border-left-color: transparent;
}

/* --- VERBS command reference (added 2026-08-20, restyled 2026-08-28,
   font-size fixed 2026-08-29) -- printed into the Story pane by verbs.js,
   entirely client-side. .verb-grid is a real 3-column CSS grid (not
   flex-wrap) so entries line up in true columns. .verb-link reads as a
   plain hyperlink -- no chip/button background or border, just color +
   underline-on-hover -- per Matthew's "more a UI feel than anything
   functional" (the earlier .compass-chip-style bordered-box treatment is
   gone); the detail line that appears on click uses the darker alt panel
   fill so it visually reads as "info that appeared", distinct from a typed
   command's echo or a server response. EVERY font-size below is `em`, not
   a fixed px -- Matthew caught that the restyle's fixed 12px/13px values
   were silently ignoring #output's --panel-font-size setting (the gear-
   icon per-panel font picker), so this block read too small regardless of
   his configured size and never scaled with it. em is relative to
   #output's own resolved size, so it now tracks that setting exactly like
   every other Story-pane element already does. --- */

.verbs-hint {
  color: var(--text-faint);
  /* em, not a fixed px (fixed 2026-08-29 -- see project memory "VERBS
     command reference": these were hardcoded px, so they never picked up
     #output's --panel-font-size setting the way every other Story-pane
     element does. em is relative to #output's OWN resolved font-size,
     which already reads var(--panel-font-size, 17px) -- so this scales
     with Matthew's per-panel font setting instead of ignoring it. */
  font-size: 0.85em;
  font-style: italic;
  margin-bottom: 6px;
}

.verb-category-header {
  color: var(--accent-gold);
  font-size: 0.8em; /* em, see .verbs-hint's comment above */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 10px 0 4px;
}

.verb-category-header.verb-category-admin {
  color: var(--accent-danger-bright);
}

.verb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 12px;
}

.verb-link {
  color: var(--accent-teal);
  /* No font-size override -- inherits #output's own resolved size
     (var(--panel-font-size, 17px)) directly, same as normal Story text.
     Was hardcoded 13px (fixed 2026-08-29, see .verbs-hint's comment
     above); the verb NAMES are the actual content Matthew's trying to
     read/click, so these get full body size, not the smaller/secondary
     treatment the hint text and labels use. */
  text-decoration: underline;
  text-decoration-color: transparent;
  cursor: pointer;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.verb-link:hover {
  color: #5fd9d9;
  text-decoration-color: var(--accent-teal);
}

.verb-detail {
  margin: 4px 0;
  padding: 8px 12px;
  background: var(--panel-fill-alt);
  border-left: 3px solid var(--accent-teal);
  border-radius: 0;
}

.verb-detail-name {
  color: var(--accent-gold-bright);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.verb-detail-aliases {
  color: var(--text-faint);
  font-size: 0.85em; /* em, see .verbs-hint's comment above */
  font-style: italic;
  margin-top: 2px;
}

.verb-detail-desc {
  color: var(--text-primary);
  margin-top: 4px;
}

.verb-detail-usage {
  color: var(--text-muted);
  font-size: 0.85em; /* em, see .verbs-hint's comment above */
  margin-top: 4px;
}

.combat-verdict-hit {
  color: var(--accent-gold-bright);
  font-weight: 700;
}

.combat-verdict-miss {
  color: var(--text-faint);
}

#input-bar {
  position: relative; /* anchors the channel menu above it (2026-10-09) */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: linear-gradient(to bottom, var(--header-grad-top), var(--header-grad-bottom));
  border-top: 3px solid var(--border-gold-dim);
  flex-shrink: 0;
}

#prompt-arrow {
  color: var(--accent-gold);
  font-family: var(--font-display);
  /* A real button now (2026-10-09, clickable channel picker); reset the browser look. */
  background: none;
  border: none;
  padding: 0 6px;
  margin: 0;
  font-size: inherit;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
}

#prompt-arrow:hover,
#prompt-arrow:focus-visible {
  color: var(--accent-gold-bright);
  background: rgba(217, 164, 65, 0.14);
  outline: none;
}

/* Sticky channel label beside the arrow, coloured per channel. */
#prompt-mode {
  font-family: var(--font-display);
  font-size: 0.8em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 9px;
  border: 1px solid currentColor;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
}
#prompt-mode:hover { background: rgba(255, 255, 255, 0.07); }
#prompt-mode[data-mode="say"] { color: var(--accent-gold); }
#prompt-mode[data-mode="shout"] { color: var(--accent-danger-bright); }
#prompt-mode[data-mode="tell"] { color: var(--accent-fe); }
#prompt-mode[data-mode="group"] { color: var(--accent-success); }
#prompt-mode[data-mode="emote"] { color: var(--accent-teal); }
#prompt-mode[data-mode="echo"] { color: #b48ead; }

#channel-menu {
  position: absolute;
  left: 12px;
  bottom: 100%;
  margin-bottom: 6px;
  min-width: 270px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  background: var(--panel-fill);
  border: 2px solid var(--border-gold-dim);
  border-radius: 4px;
  box-shadow: var(--shadow-panel);
  z-index: 1200;
}

#channel-menu .channel-heading {
  padding: 4px 10px 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#channel-menu .channel-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

#channel-menu .channel-item:hover:not(:disabled),
#channel-menu .channel-item:focus-visible {
  background: rgba(217, 164, 65, 0.14);
  outline: none;
}

#channel-menu .channel-item.is-current { color: var(--accent-gold-bright); }
#channel-menu .channel-item.is-disabled { color: var(--text-faint); cursor: default; }
#channel-menu .channel-hint { color: var(--text-faint); font-size: 0.85em; }

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 18px;
  outline: none;
}

/* --- Character screen --- */

#character-screen {
  max-width: 660px;
  margin: 6vh auto 0;
  padding: 28px;
  /* max-height + overflow-y (added 2026-07-29, bugfix) -- html/body got
     overflow:hidden on 2026-07-28 so dragging panels couldn't grow a
     whole-page scrollbar (see that rule's own comment). #panel-grid got
     its own internal overflow-y:auto in that same pass, but this screen
     didn't -- it's a plain tall form (character creation, esp. with the
     appearance + stat-roll sections) that used to rely on the page itself
     scrolling. Without its own scroll container, everything below the
     viewport fold became unreachable, including the stat-placement table.
     Same fix pattern as #panel-grid: bound the height and let THIS box
     scroll internally instead of the page. */
  max-height: 88vh;
  overflow-y: auto;
}

#character-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Starting Kit Choice (added 2026-08-30) -- minimal, reuses the same
   panel-fill/border tokens .character-card already uses below, so it
   matches the existing screen without introducing new colors. */
#create-kit-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.kit-option {
  display: block;
  padding: 8px 12px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  cursor: pointer;
}

.kit-option .subtitle {
  margin: 4px 0 0;
}

.character-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 15px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 4px;
}

.character-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.character-card-name {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

.character-card-meta {
  color: var(--text-muted);
  font-size: 15px;
}

.character-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

#character-list-view button,
#character-create-view button {
  padding: 8px 14px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.02em;
  cursor: pointer;
}

#character-list-view button:hover,
#character-create-view button:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

#create-character-btn {
  width: 100%;
  padding: 11px;
}

.secondary-btn {
  background: linear-gradient(to bottom, #3a3f4c, #262a34) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-dark) !important;
}

.secondary-btn:hover {
  background: linear-gradient(to bottom, #454b5a, #2e323e) !important;
}

.danger-btn {
  background: linear-gradient(to bottom, var(--accent-danger-bright), var(--accent-danger)) !important;
  color: #fff !important;
  border-color: #7a2a2a !important;
}

.danger-btn:hover {
  background: linear-gradient(to bottom, #e57070, #cf5252) !important;
}

/* --- Character creation form --- */

#character-create-view label {
  display: block;
  margin-top: 14px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 15px;
  letter-spacing: 0.02em;
}

#character-create-view input,
#character-create-view select {
  width: 100%;
  padding: 7px 9px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
}

#character-create-view input:focus,
#character-create-view select:focus {
  outline: none;
  border-color: var(--border-gold);
}

#race-description,
#class-description {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--text-muted);
  font-style: italic;
}

#roll-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.roll-chip {
  padding: 5px 9px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-gold);
  border-radius: 3px;
  color: var(--accent-gold-bright);
  font-size: 15px;
  white-space: nowrap;
}

.roll-chip small {
  color: #a8894f;
}

.roll-chip-used {
  background: var(--panel-fill);
  border-color: var(--border-dark);
  color: var(--text-faint);
  text-decoration: line-through;
}

.roll-chip-used small {
  color: var(--text-faint);
}

.stat-role {
  color: var(--text-muted);
  font-weight: normal;
}

/* --- Appearance picker --- */

.appearance-heading {
  display: block;
  margin-top: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#appearance-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.appearance-field label {
  margin-top: 8px !important;
}

#stat-roll-section {
  margin-top: 20px;
}

#stat-roll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 15px;
}

#reroll-btn {
  padding: 6px 12px !important;
  font-size: 13px !important;
}

#stat-placement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

#stat-placement-table th {
  text-align: left;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border-gold-dim);
}

#stat-placement-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-primary);
}

#stat-placement-table select {
  width: auto;
  padding: 4px 6px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
}

.mod-bonus {
  color: var(--accent-success);
}

.mod-penalty {
  color: var(--accent-danger-bright);
}

#create-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#create-actions button {
  flex: 1;
}

/* --- Delete confirmation modal --- */

#delete-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#delete-modal-box {
  max-width: 440px;
  width: 90%;
  padding: 24px;
  border-color: var(--accent-danger);
}

.delete-step p {
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.delete-step input {
  width: 100%;
  padding: 7px 9px;
  margin-bottom: 16px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
}

.delete-step button {
  padding: 8px 14px;
  border: none;
  border-radius: 3px;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
  margin-right: 8px;
}

/* --- Training Panel (added 2026-07-30, training panel redesign) -- same
   fixed-overlay pattern as the delete confirmation modal above.
   #training-modal-box picks up the shared "ornate panel" frame (gold
   double-border) via the selector list near the top of this file. --- */

#training-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 1000, not the 10 #delete-modal uses (added 2026-07-30, playtest fix --
     Matthew's screenshot showed Gridstack's own per-panel resize-handle
     corners rendering and even receiving hover/click THROUGH the modal.
     #delete-modal never hit this because it only ever shows on the
     character-select screen, before the panel grid exists at all -- this
     is the first modal that has to out-rank Gridstack's own internal
     z-index for its resize handles, which stock CDN CSS sets well above
     10. 1000 is comfortably above anything Gridstack itself uses. */
  z-index: 1000;
}

#training-modal-box {
  max-width: 640px;
  width: 92%;
  max-height: 82vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#training-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

#training-header h2 {
  margin: 0 0 4px;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}

#training-points {
  color: var(--text-muted);
  font-size: 15px;
}

/* Discoverability hint (added 2026-07-30, playtest feedback) -- the
   click-to-expand chevrons aren't obvious on their own, so this spells it
   out right under the point count where it can't be missed. */
#training-desc-hint {
  color: var(--accent-gold-bright);
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}

/* Level Up row (added 2026-08-04, leveling/training cadence rework) --
   whole row hidden via .hidden when nothing's claimable (see
   training-panel.js's render()). Sits in a small highlighted strip so it
   reads as a distinct call-to-action, not just another status line. */
#training-levelup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
}

#training-levelup-badge {
  color: var(--accent-gold-bright);
  font-weight: 700;
  font-size: 14px;
}

#training-levelup-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

#training-levelup-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

#training-levelup-btn:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.5;
}

#training-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 4px 0;
  margin-bottom: 10px;
}

.training-category-header {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 14px 0 4px;
}

.training-category:first-child .training-category-header {
  margin-top: 4px;
}

.training-mana-line {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
}

.training-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 3px;
}

/* Click-to-expand description toggle (added 2026-07-30) -- see project
   memory "skill descriptions content note". Collapsed by default, same
   chevron convention Known Spells' circle groups already use. */
.training-desc-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}

.training-desc-toggle:hover {
  color: var(--accent-gold-bright);
}

.training-desc-toggle-open {
  color: var(--accent-gold-bright);
}

.training-desc-spacer {
  flex: 0 0 auto;
  width: 18px;
}

.training-desc {
  margin: 0 0 6px 26px;
  padding: 6px 10px;
  background: var(--panel-fill-alt);
  border-left: 2px solid var(--border-gold-dim);
  border-radius: 3px;
  color: var(--text-muted);
  /* Matches .training-skill-name's 15px (bumped from 13px, playtest
     feedback: was noticeably smaller than the skill name above it, harder
     to read than it needed to be). */
  font-size: 15px;
  line-height: 1.4;
}

.training-row:hover {
  background: var(--panel-fill-alt);
}

.training-skill-name {
  flex: 1 1 34%;
  color: var(--text-primary);
  font-size: 15px;
}

.training-skill-rank {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 14px;
  min-width: 90px;
}

.training-skill-staged {
  flex: 0 0 auto;
  color: var(--accent-gold-bright);
  font-size: 13px;
}

.training-skill-avail,
.training-skill-restricted {
  flex: 1 1 auto;
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

.training-row-restricted {
  opacity: 0.6;
}

.training-add-btn,
.training-remove-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 700;
  cursor: pointer;
}

.training-add-btn:hover:not(:disabled),
.training-remove-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

.training-add-btn:disabled,
.training-remove-btn:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.5;
}

#training-error {
  color: var(--accent-danger-bright);
  font-size: 14px;
  margin-bottom: 8px;
}

#training-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#training-cart-summary {
  color: var(--text-primary);
  font-size: 15px;
}

#training-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

#training-footer button:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

#training-footer button:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.6;
}

/* --- Respec Panel (added 2026-08-30) -- same fixed-overlay pattern/
   z-index as #training-modal (the two are never open at once: RESPEC and
   TRAIN share the same Adventurer's Rest room gate, but only one modal is
   ever up at a time). Row/category classes are near-identical copies of
   .training-row/.training-category-header etc. above -- kept as their own
   .respec-* names rather than sharing classes because this panel's rows
   have a different button pair (+/- apply immediately, no staged count)
   and a per-level fraction (ranksThisLevel/maxThisLevel) the Training
   Panel has no equivalent of. See frontend/js/respec-panel.js's own header
   for why this panel is immediate-apply rather than a staged cart. */

#respec-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#respec-modal-box {
  max-width: 640px;
  width: 92%;
  max-height: 82vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#respec-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

#respec-header h2 {
  margin: 0 0 4px;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}

#respec-points {
  color: var(--text-muted);
  font-size: 15px;
}

#respec-hint {
  color: var(--accent-gold-bright);
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}

#respec-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 4px 0;
  margin-bottom: 10px;
}

.respec-category-header {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 14px 0 4px;
}

.respec-category:first-child .respec-category-header {
  margin-top: 4px;
}

.respec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 3px;
}

.respec-row:hover {
  background: var(--panel-fill-alt);
}

.respec-desc-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}

.respec-desc-toggle:hover {
  color: var(--accent-gold-bright);
}

.respec-desc-toggle-open {
  color: var(--accent-gold-bright);
}

.respec-desc-spacer {
  flex: 0 0 auto;
  width: 18px;
}

.respec-desc {
  margin: 0 0 6px 26px;
  padding: 6px 10px;
  background: var(--panel-fill-alt);
  border-left: 2px solid var(--border-gold-dim);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.4;
}

.respec-skill-name {
  flex: 1 1 34%;
  color: var(--text-primary);
  font-size: 15px;
}

.respec-skill-rank {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 14px;
  min-width: 90px;
}

.respec-skill-avail,
.respec-skill-restricted {
  flex: 1 1 auto;
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

.respec-row-restricted {
  opacity: 0.6;
}

.respec-add-btn,
.respec-remove-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 700;
  cursor: pointer;
}

.respec-add-btn:hover:not(:disabled),
.respec-remove-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

.respec-add-btn:disabled,
.respec-remove-btn:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.5;
}

#respec-error {
  color: var(--accent-danger-bright);
  font-size: 14px;
  margin-bottom: 8px;
}

#respec-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

#respec-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

#respec-footer button:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

/* Training Panel's own "open Respec" button (added 2026-08-30) -- sits in
   #training-header, small and secondary since it's a rare/deliberate
   action, not part of the normal training flow. Hidden entirely unless
   the server says this character is respec-eligible (level <= 10) -- see
   training-panel.js's render(). */
#training-respec-btn {
  margin-top: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: var(--panel-fill-alt);
  color: var(--accent-gold-bright);
  font-size: 13px;
  cursor: pointer;
}

#training-respec-btn:hover {
  background: var(--panel-fill);
}

/* --- Shop Catalog panel (added 2026-08-26, vendor CATALOG/package build)
   -- same fixed-overlay pattern and z-index as #training-modal, since the
   two are never open at the same time (CATALOG only works in a shop room,
   TRAIN only at the Adventurer's Rest). #shop-modal-box picks up the
   shared "ornate panel" frame via the selector list near the top of this
   file, same as #training-modal-box. --- */

#shop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#shop-modal-box {
  max-width: 640px;
  width: 92%;
  max-height: 82vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#shop-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

#shop-header h2 {
  margin: 0;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}

#shop-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 4px 0;
  margin-bottom: 10px;
}

.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 3px;
}

.shop-row:hover {
  background: var(--panel-fill-alt);
}

.shop-item-info {
  flex: 1 1 auto;
  min-width: 0;
}

.shop-item-name {
  color: var(--text-primary);
  font-size: 15px;
  margin-right: 8px;
}

.shop-item-level {
  color: var(--accent-gold-bright);
  font-size: 12px;
}

.shop-item-desc {
  color: var(--text-muted);
  /* Bumped 13px->15px to match .shop-item-name, same "was noticeably
     smaller than the name above it" fix already applied to
     .training-desc (2026-07-30) -- Matthew hit the identical complaint
     here on first live playtest of the shop popup (2026-08-27). */
  font-size: 15px;
  line-height: 1.3;
}

.shop-item-price {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 14px;
  min-width: 90px;
  text-align: right;
}

.shop-item-staged {
  flex: 0 0 auto;
  color: var(--accent-gold-bright);
  font-size: 13px;
}

/* Gem shop's per-row grade dropdown (added 2026-08-27, Phase 2c) -- sits
   in .shop-item-info under the description, same column .shop-item-level
   already occupies for every other shop's level-requirement note. Reuses
   the #character-create-view select's own padding/border/font recipe
   rather than inventing a second dropdown style for one shop. */
.shop-grade-select {
  display: block;
  margin-top: 4px;
  padding: 4px 6px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
}

.shop-grade-select:focus {
  outline: none;
  border-color: var(--border-gold-dim);
}

.shop-add-btn,
.shop-remove-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 700;
  cursor: pointer;
}

.shop-add-btn:hover:not(:disabled),
.shop-remove-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

.shop-add-btn:disabled,
.shop-remove-btn:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.5;
}

#shop-error {
  color: var(--accent-danger-bright);
  font-size: 14px;
  margin-bottom: 8px;
}

#shop-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#shop-cart-summary {
  color: var(--text-muted);
  font-size: 14px;
}

#shop-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

#shop-footer button:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

#shop-footer button:disabled {
  background: var(--panel-fill-alt);
  border-color: var(--border-dark);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.6;
}

/* --- Special Order panel (added 2026-08-27, Phase 3b popup rebuild) --
   same fixed-overlay pattern and z-index as #shop-modal, since ORDER only
   opens from a shop room and never alongside CATALOG. #order-modal-box
   picks up the shared "ornate panel" frame via the selector list near the
   top of this file, same as #shop-modal-box.

   Unlike #shop-list's flat rows, #order-list is an ACCORDION -- each
   .order-row-wrap can expand a .order-config-panel directly beneath its
   row (order-panel.js's renderRow()/renderConfigPanel()), so the row and
   its config panel are styled as one visually joined block rather than
   two separate list entries. --- */

#order-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#order-modal-box {
  max-width: 640px;
  width: 92%;
  max-height: 82vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#order-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

#order-header h2 {
  margin: 0;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}

#order-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 4px 0;
  margin-bottom: 10px;
}

.order-row-wrap {
  border-radius: 3px;
  margin-bottom: 2px;
}

.order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 3px;
}

.order-row:hover {
  background: var(--panel-fill-alt);
}

.order-item-info {
  flex: 1 1 auto;
  min-width: 0;
}

.order-item-name {
  color: var(--text-primary);
  font-size: 15px;
  margin-right: 8px;
}

.order-item-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.3;
}

.order-configure-btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
}

.order-configure-btn:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

/* The expanded configuration panel -- material dropdown, any
   customization dropdowns, live price/timing summary, and the row's own
   Place Order button. Sits directly under its row, set off with a subtle
   inset background+border so it reads as "belonging to" the row above it
   rather than as the next item in the list. */
.order-config-panel {
  margin: 0 4px 10px;
  padding: 12px;
  background: var(--panel-fill-alt);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-material-label,
.order-custom-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
  /* 13px->15px (2026-08-27, first live playtest) -- same "noticeably
     smaller than the rest of the popup" fix already applied to
     .shop-item-desc and .training-desc before it. */
  font-size: 15px;
}

/* Same dropdown recipe .shop-grade-select established for the gem shop's
   grade select (2026-08-27) -- reused rather than inventing a third
   dropdown style for the same visual role. Bumped 13px->15px same session
   as the label fix above -- the option text (material name/bonus/price/
   wait/level) is the main thing being read in this whole panel, it
   shouldn't be the smallest text on screen. */
.order-material-select,
.order-custom-select {
  padding: 4px 6px;
  background: var(--panel-fill);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
}

.order-material-select:focus,
.order-custom-select:focus {
  outline: none;
  border-color: var(--border-gold-dim);
}

.order-custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.order-summary {
  color: var(--accent-gold-bright);
  font-size: 16px;
}

.order-place-btn {
  align-self: flex-start;
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

.order-place-btn:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

#order-error {
  color: var(--accent-danger-bright);
  font-size: 14px;
  margin-bottom: 8px;
}

#order-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#order-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
}

#order-footer button:hover {
  background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright));
}

/* --- Level Up confirm modal (added 2026-08-04, leveling/training cadence
   rework) -- same fixed-overlay pattern as #delete-modal/#training-modal
   above. z-index 1100, ABOVE #training-modal's 1000, since this is opened
   from a button inside that panel and has to outrank it -- same reasoning
   #training-modal's own z-index note gives for outranking Gridstack. --- */

#levelup-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

#levelup-modal-box {
  max-width: 440px;
  width: 90%;
  padding: 24px;
}

#levelup-modal-box h2 {
  margin: 0 0 12px;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}

#levelup-modal-box p {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 18px;
}

#levelup-modal-box button {
  padding: 8px 14px;
  border: none;
  border-radius: 3px;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
  margin-right: 8px;
}

/* --- JOURNAL popup (added 2026-09-25, lore-site quest engine) -- same
   fixed-overlay pattern and z-index as #order-modal. Two tabs (Active /
   Completed); frontend/js/journal-panel.js renders #journal-list. --- */
#journal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#journal-modal.hidden { display: none; }
#journal-modal-box {
  max-width: 760px;
  width: 92%;
  max-height: 82vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
#journal-header {
  flex-shrink: 0;
  margin-bottom: 10px;
}
#journal-header h2 {
  margin: 0 0 10px;
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}
#journal-tabs { display: flex; gap: 6px; }
.journal-tab {
  background: var(--panel-fill-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  padding: 6px 14px;
  font-family: var(--font-body);
  cursor: pointer;
}
.journal-tab.active {
  color: var(--accent-gold-bright);
  border-color: var(--border-gold-dim);
}
#journal-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 6px 0;
  margin-bottom: 10px;
}
.journal-entry {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border-dark);
}
.journal-entry:last-child { border-bottom: none; }
.journal-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.journal-title {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: bold;
}
.journal-current {
  color: var(--text-primary);
  margin-top: 6px;
  font-style: italic;
  font-size: 19px;
  line-height: 1.4;
}
.journal-done {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.45;
}
.journal-line {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 17px;
}
.journal-empty {
  color: var(--text-muted);
  padding: 12px 6px;
}
.journal-abandon-btn {
  padding: 3px 10px;
  font-size: 13px;
  flex-shrink: 0;
}
/* --- Codex tab (added 2026-10-14, Echoes) --- */
.codex-summary {
  color: var(--text-muted);
  padding: 8px 6px 4px;
  font-size: 16px;
}
.codex-region {
  padding: 12px 6px;
  border-bottom: 1px solid var(--border-dark);
}
.codex-region:last-child { border-bottom: none; }
.codex-region-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.codex-count {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
}
.codex-none {
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0 4px;
}
.codex-entry {
  margin: 4px 0;
  padding: 4px 8px;
  border-left: 2px solid var(--border-gold-dim);
}
.codex-entry summary {
  cursor: pointer;
  list-style: none;
}
.codex-entry summary::-webkit-details-marker { display: none; }
.codex-entry-title {
  display: block;
  color: var(--text-primary);
  font-weight: bold;
  font-size: 18px;
}
.codex-entry-hint {
  display: block;
  color: var(--text-muted);
  font-style: italic;
  font-size: 16px;
}
.codex-entry-text {
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.45;
}
.codex-complete {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-gold-dim);
  background: var(--panel-fill-alt);
}
.codex-complete-title {
  color: var(--accent-gold-bright);
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 6px;
}
.codex-complete p {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.5;
}
#journal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
}
#journal-footer button { padding: 8px 16px; }

/* Roll-math readability (2026-10-06): math dims, damage number pops,
   hits on you tinted red, hits you land tinted green, misses fade. */
.combat-math {
  color: var(--text-muted);
}
.combat-damage {
  font-size: 1.25em;
  font-weight: 800;
}
.combat-damage.combat-damage-small {
  font-size: 1em; /* flare / poison-tick damage: same colour and bold, normal size (2026-11-12) */
}
.combat-line.combat-hit-dealt {
  background: rgba(110, 190, 110, 0.10);
}
.combat-line.combat-hit-dealt .combat-damage {
  color: #8fd68f;
}
.combat-line.combat-hit-taken {
  background: rgba(214, 84, 84, 0.14);
}
.combat-line.combat-hit-taken .combat-damage {
  color: #ff7b7b;
}
.combat-line.combat-hit-taken .combat-verdict-hit {
  color: #ff7b7b;
}
.combat-line.combat-missed {
  opacity: 1;
}

/* Panel lock (2026-10-06): hide resize handles while locked and add a small
   gap above the lock row inside the Panels dropdown. */
.panels-locked .ui-resizable-handle { display: none !important; }
.panel-toggle-lock { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-dark); }

#channel-menu .channel-item.is-back { margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.15); font-style: italic; opacity: 0.7; }
#channel-menu .channel-item.is-back:hover { opacity: 1; }

/* Echo panel (server-wide mind channel, 2026-10-09). */
#echo-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; font-size: 0.9em; }
#echo-panel .echo-top { display: flex; align-items: center; gap: 10px; padding: 2px 4px 6px; flex: 0 0 auto; }
#echo-panel .echo-status { color: var(--text-faint); flex: 1; }
#echo-panel .echo-status.echo-open { color: #b48ead; }
#echo-panel .echo-toggle { cursor: pointer; }
#echo-panel .echo-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 4px; }
#echo-panel .echo-line { padding: 1px 0; overflow-wrap: anywhere; }
#echo-panel .echo-time { color: var(--text-faint); margin-right: 6px; font-size: 0.85em; }
#echo-panel .echo-name { color: #b48ead; }
#echo-panel .echo-self .echo-name { color: var(--accent-gold); }
#echo-panel .echo-note { color: var(--text-faint); font-style: italic; padding: 1px 0; }
#echo-panel .echo-speak { flex: 0 0 auto; margin: 6px 4px 2px; padding: 5px 8px; background: rgba(0,0,0,0.25); border: 1px solid var(--accent-gold, #8a6d3b); border-radius: 3px; color: var(--text-primary); font-family: var(--font-body); font-size: 1em; outline: none; }
#echo-panel .echo-speak:disabled { opacity: 0.5; cursor: not-allowed; }
#echo-panel .echo-speak:focus { border-color: #b48ead; }

/* Titles (2026-10-23) -- a worn title sits before a player's name; TITLES lists earned ones in blue, unearned in grey. */
.player-title { color: #7fcfff; font-weight: 400; }
.title-earned { color: #3db8ff; font-weight: 700; }
.title-locked { color: #8d8d8d; }

.splash-footer a { color: #c9a45c; text-decoration: underline dotted; text-underline-offset: 3px; }
.splash-footer a:hover { color: #e8c56a; text-decoration: underline; }


/* --- HP / Mana strip (2026-10-28) --- */
#vitals-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  padding: 5px 16px;
  background: var(--panel-fill-alt);
  border-bottom: 1px solid var(--border-dark);
  flex-shrink: 0;
}
.vital-big { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; max-width: 420px; }
.vital-big-label {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: 46px;
  flex-shrink: 0;
}
.vital-big-track {
  position: relative;
  flex: 1 1 auto;
  height: 22px;
  background: var(--panel-fill);
  border: 1px solid var(--border-dark);
  border-radius: 11px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.vital-big-track .vital-bar-fill { position: absolute; left: 0; top: 0; }
.vital-big-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}
/* Warning states: bar turns amber, then red and pulses. */
.vital-big.vital-warn .vital-bar-fill { background: linear-gradient(to bottom, #f0c050, #d9962a); }
.vital-big.vital-crit .vital-bar-fill { background: linear-gradient(to bottom, #ff5a4a, #c42a2a); }
.vital-big.vital-warn .vital-big-track { border-color: #d9962a; }
.vital-big.vital-crit .vital-big-track { border-color: #ff5a4a; animation: vital-pulse 0.9s ease-in-out infinite; }
@keyframes vital-pulse {
  0%, 100% { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 0 rgba(255, 90, 74, 0); }
  50% { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 90, 74, 0.85); }
}

/* 2026-10-28: HP/Mana now live inside #top-bar (try-out of "fold into header"); shorter bars, no strip chrome. */
#top-bar #vitals-strip { background: none; border: 0; padding: 0; gap: 4px 14px; flex: 0 1 auto; flex-wrap: nowrap; }
#top-bar .vital-big { flex: 0 0 auto; max-width: none; gap: 8px; }
#top-bar .vital-big-label { width: auto; font-size: 13px; }
#top-bar .vital-big-track { width: 120px; flex: 0 0 auto; height: 22px; }
#top-bar #vitals-bar { flex: 0 1 auto; }

/* --- Main menu (2026-10-28): hamburger at the far left of the header --- */
.main-menu { position: relative; flex-shrink: 0; }
.main-menu-btn {
  padding: 4px 11px;
  background: transparent;
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.main-menu-btn:hover { color: var(--accent-gold-bright); border-color: var(--accent-gold); }
.main-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
  padding: 10px 12px;
  background: var(--panel-fill);
  border: 2px solid var(--border-gold-dim);
  border-radius: 6px;
  box-shadow: var(--shadow-panel);
}
.main-menu-item {
  padding: 7px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.main-menu-item:hover { color: var(--accent-gold-bright); border-color: var(--border-gold-dim); }
/* The Panels control inside the menu: button full width, its list expands inline instead of floating. */
.main-menu .panel-toggle { margin-left: 0; position: static; display: flex; flex-direction: column; gap: 6px; }
.main-menu .panel-toggle-btn { width: 100%; text-align: left; padding: 7px 10px; border-color: var(--border-dark); color: var(--text-primary); }
.main-menu .panel-toggle-dropdown { position: static; min-width: 0; box-shadow: none; border-width: 1px; margin-top: 0; }

/* --- Header at the bottom (2026-10-28, Matthew): vitals/menu bar sits under the command line so the eyes stay
   in one place. Pure CSS reorder of the #game-screen column -- delete this block to put it back on top. --- */
#panel-grid { order: 1; }
#input-bar { order: 2; }
#top-bar {
  order: 3;
  border-bottom: 0;
  border-top: 3px solid var(--border-gold-dim);
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.4);
}
.main-menu-dropdown { top: auto; bottom: calc(100% + 6px); max-height: calc(100vh - 90px); overflow-y: auto; }

/* 2026-10-28 tweaks: slightly longer HP/Mana bars; Vigor no longer dimmed in the header (it was the .inactive
   opacity used below level 10) so it reads like Focus/XP. */
#top-bar .vital-big-track { width: 150px; }
#top-bar #vigor-vital.inactive { opacity: 1; }

/* --- Action Timer glow in the command line (2026-10-28) --- */
#input-bar { isolation: isolate; }
#at-glow {
  position: absolute;
  left: 0;
  top: 0;         /* absolute offsets start inside the bar's own border */
  bottom: 0;
  width: 0;
  z-index: -1;    /* above the bar's background, below the prompt and the typed text */
  pointer-events: none;
  background: linear-gradient(to right, rgba(62, 201, 201, 0.30), rgba(62, 201, 201, 0.16));
  border-right: 2px solid rgba(62, 201, 201, 0.55);
  transition: width 0.27s linear;
}
#at-glow.hidden { display: none; }

/* 2026-10-28: the command bar (and the channel menu that pops up from its ">") must sit above overlapping panels,
   whose z-index grows as they are raised (kept under 800 in panels.js). Below the 1000+ modals. */
#input-bar { z-index: 900; }

/* --- Level-up indicator keeps its slot in the header (2026-10-28) ---
   It used to appear with display:none -> shown and a long sentence, which made the header wrap onto a new line
   and shifted the whole screen. Now it is short, never wraps, and keeps its space (invisible) when no level is pending. */
#top-bar .levelup-indicator { white-space: nowrap; flex: 0 0 auto; }
#top-bar .levelup-indicator.hidden { display: inline-flex !important; visibility: hidden; }

/* ---- Monster difficulty ("con") display (2026-10-28) ----
   A border around the monster's name plus 1-4 skulls after it. The border STYLE also changes with the tier
   (dotted / thin / solid / thick / double) so it still reads without color. The colorblind palette swaps
   the five color variables only (settings gear -> "Colorblind-safe difficulty colors"). Name text keeps its
   usual orange; only the edging carries the tier. */
:root {
  --con-grey: #8a8f9c;   /* tier 0: no XP */
  --con-easy: #4fbf6a;   /* tier 1 */
  --con-fair: #4a9eff;   /* tier 2 */
  --con-hard: #f0a030;   /* tier 3 */
  --con-deadly: #e5484d; /* tier 4 */
  --con-above: #a06be0;  /* tier 5: no XP, 6+ levels above you */
}
/* Okabe-Ito based: stays distinguishable with red-green and blue-yellow color blindness. */
html[data-con-palette="cb"] {
  --con-grey: #9aa0ad;
  --con-easy: #56b4e9;
  --con-fair: #f0e442;
  --con-hard: #d55e00;
  --con-deadly: #cc79a7;
  --con-above: #009e73;  /* bluish green: the only Okabe-Ito hue not used above */
}
.con-0 { --con-color: var(--con-grey); }
.con-1 { --con-color: var(--con-easy); }
.con-2 { --con-color: var(--con-fair); }
.con-3 { --con-color: var(--con-hard); }
.con-4 { --con-color: var(--con-deadly); }
.con-5 { --con-color: var(--con-above); }

.monster-name[class*="con-"], .con-name[class*="con-"] {
  padding: 0 0.3em;
  border: 1px solid var(--con-color);
  border-radius: 3px;
}
.monster-name.con-0, .con-name.con-0 { border-style: dotted; }
.monster-name.con-1, .con-name.con-1 { border-width: 1px; }
.monster-name.con-2, .con-name.con-2 { border-width: 1px; box-shadow: 0 0 0 1px var(--con-color) inset; }
.monster-name.con-3, .con-name.con-3 { border-width: 2px; }
.monster-name.con-4, .con-name.con-4 { border-width: 3px; border-style: double; }
.monster-name.con-5, .con-name.con-5 { border-width: 2px; border-style: dashed; }

.con-marks {
  margin-left: 0.3em;
  color: var(--con-color);
  font-size: 0.85em;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.panel-settings-popover .panel-settings-check {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Connection lost banner (2026-11-10) */
#connection-lost {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 12, 17, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}
#connection-lost.hidden { display: none; }
#connection-lost-box {
  max-width: 420px;
  margin: 16px;
  padding: 24px 28px;
  background: var(--panel-fill);
  border: 1px solid var(--border-gold-dim);
  border-radius: 4px;
  text-align: center;
  color: var(--text-primary);
}
#connection-lost-box h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  color: var(--accent-gold);
}
#connection-lost-box p { margin: 0 0 18px; line-height: 1.45; }
#connection-lost-btn {
  padding: 9px 22px;
  background: linear-gradient(to bottom, var(--accent-gold-bright), var(--accent-gold));
  border: 1px solid var(--border-gold-dim);
  border-radius: 3px;
  color: #1a1208;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
}
#connection-lost-btn:hover { background: linear-gradient(to bottom, #f0c66a, var(--accent-gold-bright)); }

/* DEV label on the login screen (2026-11-10); hidden on the live site */
#env-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 10px;
  border: 1px solid var(--accent-danger);
  border-radius: 3px;
  color: var(--accent-danger-bright);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
}
#env-badge.hidden { display: none; }

/* Splash 18+ line and What's New panel (2026-11-11) */
.splash-age { font-size: 16px; color: var(--text-muted); max-width: 520px; margin: 10px auto 0; text-align: center; }
#news-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; }
#news-overlay.hidden { display: none; }
#news-box { background: #1b1e2b; border: 2px solid #8a6d3b; border-radius: 4px; color: #e6e0d0; width: min(560px, 92vw); max-height: 80vh; display: flex; flex-direction: column; padding: 18px 20px; }
#news-box h2 { margin: 0 0 10px; color: #e8c56a; font-weight: normal; }
#news-box h3 { margin: 14px 0 6px; color: #e8c56a; font-size: 15px; font-weight: normal; }
#news-box ul { margin: 0; padding-left: 20px; }
#news-box li { margin-bottom: 6px; line-height: 1.4; }
#news-body { overflow-y: auto; flex: 1; padding-right: 6px; }
#news-close { margin-top: 14px; align-self: flex-end; cursor: pointer; }

/* Character screen error messages -- larger and bolder so the account
   character-limit message is easy to read (2026-11-19). */
#character-list-error,
#character-create-error {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.4;
}
