/* ── Norraph theme ─────────────────────────────────────────────────────
   Classic-EverQuest (Velious-era stone UI) skin shared by all pages.
   Pages keep only their own layout in an inline <style>; every
   component's look-and-feel lives here.

   The construction, taken from the original UI: COOL lavender-blue
   marble stone (not gray, not brown) with large blotchy mottling, warm
   parchment inserts with dark ink (the chat scroll), bone/ivory button
   plates with dark serif caps sunk in a black groove (WHO/INVITE/CAMP),
   and real two-tone bevels — light edge top/left, dark edge bottom/
   right, inverted on sunken wells. Gold is trim, warm-vs-cool is the
   charm.

   Contrast: --ink-muted clears WCAG AA (4.5:1) against --stone-1, the
   lightest dark surface text sits on — recheck it if you lighten the
   stone. Parchment ink colors all clear 4.5:1 on --parch-bg. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;

  --bg: #121116;              /* cool near-black */
  --stone-1: #565165;         /* marble panel gradient, lit top */
  --stone-2: #3e3a4b;         /* marble panel gradient, shaded bottom */
  --panel: #464254;           /* flat stone (dropdown rows) */
  --panel-deep: #0d0c12;      /* sunken wells: inputs, chips, badges */

  --edge-hi: #7d7794;         /* bevel light edge (top/left of raised) */
  --edge-lo: #14121b;         /* bevel dark edge (bottom/right of raised) */
  --line: #575163;            /* hairline rules inside panels */
  --line-strong: #6e6885;

  /* bone/ivory button plates */
  --bone-1: #ece5d1;          /* face, lit top */
  --bone-2: #ccc0a5;          /* face, shaded bottom */
  --bone-edge-hi: #f7f2e4;
  --bone-edge-lo: #8a7f63;
  --bone-frame: #0e0d12;      /* black groove the plate sits in */
  --bone-ink: #2a2417;        /* 7.4:1 even on --bone-2 */

  /* scroll rollers — wood dowel ends on single-instance parchment surfaces */
  --wood-1: #9a6b34;
  --wood-2: #4a3016;

  /* parchment inserts */
  --parch-bg: #e7ddc0;
  --parch-line: #a3946c;
  --parch-ink: #33301f;       /* 13:1 on --parch-bg */
  --parch-ink-soft: #6b5f3e;  /* 4.6:1 */
  --parch-accent: #7a4d05;    /* 5.2:1 */

  --gold: #e8a82a;            /* 8.8:1 on --bg */
  --gold-bright: #f2bc4b;
  --gold-dim: #c8a860;        /* footer links on --bg only; fails AA on stone — use --ink-muted there */
  --parchment: #f0e4c8;       /* body text on dark stone */
  --ink-muted: #d8c9a5;       /* 4.6:1 on --stone-1 (lightest backdrop) */

  /* marble veining — turbulence swirls, tiles at 320px. Gray veins at
     moderate alpha: lightens dark stone, darkens light marble, so one
     texture serves both. Knobs: baseFrequency = vein size (higher =
     tighter), slope = intensity. Slope raised from the original 0.17 —
     the reference client's stone panels show clearly visible mottled
     clouds even in flat, button-free areas; 0.17 read as almost smooth
     at normal viewing size. */
  --marble-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.022 0.028' numOctaves='4' seed='7'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.3'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  /* same cloudy turbulence as the marble, at a lower alpha (0.15 vs 0.3) —
     a subtler mottle for the bone button face. */
  --bone-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='bt'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.022 0.028' numOctaves='4' seed='7'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.4'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23bt)'/%3E%3C/svg%3E");
  /* paper fiber for parchment surfaces */
  --parch-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.11' numOctaves='3' seed='11'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.09'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  /* fine grain for the page background */
  --grain-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --font-display: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', serif;
  --font-body: Georgia, 'Palatino Linotype', 'Times New Roman', serif;
}

body {
  font-family: var(--font-body);
  color: var(--parchment);
  font-size: 14px;
  background-color: var(--bg);
  /* cool stone, darkened corners, grain — the warm torchlight glow is a
     separate animated layer below (body::before) */
  background-image:
    radial-gradient(130% 130% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.5)),
    var(--grain-tex);
  background-attachment: fixed;
}
/* torchlight breathing over the stone — slow and low-amplitude so it reads
   as ambient light, not a UI animation. Disabled with everything else under
   prefers-reduced-motion via the *, *::before, *::after rule below. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(1100px 700px at 50% -8%, rgba(232, 168, 42, 0.1), transparent 60%);
  animation: torch-flicker 6.5s ease-in-out infinite;
}
@keyframes torch-flicker {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}

/* Thin stone scrollbars, everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #8b849f; }

/* ── Header: a stone title bar ── */
header {
  padding: 14px 28px;
  background: var(--marble-tex), linear-gradient(180deg, #524e61, #363242);
  border-bottom: 2px solid var(--edge-lo);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.09), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 3px 12px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}
/* gold inlay fading at the edges, under the banner */
header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 168, 42, 0.55) 30%, rgba(232, 168, 42, 0.55) 70%, transparent);
  pointer-events: none;
}
.header-title { display: flex; flex-direction: column; gap: 3px; }
header h1 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
  /* engraved: dark cut above, lit edge below */
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 236, 180, 0.18), 0 0 22px rgba(232, 168, 42, 0.25);
}
.header-sub { font-size: 11px; color: var(--ink-muted); letter-spacing: 0.22em; text-transform: uppercase; }

.nav-links { margin-left: auto; display: flex; gap: 8px; }

/* MacroSocket + MacroButton component (public/components.js): a recessed
   cavity carved into the panel, holding a raised button/link. Used by
   every non-text button on every page (nav links, Show all/Show
   remaining/Clear owned). .text-action is the separate plain-text idiom
   and doesn't use this. Light source is top-right: the raised button
   catches light top+right and shadows bottom+left; the recessed socket
   is the inverse — dark top+right, lit bottom+left. Size fits the label
   by default; .square fixes it to 90x90 regardless of label length. */
.macro-socket {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: var(--marble-tex), linear-gradient(180deg, var(--stone-1), var(--stone-2));
  border-width: 4px;
  border-style: solid;
  border-top-color: #362c5a;
  border-right-color: #362c5a;
  border-bottom-color: var(--edge-hi);
  border-left-color: var(--edge-hi);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: inset -2px -2px 3px rgba(255, 255, 255, 0.12), inset 2px 2px 3px rgba(0, 0, 0, 0.55);
}
.macro-socket.square {
  flex-grow: 0;
  flex-shrink: 0;
  flex-basis: auto;
  width: 90px;
  height: 90px;
  border-width: 5px;
}
.macro-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 13px;
  padding-right: 23px;
  padding-bottom: 13px;
  padding-left: 23px;
  overflow-wrap: break-word;
  background-image: var(--bone-tex), var(--parch-tex), linear-gradient(180deg, var(--bone-1) 0%, #d9cead 55%, var(--bone-2) 100%);
  border-width: 0;
  border-style: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  color: var(--bone-ink);
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-body);
  line-height: 1.3;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  box-shadow: none;
  transition-property: filter;
  transition-duration: 150ms;
}
/* Raised bevel, light source top-right: top+right edges lighten toward
   white, bottom+left edges darken toward black, each fading back to the
   button's own color over 5px (6px for .square) — not a flat two-tone
   border. Built with mix-blend-mode (lighten/darken) rather than fixed
   overlay colors, so it reads as brightening/dimming whatever's actually
   underneath (the real parchment-tex + bone gradient) instead of painting
   a color on top. The turbulence layer (--bone-tex again, same blend
   mode) breaks up what would otherwise be a mathematically perfect
   gradient, so the bevel itself looks faintly mottled rather than smooth.
   clip-path confines each pseudo-element to an L-shaped region (its own
   two edges) with a 45° miter at the corner where they meet — without it,
   the two independent per-edge gradients overlap as a rectangle at that
   corner instead of a clean diagonal seam, and at the *other* two corners
   (top-left, bottom-right — where light meets dark) the two differently-
   blended pseudo-elements would otherwise collide edge-on rather than
   meeting along a miter. */
.macro-btn::before, .macro-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.macro-btn::before {
  background-image:
    var(--bone-tex),
    linear-gradient(to bottom, white, transparent 5px),
    linear-gradient(to left, white, transparent 5px);
  mix-blend-mode: lighten;
  clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - 5px) calc(100% - 5px), calc(100% - 5px) 5px, 5px 5px);
}
.macro-btn::after {
  background-image:
    var(--bone-tex),
    linear-gradient(to top, black, transparent 5px),
    linear-gradient(to right, black, transparent 5px);
  mix-blend-mode: darken;
  clip-path: polygon(0 0, 0 100%, 100% 100%, calc(100% - 5px) calc(100% - 5px), 5px calc(100% - 5px), 5px 5px);
}
.macro-btn.square {
  width: 100%;
  height: 100%;
  padding-top: 9px;
  padding-right: 9px;
  padding-bottom: 9px;
  padding-left: 9px;
  font-size: 10.5px;
}
.macro-btn.square::before {
  background-image:
    var(--bone-tex),
    linear-gradient(to bottom, white, transparent 6px),
    linear-gradient(to left, white, transparent 6px);
  clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 6px, 6px 6px);
}
.macro-btn.square::after {
  background-image:
    var(--bone-tex),
    linear-gradient(to top, black, transparent 6px),
    linear-gradient(to right, black, transparent 6px);
  clip-path: polygon(0 0, 0 100%, 100% 100%, calc(100% - 6px) calc(100% - 6px), 6px calc(100% - 6px), 6px 6px);
}
.macro-btn.long-label { font-size: 8.5px; }
.macro-btn:hover { filter: brightness(1.05); }
.macro-btn:active {
  border-image-source: linear-gradient(225deg, var(--bone-edge-lo), var(--bone-edge-hi));
  border-image-slice: 1;
  box-shadow: inset 2px -2px 3px rgba(255, 255, 255, 0.3), inset -2px 2px 3px rgba(0, 0, 0, 0.35);
  filter: brightness(0.96);
}
.macro-btn:focus-visible {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--gold);
  outline-offset: 2px;
}

/* ── Panels: raised marble blocks with a real bevel ── */
.controls-panel, .filter-bar, .finder-bar, .zone-card, .route-card,
.tag-dropdown {
  background: var(--marble-tex), linear-gradient(180deg, var(--stone-1), var(--stone-2));
  border: 4px solid;
  border-color: var(--edge-hi) var(--edge-lo) var(--edge-lo) var(--edge-hi);
  border-radius: 3px;
  /* a modest outer shadow, not the old large diffuse one — panels read as
     mounted plates in a console, not cards floating above a page. See
     DECISIONS.md for how this was worked out on the Spell Finder page
     before propagating here. */
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
}
/* gold inlay hairline on the primary control surfaces */
.controls-panel, .finder-bar, .route-card {
  outline: 1px solid rgba(232, 168, 42, 0.22);
  outline-offset: -5px;
}

/* ── Fields: sunken wells (bevel inverted) ── */
.field label {
  font-size: 11px; color: var(--ink-muted); white-space: nowrap;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}
.field select, .field input, .tag-wrap {
  background: var(--panel-deep);
  /* deeper, more pronounced socket than the original 3px/lighter shadow —
     matches the reference client's carved-in button/field wells rather
     than a thin groove. Worked out on the Spell Finder page; propagated
     here for consistency across all three pages. */
  border: 4px solid;
  border-color: var(--edge-lo) #615b72 #615b72 var(--edge-lo);
  color: var(--parchment);
  border-radius: 3px;
  font-size: 13px;
  font-family: var(--font-body);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: border-color 150ms, box-shadow 150ms;
}
.field select, .field input { padding: 6px 12px; }
.field select:hover, .field input:hover, .tag-wrap:hover { border-color: var(--edge-lo) #837c9d #837c9d var(--edge-lo); }
.field select:focus, .field input:focus, .tag-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(232, 168, 42, 0.18);
  outline: none;
}
input::placeholder { color: var(--ink-muted); opacity: 0.75; }

/* ── Buttons: bone plates with dark serif caps, sunk in a black groove
   (WHO / INVITE / DISBAND). One visual family — .secondary only sizes
   down. The domed face: lit top edge, warm shadow at the bottom. ── */
button {
  padding: 8px 22px;
  background: var(--parch-tex), linear-gradient(180deg, var(--bone-1) 0%, #d9cead 55%, var(--bone-2) 100%);
  border: 2px solid;
  border-color: var(--bone-edge-hi) var(--bone-edge-lo) var(--bone-edge-lo) var(--bone-edge-hi);
  color: var(--bone-ink); border-radius: 2px; cursor: pointer;
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  font-family: var(--font-body);
  box-shadow: 0 0 0 2px var(--bone-frame), 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: filter 150ms;
}
button:hover { filter: brightness(1.05); }
button:active {
  border-color: var(--bone-edge-lo) var(--bone-edge-hi) var(--bone-edge-hi) var(--bone-edge-lo);
  filter: brightness(0.96);
}
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

button.secondary { padding: 5px 14px; font-size: 11.5px; }

/* Plain text actions (Show all / Clear owned / Reset filters), not bone
   plates — as full buttons these read as too busy for a secondary,
   infrequent toggle sitting next to other status text. Shared by all
   three pages. ink-muted (not gold-dim) since these sit on the stone
   panel, not --bg — gold-dim is documented as failing AA there. */
.text-action {
  background: none; border: none; box-shadow: none; border-radius: 0;
  padding: 0; min-height: 0;
  font-family: var(--font-body); font-size: 12px; font-weight: 400;
  letter-spacing: normal; text-transform: none; text-shadow: none;
  color: var(--ink-muted); text-decoration: none; cursor: pointer;
}
.text-action:hover { text-decoration: underline; color: var(--gold-bright); filter: none; }
.text-action:active { filter: none; }
.text-action:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Tab bar: switch between result categories without scrolling past them ── */
.tab-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 14px; border-bottom: 2px solid var(--edge-lo); flex-shrink: 0; }
/* Author `display: flex` above wins the cascade over the UA [hidden] rule
   (author beats UA at equal specificity) — without this, setting the
   `hidden` property on #browser-tabs leaves it visibly displayed. */
.tab-bar[hidden] { display: none; }
.tab-button { padding: 6px 16px; font-size: 12px; }
.tab-button .tab-count { margin-left: 6px; color: var(--parch-accent); }
.tab-button[aria-selected="true"] {
  border-color: var(--bone-edge-lo) var(--bone-edge-hi) var(--bone-edge-hi) var(--bone-edge-lo);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 0 2px var(--bone-frame), 0 0 8px rgba(232, 168, 42, 0.5);
}
.tab-button[aria-selected="true"] .tab-count { color: var(--bone-frame); opacity: 0.75; }

/* ── Tag inputs (Spell Class / Specific Spells / Specific Zones) ── */
.tag-wrap {
  position: relative; flex: 1; min-width: 0;
  padding: 5px 8px; display: flex; flex-direction: column; gap: 4px; cursor: text;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-list:empty { display: none; }
.tag-item {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(232, 168, 42, 0.14); border: 1px solid rgba(232, 168, 42, 0.35);
  border-radius: 3px; padding: 2px 4px 2px 8px; font-size: 11px; color: #d4ad59;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.tag-item-name { overflow: hidden; text-overflow: ellipsis; }
.tag-item-remove {
  flex-shrink: 0; width: 16px; height: 16px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-muted); font-size: 12px; line-height: 1;
  background: transparent; border: none; padding: 0; font-weight: 400;
  box-shadow: none; text-shadow: none; text-transform: none; letter-spacing: 0;
  font-family: var(--font-body);
}
.tag-item-remove:hover { background: rgba(239, 68, 68, 0.18); color: #f26b6b; filter: none; }
.tag-wrap input {
  background: transparent; border: none; box-shadow: none; outline: none;
  color: var(--parchment); font-size: 13px; font-family: var(--font-body);
  width: 100%; padding: 1px 0; min-width: 80px; flex: unset;
}

.tag-dropdown {
  position: fixed; z-index: 300;
  max-height: 240px; overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: none;
}
.tag-dropdown.open { display: block; }
.suggestion-item {
  padding: 9px 14px; cursor: pointer; font-size: 13px; color: #d8bd7c;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active { background: rgba(232, 168, 42, 0.12); color: #f0d492; }
.suggestion-empty { padding: 10px 14px; font-size: 12px; color: var(--ink-muted); font-style: italic; }

/* ── Cards ── */
.zone-name, .route-card-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; color: var(--parchment);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.zone-card { transition: box-shadow 150ms; } /* faction color rides the 4px top bevel edge */
/* Brighten via box-shadow, not filter: filter forces its own compositing
   layer, and these cards share a seam with their neighbor via a
   negative-margin overlap (see .zone-card + .zone-card below) — that
   layer promotion visibly desyncs the shared border during the hover
   transition, flashing a thick double seam. box-shadow paints in the
   normal flow, so the seam stays put. */
.zone-card:hover {
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.45), inset 0 0 0 999px rgba(255, 255, 255, 0.05);
}
.zone-card-header, .route-card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.zone-badge, .hops-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 3px;
  background: var(--panel-deep);
  border: 1px solid; border-color: var(--edge-lo) #5a5570 #5a5570 var(--edge-lo);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.zone-badge.hops, .hops-badge { color: #c9a25e; }

/* Faction tint over the marble + colored top accent. Dimmed cards are
   deliberate de-emphasis (inactive content), kept legible enough to read. */
.zone-card.safe      { border-top-color: #22c55e; }
.zone-card.neutral   { border-top-color: #f59e0b; }
.zone-card.wont_sell { opacity: 0.6; border-top-color: #f97316; }
.zone-card.kos       { opacity: 0.35; border-top-color: #ef4444; }
.zone-card.safe    { background: linear-gradient(180deg, rgba(34, 197, 94, 0.07), transparent 70px), var(--marble-tex), linear-gradient(180deg, var(--stone-1), var(--stone-2)); }
.zone-card.neutral { background: linear-gradient(180deg, rgba(245, 158, 11, 0.07), transparent 70px), var(--marble-tex), linear-gradient(180deg, var(--stone-1), var(--stone-2)); }

/* Faction badges — worded like EQ /consider results (see app.js) */
.faction-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 3px;
  text-transform: uppercase; font-weight: 700; letter-spacing: 0.06em;
  cursor: help;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}
/* dark backing under the tint keeps badge text ≥4.5:1 on the light stone */
.faction-badge.safe      { background: linear-gradient(rgba(34, 197, 94, 0.16), rgba(34, 197, 94, 0.16)), rgba(10, 9, 15, 0.6);  color: #43dd81; border: 1px solid rgba(34, 197, 94, 0.4); }
.faction-badge.neutral   { background: linear-gradient(rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.16)), rgba(10, 9, 15, 0.6); color: #fbaf1e; border: 1px solid rgba(245, 158, 11, 0.4); }
.faction-badge.wont_sell { background: linear-gradient(rgba(249, 115, 22, 0.16), rgba(249, 115, 22, 0.16)), rgba(10, 9, 15, 0.6); color: #fb8534; border: 1px solid rgba(249, 115, 22, 0.4); }
.faction-badge.kos       { background: linear-gradient(rgba(239, 68, 68, 0.16), rgba(239, 68, 68, 0.16)), rgba(10, 9, 15, 0.6);  color: #ff6b6b; border: 1px solid rgba(239, 68, 68, 0.4); }

/* ── Parchment scroll insert: directions/spell text inked on a parchment
   scrap, unrolled between two wood dowels — the literal chat-scroll from
   the reference client. Shared by Route Finder's `.route-path` and Class
   Browser's `.spell-scroll` (see DECISIONS.md) — both are the same object
   (a scroll insert nested in a stone panel), so they share one rule rather
   than the dowels being a route-only ornament. ── */
.route-path, .spell-scroll {
  position: relative;
  padding: 12px 20px; border-radius: 2px;
  background: var(--parch-tex), linear-gradient(180deg, #ece3c8, var(--parch-bg));
  border: 1px solid var(--parch-line);
  /* aged edges: warm inner vignette instead of a bevel — paper, not stone */
  box-shadow: inset 0 0 22px rgba(122, 96, 42, 0.3), 0 2px 6px rgba(0, 0, 0, 0.45);
  color: var(--parch-ink);
}
.route-path::before, .route-path::after,
#spell-tooltip::before, #spell-tooltip::after,
.spell-scroll::before, .spell-scroll::after {
  content: "";
  position: absolute; top: -3px; bottom: -3px; width: 11px;
  border-radius: 5px;
  background:
    radial-gradient(3px 3px at 50% 7px, rgba(0, 0, 0, 0.6), transparent 70%),
    radial-gradient(3px 3px at 50% calc(100% - 7px), rgba(0, 0, 0, 0.6), transparent 70%),
    linear-gradient(90deg, var(--wood-2), var(--wood-1) 40%, var(--wood-1) 60%, var(--wood-2));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
}
.route-path::before, #spell-tooltip::before, .spell-scroll::before { left: -11px; }
.route-path::after,  #spell-tooltip::after,  .spell-scroll::after  { right: -11px; }
.route-label {
  display: block; font-size: 10px; color: var(--parch-ink-soft);
  letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 8px;
  text-shadow: none;
}
.route-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; line-height: 2.1; color: var(--parch-ink); }
.route-zone { color: var(--parch-ink); font-weight: 700; }
.route-sep { color: var(--parch-accent); margin: 0 6px; font-weight: 700; }
.boat-sep, .translocator-sep { cursor: help; }
.boat-sep { color: #1e40af; margin: 0 7px; font-size: 15px; }
.translocator-sep { color: #6d28d9; margin: 0 7px; font-size: 15px; }

/* ── Spell chips (planner results) ──
   Ink on parchment, not sunken stone wells — .spell-chip/.vendor-tag only
   ever render inside .spell-scroll now (see DECISIONS.md's zone-card
   scroll swap), so they follow the same tinted-background/dark-ink
   convention as Class Browser's .type-badge/.mana-badge/.class-badge
   rather than the dark "carved into stone" chip these used to be when
   the spell list sat directly on the marble panel. */
.spell-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spell-check { display: flex; align-items: center; }
.spell-check input { cursor: pointer; accent-color: var(--gold); width: 15px; height: 15px; }
.spell-owned { opacity: 0.4; }
.spell-owned .spell-chip { text-decoration: line-through; }
.spell-owned .spell-chip::before { filter: grayscale(1) brightness(0.6); }

.spell-chip {
  font-size: 13px; padding: 3px 10px 3px 7px; border-radius: 3px;
  background: rgba(122, 77, 5, 0.1);
  border: 1px solid rgba(122, 77, 5, 0.35);
  color: #5a3c14;
  white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center;
}
/* spell gem */
.spell-chip::before {
  content: ""; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #ffd97a, #c98f1f 55%, #6e4a0d);
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.55);
}
@media (pointer: coarse) { .spell-chip { cursor: pointer; } }
.spell-chip .lvl { color: var(--parch-ink-soft); margin-left: 6px; font-size: 11px; }

.vendor-names { display: flex; flex-wrap: wrap; gap: 5px; }
.vendor-tag {
  font-size: 12px; padding: 3px 8px; border-radius: 3px;
  background: rgba(30, 64, 175, 0.08); border: 1px solid rgba(30, 64, 175, 0.3); color: #1e40af;
}

/* ── Results header (planner) ── */
.results-header {
  font-size: 13px; color: var(--ink-muted);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.results-actions { display: flex; gap: 6px; margin-left: auto; }

/* EQ status bar (spells-owned progress), mana-blue (the reference client's
   own vitals bars are HP-red/mana-blue/stamina-yellow; blue is kept here as
   a deliberate "spells owned" reinterpretation — see DECISIONS.md). Modeled
   on the character vitals bars (top-right, under the name), not the group
   member list — those two look different in the reference: vitals bars are
   a chain of five distinct beads with a bright seam between each; the group
   list bars are one smooth tube. This one needs the beads. */
.mana-bar {
  position: relative;
  display: inline-block; width: 150px; height: 15px; flex-shrink: 0;
  background: #0b0a12;
  border: 2px solid; border-color: var(--edge-lo) #615b72 #615b72 var(--edge-lo);
  border-radius: 7px / 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}
.mana-fill {
  display: block; height: 100%;
  background: linear-gradient(180deg, #8fb3ff, #3054d8 40%, #14267c);
  transition: width 300ms ease-out;
}
/* glasswork overlay: end knobs, five beaded segments with bright seams,
   per-bead specular, overall glass shading */
.mana-bar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    /* end knobs (black bead + metal sliver) */
    linear-gradient(90deg, #05050a 0, #05050a 2px, #8e8ba1 2px, #8e8ba1 3px, rgba(0, 0, 0, 0) 3px),
    linear-gradient(270deg, #05050a 0, #05050a 2px, #8e8ba1 2px, #8e8ba1 3px, rgba(0, 0, 0, 0) 3px),
    /* bright ridge at each bead-to-bead seam, with a sliver of shadow on
       either side of it — not a dark pinch, a lit ridge (confirmed against
       a zoomed-in capture of the actual vitals bar) */
    linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0 1px, rgba(255, 255, 255, 0.65) 1px 2px, rgba(0, 0, 0, 0.22) 2px 3px, transparent 3px),
    /* per-bead specular streak, top-left of each */
    radial-gradient(45% 55% at 36% 22%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 60%),
    /* glass shading: lit top edge, shadowed bottom */
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0 10%, rgba(0, 0, 0, 0) 30% 55%, rgba(0, 0, 0, 0.5) 90% 100%);
  background-size:
    100% 100%, 100% 100%,
    20% 100%,
    20% 100%,
    100% 100%;
  background-repeat: no-repeat, no-repeat, repeat-x, repeat-x, no-repeat;
}

/* ── Class Browser cards: a stone console row (name on stone, like a
   zone-card) wrapping a parchment scroll insert (badges/description/
   stats/actions) — the same panel-plus-scroll composition Route Finder
   uses (.route-card + .route-path), including the wood-dowel end caps
   (see DECISIONS.md for the reasoning). */
.spell-detail {
  cursor: pointer; transition: box-shadow 150ms;
  padding: 14px 20px;
  background: var(--marble-tex), linear-gradient(180deg, var(--stone-1), var(--stone-2));
  border: 4px solid;
  border-color: var(--edge-hi) var(--edge-lo) var(--edge-lo) var(--edge-hi);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.45);
}
/* box-shadow, not filter — see the .zone-card:hover comment above; same
   negative-margin seam-sharing trick, same desync risk. */
.spell-detail:hover {
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.45), inset 0 0 0 999px rgba(255, 255, 255, 0.05);
}
.spell-detail h3 {
  font-family: var(--font-display); color: var(--parchment); font-size: 16px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.spell-level { font-size: 12px; color: var(--ink-muted); font-weight: 400; margin-left: 8px; font-family: var(--font-body); }
.spell-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.spell-header h3 { margin: 0; }
.spell-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.spell-badge { font-size: 11px; padding: 2px 7px; border-radius: 3px; }
.type-badge  { background: rgba(122, 77, 5, 0.1);   color: #6a4204; border: 1px solid rgba(122, 77, 5, 0.4); }
.mana-badge  { background: rgba(30, 64, 175, 0.08); color: #1e40af; border: 1px solid rgba(30, 64, 175, 0.35); }
.skill-badge { background: rgba(0, 0, 0, 0.05);     color: #4a4232; border: 1px solid var(--parch-line); }
.spell-desc { font-size: 13px; color: #4a4232; margin: 5px 0 6px; line-height: 1.5; font-style: italic; }
.spell-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.stat-tag {
  font-size: 11px; color: #4a4232; background: rgba(0, 0, 0, 0.05);
  border: 1px solid #b5a77e;
  padding: 2px 8px; border-radius: 3px;
}
.vendor-list { margin-top: 10px; border-top: 1px solid #b5a77e; padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.vendor-row { display: flex; gap: 8px; font-size: 13px; color: #4a4232; padding: 2px 0; }
.zone-tag { color: var(--parch-accent); }
.vendor-hint { font-size: 12px; color: var(--parch-ink-soft); margin-top: 6px; }

/* ── Spell card footer: vendor toggle + jump to the planner ── */
.spell-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.spell-card-actions .vendor-hint { margin-top: 0; }
.spell-finder-link {
  font-size: 12px; color: var(--parch-accent); text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.spell-finder-link:hover { text-decoration: underline; }

/* ── Spell tooltip: a page torn from the spellbook (parchment) ── */
#spell-tooltip {
  position: fixed; z-index: 1000;
  background: var(--parch-tex), linear-gradient(180deg, #ece3c8, var(--parch-bg));
  border: 1px solid var(--parch-line);
  border-radius: 2px; padding: 14px 18px;
  max-width: 320px; min-width: 220px;
  box-shadow: inset 0 0 22px rgba(122, 96, 42, 0.3), 0 10px 34px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  opacity: 0; transition: opacity 100ms ease-out;
}
#spell-tooltip.visible { opacity: 1; }
.tt-name { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--parch-accent); margin-bottom: 6px; }
.tt-desc { font-size: 12px; color: var(--parch-ink); font-style: italic; line-height: 1.45; margin-bottom: 8px; }
.tt-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.tt-stat {
  font-size: 11px; padding: 2px 7px; border-radius: 3px;
  background: rgba(0, 0, 0, 0.06); border: 1px solid #b5a77e; color: #4a4232;
}
.tt-stat.highlight { color: var(--parch-accent); border-color: var(--parch-accent); }

/* ── Empty / loading states ── */
.no-results { color: var(--ink-muted); font-style: italic; padding: 52px 0; text-align: center; font-size: 15px; }
/* the wait cue is the same spell gem from .spell-chip, spinning — casting,
   not a generic spinner */
.loading {
  position: relative;
  color: var(--ink-muted); padding: 90px 0 52px; text-align: center;
  letter-spacing: 0.25em; font-size: 11px; text-transform: uppercase;
}
.loading::before {
  content: "";
  position: absolute; top: 34px; left: 50%; margin-left: -7px;
  width: 14px; height: 14px; border-radius: 3px;
  background: radial-gradient(circle at 35% 30%, #ffd97a, #c98f1f 55%, #6e4a0d);
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.6), 0 0 10px rgba(232, 168, 42, 0.5);
  animation: gem-spin 1.6s linear infinite;
}
@keyframes gem-spin { to { transform: rotate(360deg); } }

/* ── Ornamental separator (controls panel) ── */
.control-sep {
  width: 100%; height: 1px; margin: 4px 0; flex-shrink: 0; position: relative;
  /* the line leaves a gap at center so the diamond needs no masking background */
  background: linear-gradient(90deg,
    transparent, var(--line-strong) 18%, var(--line-strong) 45%, transparent 47%,
    transparent 53%, var(--line-strong) 55%, var(--line-strong) 82%, transparent);
}
.control-sep::after {
  content: "◆";
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 8px; color: #9a7f3e; line-height: 1;
}

/* ── Footer ── */
footer {
  padding: 10px 28px; border-top: 1px solid #26232e; flex-shrink: 0;
  font-size: 11px; color: var(--ink-muted); text-align: center; letter-spacing: 0.04em;
}
footer a { color: var(--gold-dim); text-decoration: none; }
footer a:hover { text-decoration: underline; color: var(--gold-bright); }

/* ── Shared narrow-screen adjustments ── */
@media (max-width: 700px) {
  header { padding: 12px 16px; }
  button { min-height: 44px; }
  button.secondary { min-height: 40px; }
  .tag-item-remove { min-height: 0; }
  .tab-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
  .tab-button { flex-shrink: 0; min-height: 40px; }
}
