/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:      #0e0c0a;
  --bg-panel:     #161310;
  --bg-panel-alt: #1e1a15;
  --border:       #3a3020;
  --border-light: #4e4230;
  /* Accent — Pantone 5425 C (slate blue), matching the login & loading screens */
  --gold:         #7b96a6;
  --gold-dim:     #5e7887;
  --red:          #c0392b;
  --red-bright:   #e74c3c;
  --green:        #27ae60;
  --blue:         #2980b9;
  --purple:       #8e44ad;
  /* Cool text tones to match the login & loading palette */
  --text-primary: #e6ebef;
  --text-muted:   #93a0a8;
  --text-dim:     #5f6d76;
  --font-main:    'Cinzel', Georgia, serif;
  --font-ui:      'Inter', 'Trebuchet MS', sans-serif;
  --radius:       4px;
  --panel-pad:    12px;
  --right-w:      280px;
  --log-h:        140px;
  --topbar-h:     64px;
  --tab-bar-h:    52px;
}

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  overflow: hidden;
}

/* The whole game (and every UI screen) renders inside a 1280x720 box at most.
   Centre it in the viewport so larger windows get black letterbox/pillarbox bars
   instead of stretching the UI. */
body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── App Shell ────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 720px;
}

/* ════════════════════════════════════════════════════════════════
   TOP BAR
   ════════════════════════════════════════════════════════════════ */
#topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 2px solid var(--gold-dim);
  padding: 0 14px;
  flex-shrink: 0;
  gap: 12px;
  z-index: 10;
}

/* ── Title (centre) ───────────────────────────────────────────── */
#game-title {
  font-family: var(--font-main);
  font-size: 22px;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(200,168,75,0.4);
  text-align: center;
  white-space: nowrap;
}

/* ── Left: HP block ───────────────────────────────────────────── */
#topbar-left {
  display: flex;
  align-items: center;
}

#topbar-hp-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  max-width: 300px;
}

#topbar-hp-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#summary-name {
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-primary);
  letter-spacing: 1px;
}

#summary-hp-readout {
  font-size: 12px;
  color: var(--text-muted);
}
#summary-hp     { color: var(--green); font-weight: bold; }
#summary-hp-max { color: var(--text-dim); }

/* Large topbar HP bar */
#topbar-hp-wrap {
  width: 100%;
  height: 19px;
}

.hp-bar-wrap {
  position: relative;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.hp-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a6632, var(--green));
  transition: width 0.4s ease;
  width: 100%;
}
.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  pointer-events: none;
}

/* ── Spirit bar (Magic Spells): slim blue bar under the topbar HP bar, and a
   second instance at the top of the Magic tab. Filled by renderSpirit(). ── */
#topbar-spirit-wrap { width: 100%; height: 10px; }
.spirit-bar-wrap {
  position: relative;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.spirit-bar {
  height: 100%;
  background: linear-gradient(90deg, #1f2c66, #5a7dd8);
  transition: width 0.4s ease;
  width: 100%;
}
.spirit-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  pointer-events: none;
}

/* ── Right: Minimap ───────────────────────────────────────────── */
#topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

#minimap-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#minimap {
  --mm-size: 54px;
  width:  var(--mm-size);
  height: var(--mm-size);
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  background: #080e08;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0,0,0,0.6), inset 0 0 12px rgba(0,0,0,0.5);
}

/* ── Rotating layer ─────────────────────────────────────────── */
#minimap-rotator {
  position: absolute;
  inset: 0;
  transition: none;
}

/* Map terrain grid */
#minimap-terrain {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent, transparent 7px,
      rgba(30,55,25,0.4) 7px, rgba(30,55,25,0.4) 8px
    ),
    repeating-linear-gradient(
      90deg,
      transparent, transparent 7px,
      rgba(30,55,25,0.4) 7px, rgba(30,55,25,0.4) 8px
    );
  border-radius: 50%;
}

/* Compass rose arms */
#minimap-rose {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rose-arm {
  position: absolute;
  background: rgba(120,100,50,0.35);
}
.rose-ns  { width: 1px; height: 100%; }
.rose-ew  { width: 100%; height: 1px; }
#rose-centre {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-dim);
  position: relative;
  z-index: 2;
}

/* Compass point labels */
.compass-point {
  position: absolute;
  font-size: 8px;
  font-weight: bold;
  font-family: var(--font-main);
  color: var(--gold);
  line-height: 1;
  z-index: 3;
  pointer-events: none;
}
#cp-n { top: 3px;  left: 50%; transform: translateX(-50%); }
#cp-s { bottom: 3px; left: 50%; transform: translateX(-50%); }
#cp-e { right: 4px; top: 50%; transform: translateY(-50%); }
#cp-w { left: 4px;  top: 50%; transform: translateY(-50%); }

/* Player dot — fixed in centre, outside the rotator */
#minimap-player {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e74c3c;
  border: 1px solid #fff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  box-shadow: 0 0 4px rgba(231,76,60,0.8);
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════
   MIDDLE ROW
   ════════════════════════════════════════════════════════════════ */
#middle-row {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Game World ───────────────────────────────────────────────── */
#game-world {
  flex: 1;
  background: #000;          /* letterbox/pillarbox bars around the 16:9 canvas */
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Right-click drop-down context menu (Click Logic) */
#world-context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 150px;
  padding: 4px;
  background: rgba(14, 12, 10, 0.96);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  font-family: var(--font-ui);
}
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.ctx-item:hover { background: #2a2218; color: var(--gold); }

/* NPC conversation box (Talk / branching dialog) — lower-left of the game world.
   Absolutely positioned inside #game-world (position:relative), so it floats over
   the canvas without disturbing the letterboxed centring. */
#dialog-box {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 900;
  width: 360px;
  max-width: 72%;
  padding: 12px 14px 13px;
  background: rgba(14, 12, 10, 0.94);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
  color: var(--text-primary);
}
.dialog-name {
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 5px;
}
.dialog-speech {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 11px;
  min-height: 20px;
}
.dialog-options { display: flex; flex-direction: column; gap: 5px; }
.dialog-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 3px;
  cursor: pointer;
}
.dialog-option:hover { background: #2a2218; color: var(--gold); border-color: var(--border-light); }
.dialog-continue { color: var(--gold-dim); font-style: italic; }

/* Talking head (RS2006 style) — the speaker's model portrait on the left of the
   box. The canvas bakes at 2× and displays at 68px; the box widens and becomes a
   flex row ONLY when a portrait exists (dialog-with-face), so an NPC without a
   bakeable model keeps the classic text-only layout above. */
#dialog-box.dialog-with-face { width: 430px; display: flex; gap: 12px; }
.dialog-face { flex: 0 0 68px; }
.dialog-face canvas {
  display: block;
  width: 68px;
  height: 68px;
  background: #0a0908;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.dialog-content { flex: 1; min-width: 0; }

/* QUEST COMPLETED screen — celebratory overlay centred over the game world,
   shown by showQuestComplete() the moment a quest finishes. Closed via the ✕. */
#quest-complete {
  position: absolute;
  inset: 0;
  z-index: 950;               /* above the dialog box (900) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 5, 0.55);
}
.qc-panel {
  position: relative;
  width: 380px;
  max-width: 84%;
  padding: 26px 30px 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at top, rgba(123, 150, 166, 0.10), transparent 55%),
    rgba(14, 12, 10, 0.97);
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.75), inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.qc-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.qc-close:hover { color: var(--red-bright); border-color: var(--red); }
.qc-scroll { font-size: 34px; margin-bottom: 6px; }
.qc-heading {
  font-family: var(--font-main);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.qc-name {
  font-family: var(--font-main);
  font-size: 16px;
  color: var(--text-primary);
  margin-top: 3px;
}
.qc-divider {
  height: 1px;
  margin: 14px 10px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.qc-rewards-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
}
.qc-rewards {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qc-rewards li {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}
.qc-rewards li::before { content: '✦ '; color: var(--gold); }

/* Floating icon shown while dragging an inventory / chest item to another slot.
   z-index sits ABOVE the storage panel (1050) so the carried item stays visible
   while dragging within it, and below the context menu (1100). */
.inv-drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 22px;
  pointer-events: none;
  z-index: 1060;
  opacity: 0.85;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}
/* The slot a drag started from (inventory .inv-slot or chest .shop-slot). */
.inv-drag-source { opacity: 0.4; }

/* Item armed for use-on-target (Metalworking: use ore/ingot on smelter/anvil) */
.inv-slot.inv-use-selected {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  box-shadow: 0 0 8px rgba(230, 190, 90, 0.55) inset;
}

/* ── Forge panel (anvil smithing options / smelter ingot chooser) ─────────── */
#forge-panel {
  position: fixed;
  z-index: 1050;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 12, 10, 0.97);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
}
.forge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.forge-title { color: var(--gold); font-size: 14px; font-weight: bold; }
.forge-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}
.forge-close:hover { color: var(--gold); }
.forge-list { overflow-y: auto; padding: 6px; }
.forge-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.forge-entry:hover { background: #2a2218; color: var(--gold); }
.forge-entry.disabled { opacity: 0.4; cursor: default; }
.forge-entry.disabled:hover { background: none; color: var(--text-primary); }
.forge-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.forge-name { flex-shrink: 0; min-width: 150px; }
.forge-req  { margin-left: auto; color: var(--text-dim); font-size: 11px; }

/* ── Shop (trade) panel ─────────────────────────────────────────── */
#shop-panel {
  position: fixed;
  z-index: 1050;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-width: 94vw;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 12, 10, 0.97);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
}
.shop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.shop-title  { color: var(--gold); font-size: 15px; font-weight: bold; }
.shop-keeper { color: var(--text-dim); font-size: 12px; font-style: italic; }
.shop-coins  { margin-left: auto; color: var(--gold); font-size: 13px; font-weight: bold; }
.shop-close {
  background: none; border: none; color: var(--text-dim);
  font: inherit; font-size: 14px; cursor: pointer; padding: 2px 6px;
}
.shop-close:hover { color: var(--gold); }
.shop-cols { display: flex; gap: 8px; padding: 8px; overflow: hidden; }
.shop-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.shop-col-head {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.4px; padding: 2px 4px 6px;
}
.shop-list { overflow-y: auto; max-height: 58vh; display: flex; flex-direction: column; gap: 2px; }
.shop-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; background: none; border: none; color: var(--text-primary);
  font: inherit; font-size: 12px; padding: 5px 8px; border-radius: 3px;
  cursor: pointer; white-space: nowrap;
}
.shop-row:hover { background: #2a2218; color: var(--gold); }
.shop-row.out { opacity: 0.4; cursor: default; }
.shop-row.out:hover { background: none; color: var(--text-primary); }
.shop-ico   { width: 24px; text-align: center; flex-shrink: 0; font-size: 16px; }
.shop-ico .item-icon-img { width: 22px; height: 22px; margin: 0 auto; }
.shop-name  { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.shop-stock { color: var(--text-dim); font-size: 11px; min-width: 34px; text-align: right; }
.shop-price { color: var(--gold); font-size: 11px; min-width: 46px; text-align: right; }
.shop-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  overflow-y: auto; max-height: 58vh; align-content: start;
}
.shop-slot {
  aspect-ratio: 1; background: var(--bg-panel-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  position: relative; font-size: 16px;
}
.shop-slot.has-item { border-color: var(--gold-dim); cursor: pointer; }
.shop-slot.has-item:hover { border-color: var(--gold); background: #2a2218; }
.shop-slot.unsellable { opacity: 0.45; cursor: default; }
.shop-slot.unsellable:hover { border-color: var(--gold-dim); background: var(--bg-panel-alt); }
.shop-slot-ico .item-icon-img { width: 26px; height: 26px; }
.shop-slot-qty {
  position: absolute; bottom: 2px; right: 3px; font-size: 9px;
  font-weight: bold; color: var(--gold); line-height: 1; pointer-events: none;
}

/* ── Storage chest (bank) panel — reuses the shop head/col/slot styles ── */
#bank-panel {
  position: fixed;
  z-index: 1050;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-width: 94vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 12, 10, 0.97);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
}
.bank-count { color: var(--text-dim); font-size: 12px; }
.bank-btns { display: flex; gap: 6px; padding: 8px 8px 0; }
.bank-btn {
  flex: 1 1 0;
  background: var(--bg-panel-alt); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); color: var(--text-primary);
  font: inherit; font-size: 12px; padding: 6px 8px; cursor: pointer;
}
.bank-btn:hover { border-color: var(--gold); color: var(--gold); background: #2a2218; }
.bank-chest { flex: 1.4 1 0; }
/* Chest slots match the inventory sidebar exactly (47px, 5px gap, 28px icons);
   all 300 slots render, overflowing rows scroll (.shop-grid overflow-y). */
.bank-grid {
  grid-template-columns: repeat(auto-fill, 47px);
  grid-auto-rows: 47px;
  gap: 5px;
  justify-content: center;
}
.bank-grid .shop-slot { font-size: 18px; }
.bank-grid .shop-slot-ico .item-icon-img { width: 28px; height: 28px; }

/* Store X / Withdraw X quantity prompt */
#bank-x-prompt {
  position: fixed; z-index: 1200; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  width: 240px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(14, 12, 10, 0.98);
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
}
.bank-x-title { color: var(--text-primary); font-size: 12px; }
.bank-x-input {
  background: var(--bg-panel-alt); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text-primary); font: inherit;
  font-size: 13px; padding: 5px 7px; outline: none;
}
.bank-x-input:focus { border-color: var(--gold); }
.bank-x-btns { display: flex; gap: 6px; justify-content: flex-end; }
.bank-x-btns button {
  background: var(--bg-panel-alt); border: 1px solid var(--gold-dim);
  border-radius: 3px; color: var(--text-primary); font: inherit;
  font-size: 12px; padding: 4px 12px; cursor: pointer;
}
.bank-x-btns button:hover { border-color: var(--gold); color: var(--gold); }

/* ════════════════════════════════════════════════════════════════
   RIGHT PANEL
   ════════════════════════════════════════════════════════════════ */
#right-panel {
  width: var(--right-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Tab Bar ──────────────────────────────────────────────────── */
#tab-bar {
  display: flex;
  flex-shrink: 0;
  height: var(--tab-bar-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 2px;
  transition: background 0.15s, color 0.15s;
  font-family: var(--font-ui);
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: var(--bg-panel-alt); color: var(--text-muted); }
.tab-btn.active {
  background: var(--bg-panel);
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
  margin-bottom: -1px;
}
.tab-icon  { font-size: 15px; line-height: 1; }
.tab-label { font-size: 8px; letter-spacing: 1px; text-transform: uppercase; }

/* ── Tab Content ──────────────────────────────────────────────── */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  flex-direction: column;
}
.tab-content.active { display: flex; }

.panel-section {
  padding: var(--panel-pad);
}

.panel-title {
  font-family: var(--font-main);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

/* ════════════════════════════════════════════════════════════════
   SKILLS
   ════════════════════════════════════════════════════════════════ */
.skill-group-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 10px 0 4px;
}
.skill-group-label:first-of-type { margin-top: 0; }

/* Overall Combat Level line under the Combat skill group */
#combat-level-line {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 6px 0 2px;
}
#combat-level-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Combat style toggle (Equipped tab) ───────────────────────── */
#combat-style { display: flex; gap: 6px; }
.style-btn {
  flex: 1;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 7px 4px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.style-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.style-btn.active {
  background: #2a2218;
  border-color: var(--gold-dim);
  color: var(--gold);
}
#combat-style-note {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 5px;
  text-align: center;
}

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

.skill-row {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  transition: border-color 0.2s;
}
.skill-row:hover { border-color: var(--border-light); }

.skill-header {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.skill-icon  { font-size: 12px; margin-right: 6px; display: inline-flex; align-items: center; }
.skill-glyph { display: block; width: 20px; height: 20px; }
.skill-name  { flex: 1; font-size: 12px; color: var(--text-primary); }
.skill-level { font-size: 13px; font-weight: bold; color: var(--gold); min-width: 20px; text-align: right; }
.skill-max   { font-size: 10px; font-weight: normal; opacity: 0.5; letter-spacing: 0; }

.xp-bar-wrap { height: 4px; background: var(--bg-deep); border-radius: 2px; overflow: hidden; }
.xp-bar      { height: 100%; border-radius: 2px; transition: width 0.5s ease; width: 0%; }
.xp-label    { font-size: 10px; color: var(--text-dim); margin-top: 3px; text-align: right; }

.skill-melee     .xp-bar { background: var(--red-bright); }
.skill-archery   .xp-bar { background: #e67e22; }
.skill-magic     .xp-bar { background: var(--purple); }
.skill-fortitude .xp-bar { background: var(--green); }
.skill-agriculture .xp-bar { background: #16a085; }
.skill-forestry  .xp-bar { background: #2ecc71; }
.skill-mining    .xp-bar { background: #95a5a6; }
.skill-cookery   .xp-bar { background: #d35400; }
.skill-fletching .xp-bar { background: #f39c12; }
.skill-metalworking .xp-bar { background: #e74c3c; }

/* ════════════════════════════════════════════════════════════════
   EQUIPPED
   ════════════════════════════════════════════════════════════════ */
/* Classic 3×5 worn-equipment grid, centred (no silhouette). */
#equipped-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-auto-rows: 52px;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 12px;
}

/* Perfect-square, reduced-size slots holding just the icon */
.equip-slot {
  width: 52px;
  height: 52px;
  box-sizing: border-box;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

/* Grid cells (column / row):
   r1:  ·      Head    ·
   r2:  Cape   Necklace Ammo
   r3:  Weapon Torso   Shield
   r4:  ·      Legs    ·
   r5:  Arms   Boots   Ring */
.slot-helm       { grid-column: 2; grid-row: 1; }
.slot-cape       { grid-column: 1; grid-row: 2; }
.slot-necklace   { grid-column: 2; grid-row: 2; }
.slot-ammunition { grid-column: 3; grid-row: 2; }
.slot-weapon     { grid-column: 1; grid-row: 3; }
.slot-torso      { grid-column: 2; grid-row: 3; }
.slot-shield     { grid-column: 3; grid-row: 3; }
.slot-legs       { grid-column: 2; grid-row: 4; }
.slot-arm        { grid-column: 1; grid-row: 5; }
.slot-boots      { grid-column: 2; grid-row: 5; }
.slot-ring       { grid-column: 3; grid-row: 5; }

.equip-slot:hover {
  border-color: var(--border-light);
  background: #242018;
}
.equip-slot.has-item { border-color: var(--gold-dim); cursor: pointer; }
.equip-slot.has-item:hover { border-color: var(--gold); background: #2a2218; }

.equip-icon {
  font-size: 20px;
  line-height: 1;
  opacity: 0.4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.equip-slot.has-item .equip-icon { opacity: 1; }
/* RS2006-style placeholder art drawn as inline SVG */
.equip-icon .slot-svg { width: 32px; height: 32px; display: block; }

/* Equipment bonuses — three columns (Attack / Defence / Strength) */
#equip-bonuses {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 12px;
}
.bonus-col {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px 8px;
}
.bonus-head {
  font-size: 10px;
  font-weight: bold;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.bonus-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}
.bonus-row span:last-child { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════════
   INVENTORY
   ════════════════════════════════════════════════════════════════ */
#inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.inv-slot {
  aspect-ratio: 1;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  font-size: 18px;
}
.inv-slot:hover {
  border-color: var(--border-light);
  background: #242018;
}
.inv-slot.has-item { border-color: var(--gold-dim); cursor: pointer; }
.inv-slot.has-item:hover { border-color: var(--gold); background: #2a2218; }

.inv-slot-index {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 8px;
  color: var(--text-dim);
  line-height: 1;
}
.inv-qty {
  position: absolute;
  bottom: 13px;
  right: 3px;
  font-size: 9px;
  font-weight: bold;
  color: var(--gold);
  line-height: 1;
  pointer-events: none;
}

/* Drawn 2D item icons (armour_icons.js) — pixelated like the 32×32 source */
.item-icon-img {
  display: block;
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  pointer-events: none;
}
.equip-icon .item-icon-img { width: 24px; height: 24px; margin: 0 auto; }
.forge-icon .item-icon-img { width: 22px; height: 22px; margin: 0 auto; }

/* ════════════════════════════════════════════════════════════════
   MAGIC PANEL (Magic Spells design)
   ════════════════════════════════════════════════════════════════ */
#magic-spirit-block { margin-bottom: 4px; }
#magic-spirit-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
#magic-spirit-readout { color: #7d9de0; font-weight: bold; letter-spacing: 0; font-size: 11px; }
#magic-spirit-wrap { height: 8px; }

#magic-spells { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.spell-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  padding: 6px 8px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.spell-row:hover { border-color: var(--border-light); color: var(--text-primary); }
.spell-row.spell-selected {
  background: #221a2e;
  border-color: var(--purple);
  color: var(--text-primary);
}
.spell-row.spell-locked { opacity: 0.45; cursor: not-allowed; }
.spell-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.spell-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.spell-name { font-size: 12px; color: var(--text-primary); }
.spell-meta { font-size: 10px; color: var(--text-dim); }
.spell-state { font-size: 9px; color: var(--purple); text-align: right; flex-shrink: 0; }
.spell-row.spell-locked .spell-state { color: var(--text-dim); }

/* ════════════════════════════════════════════════════════════════
   QUESTS & MAGIC PLACEHOLDERS
   ════════════════════════════════════════════════════════════════ */
.placeholder-section { display: flex; flex-direction: column; gap: 10px; }

.placeholder-category {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.placeholder-category-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  background: var(--bg-deep);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.placeholder-item { padding: 8px; font-size: 12px; }
.placeholder-item.muted { color: var(--text-dim); font-style: italic; }

/* ════════════════════════════════════════════════════════════════
   QUEST LOG (Quests tab — see renderQuestLog in game.js)
   ════════════════════════════════════════════════════════════════ */
#quest-log { display: flex; flex-direction: column; gap: 10px; }

/* Running Renown total earned from completed quests */
.quest-renown {
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--gold-dim);
  padding: 6px 8px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.quest-renown span { color: var(--gold); font-weight: 600; }

/* List view: one box per state category, mirroring the placeholder styling */
.quest-category {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.quest-category-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  background: var(--bg-deep);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.quest-empty { padding: 8px; font-size: 12px; color: var(--text-dim); font-style: italic; }

/* A quest row — classic quest-list colours: gold in progress, red not yet
   started, green completed. */
.quest-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  font: inherit;
  font-size: 12px;
  padding: 7px 8px;
  cursor: pointer;
}
.quest-row:last-child { border-bottom: none; }
.quest-row:hover { background: #2a2218; }
.quest-row.quest-progress { color: var(--gold); }
.quest-row.quest-open     { color: var(--red-bright); }
.quest-row.quest-done     { color: var(--green); }

/* Journal view */
.quest-back {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}
.quest-back:hover { color: var(--gold); border-color: var(--border-light); }
.quest-journal-title {
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
}
.quest-journal-meta {
  font-size: 11px;
  color: var(--text-dim);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.quest-journal-body { display: flex; flex-direction: column; gap: 6px; }
.quest-step { font-size: 12px; line-height: 1.4; }
.quest-step-done    { color: var(--text-dim); text-decoration: line-through; }
.quest-step-current { color: var(--text-primary); }
.quest-journal-complete {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  padding-top: 4px;
}
.quest-journal-rewards { display: flex; flex-direction: column; gap: 4px; }
.quest-journal-rewards .quest-step-done { text-decoration: none; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════
   SETTINGS
   ════════════════════════════════════════════════════════════════ */
.settings-group { margin-bottom: 18px; }
.settings-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--bg-deep);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--bg-panel);
}
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--bg-panel);
}
.volume-value {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

.settings-btn {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.settings-btn:hover  { border-color: var(--border-light); background: #28221a; }
.settings-btn.muted  { color: var(--text-dim); border-color: var(--text-dim); }

.zoom-row { justify-content: center; gap: 16px; }
.zoom-btn  { width: 32px; height: 32px; padding: 0; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.zoom-level { font-size: 13px; color: var(--text-primary); min-width: 40px; text-align: center; }

/* ════════════════════════════════════════════════════════════════
   ACTIVITY LOG (bottom bar)
   ════════════════════════════════════════════════════════════════ */
#log-bar {
  flex-shrink: 0;
  height: var(--log-h);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#log-header {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#log-title {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
}

#log-entries {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 6px 8px;
  white-space: nowrap;
  gap: 0;
}

.log-entry {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 3px 10px 3px 8px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  line-height: 1.4;
  flex-shrink: 0;
  margin-right: 4px;
  white-space: normal;
  max-width: 260px;
  vertical-align: middle;
}
.log-system  { border-color: var(--gold-dim);  color: var(--gold-dim); }
.log-quest   { border-color: var(--gold);      color: var(--gold); }
.log-combat  { border-color: var(--red);        color: #e8a090; }
.log-xp      { border-color: var(--blue);       color: #90b8e8; }
.log-harvest { border-color: var(--green);      color: #90e8a8; }

/* ── Log/Chat source filter ───────────────────────────────────── */
#log-filter {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.log-filter-btn {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.log-filter-btn:hover  { border-color: var(--border-light); color: var(--text-primary); }
.log-filter-btn.active { border-color: var(--gold-dim); color: var(--gold-dim); }

/* Hide the source the filter excludes ('both' hides nothing). */
#log-bar.filter-activity .log-entry.src-chat     { display: none; }
#log-bar.filter-chat     .log-entry.src-activity { display: none; }

/* ── Chat entries & input row ─────────────────────────────────── */
.log-chat        { border-color: var(--gold); color: var(--text-primary); }
.log-chat-system { border-color: var(--gold-dim); color: var(--gold-dim); font-style: italic; }
.chat-name       { color: var(--gold); margin-right: 4px; }

#chat-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-top: 1px solid var(--border);
}
#chat-prompt {
  color: var(--gold-dim);
  font-size: 13px;
}
#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 3px 0;
}
#chat-input::placeholder { color: var(--text-dim); }

/* ── In-world minimap overlay ─────────────────────────────────── */
#world-minimap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  pointer-events: none;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
#minimap-canvas {
  display: block;
  pointer-events: auto;   /* clickable for click-to-walk, despite the overlay wrapper */
  cursor: pointer;
}

/* ── Level label HUD ──────────────────────────────────────────── */
#level-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--font-main);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(14,12,10,0.72);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 4px 10px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
.level-label-animate {
  animation: levelFade 3s ease forwards;
}
@keyframes levelFade {
  0%   { opacity: 0; transform: translateY(-4px); }
  12%  { opacity: 1; transform: translateY(0);    }
  70%  { opacity: 1;                               }
  100% { opacity: 0;                               }
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ════════════════════════════════════════════════════════════════
   CHARACTER CREATION SCREEN
   ════════════════════════════════════════════════════════════════ */
.cc-overlay {
  position: fixed;
  inset: 0;
  margin: auto;                 /* centre the capped box in the viewport */
  width: 100%;
  height: 100%;
  max-width: 1280px;            /* same 1280x720 cap as the main app */
  max-height: 720px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(40, 33, 22, 0.55), transparent 70%),
    var(--bg-deep);
}
.cc-overlay.cc-hidden { display: none; }

/* ── World loading screen (reuses .cc-overlay / .cc-panel chrome) ───────────── */
.wl-panel {
  max-width: 460px;
  text-align: center;
}
.wl-subtitle {
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin: 0 0 20px;
}
.wl-bar-track {
  width: 100%;
  height: 14px;
  background: #14110d;
  border: 1px solid var(--gold-dim);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.7);
}
.wl-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 7px 0 0 7px;
  transition: width 120ms linear;   /* eases the per-batch step into a smooth fill */
}
.wl-pct {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-top: 10px;
  letter-spacing: 1px;
}

/* ── Loading-screen colour scheme: Pantone 5425 C (blue) on black ────────────
   Scoped to #world-loading so the shared .cc-* chrome (character creation and
   the rest of the game UI) keeps its gold theme. */
#world-loading.cc-overlay {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(123, 150, 166, 0.16), transparent 70%),
    #000;
}
#world-loading .cc-panel {
  background: linear-gradient(180deg, #0b1015, #05070a);
  border-color: #5e7887;
}
#world-loading .cc-title { color: #7b96a6; }
#world-loading .wl-subtitle { color: #6b7d88; }
#world-loading .wl-bar-track {
  background: #05070a;
  border-color: #5e7887;
}
#world-loading .wl-bar-fill {
  background: linear-gradient(90deg, #5e7887, #7b96a6);
}
#world-loading .wl-pct { color: #7b96a6; }

.cc-panel {
  width: 100%;
  max-width: 720px;
  max-height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-panel-alt), var(--bg-panel));
  border: 2px solid var(--gold-dim);
  border-radius: 8px;
  box-shadow: 0 0 0 1px #000, 0 14px 50px rgba(0, 0, 0, 0.7);
  padding: 22px 26px 26px;
}

.cc-title {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px #000;
  margin-bottom: 18px;
}

.cc-body {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.cc-preview-wrap {
  position: relative;
  flex: 0 0 240px;
  background:
    radial-gradient(ellipse at 50% 95%, rgba(0, 0, 0, 0.5), transparent 60%),
    linear-gradient(180deg, #221d16, #14110d);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  touch-action: none;
}
#cc-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#cc-canvas:active { cursor: grabbing; }
.cc-rotate-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
  letter-spacing: 0.5px;
}

.cc-options {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.cc-field { display: flex; flex-direction: column; gap: 5px; }
.cc-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
#cc-name {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
}
#cc-name:focus { outline: none; border-color: var(--gold); }
/* Account created with a character name only → the name is fixed (auth_session.js
   sets readOnly); render it as a non-editable value, no gold focus ring. */
#cc-name:read-only { color: var(--text-muted); cursor: default; }
#cc-name:read-only:focus { border-color: var(--border-light); }
.cc-note { font-size: 11px; color: var(--text-dim); min-height: 14px; }
.cc-note.cc-error { color: var(--red-bright); }

.cc-choices { display: flex; gap: 8px; }
.cc-choice {
  flex: 1 1 0;
  padding: 9px 11px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cc-choice:hover { border-color: var(--gold); }
.cc-choice.active {
  color: #1a1610;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  border-color: var(--gold);
}

.cc-selector { display: flex; flex-direction: column; gap: 5px; }
.cc-arrows {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 5px 8px;
}
.cc-arrow {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  color: var(--gold);
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cc-arrow:hover { background: var(--gold-dim); color: #1a1610; }
.cc-arrow:active { transform: translateY(1px); }
.cc-value {
  flex: 1 1 auto;
  text-align: center;
  font-size: 14px;
  color: var(--text-primary);
}
.cc-swatch {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.5);
}

.cc-accept {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1a1610;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: filter 0.12s;
}
.cc-accept:hover { filter: brightness(1.1); }
.cc-accept:active { transform: translateY(1px); }
.cc-accept:disabled {
  filter: grayscale(0.7) brightness(0.6);
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .cc-body { flex-direction: column; align-items: center; }
  .cc-preview-wrap { flex-basis: 220px; width: 220px; }
  .cc-options { width: 100%; }
}

/* ════════════════════════════════════════════════════════════════
   LEVEL UP SCROLL  (game.js _showNextLevelUp)
   A parchment scroll that unfurls mid-screen on a skill level-up.
   Absolutely positioned inside #game-world (position:relative). The
   LAYER ignores pointer events so the game keeps receiving clicks;
   only the scroll (and its ✕) become interactive while open.
   ════════════════════════════════════════════════════════════════ */
#levelup-layer {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lu-scroll {
  --lu-parch:   #e8d5a6;
  --lu-band:    #5b3a1c;
  --lu-ink:     #3a2a14;
  --lu-ink-soft:#5c4522;
  --lu-gold:    #b8892f;
  --lu-gold-hi: #e0b45a;
  --lu-wax:     #8a2f22;
  --lu-wax-hi:  #b8503f;
  position: relative;
  width: 388px;
  max-width: 82%;
  pointer-events: none;                 /* becomes auto only when .lu-open */
  filter: drop-shadow(0 20px 32px rgba(0, 0, 0, 0.62));
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.18, 0.9, 0.28, 1.2);
}
#levelup-layer.lu-open .lu-scroll { opacity: 1; transform: none; pointer-events: auto; }

.lu-dowel {
  position: relative;
  height: 20px;
  margin: 0 6px;
  border-radius: 10px;
  background: linear-gradient(#8a5a2b, #5e3a18 46%, #4a2c11 54%, #7a4d24);
  box-shadow: inset 0 2px 2px rgba(255, 220, 160, 0.35),
              inset 0 -3px 5px rgba(0, 0, 0, 0.5),
              0 1px 2px rgba(0, 0, 0, 0.5);
}
.lu-dowel::before, .lu-dowel::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 15px;
  border-radius: 8px;
  background: radial-gradient(circle at 40% 35%, #a06a34, #3c2410);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.6);
}
.lu-dowel::before { left: -8px; }
.lu-dowel::after  { right: -8px; }
.lu-top    { margin-bottom: -2px; }
.lu-bottom { margin-top: -2px; }

.lu-parch {
  position: relative;
  padding: 24px 32px 28px;
  background:
    radial-gradient(130% 120% at 50% 0%, rgba(255, 246, 214, 0.55), transparent 42%),
    radial-gradient(100% 100% at 15% 90%, rgba(150, 110, 50, 0.22), transparent 55%),
    radial-gradient(100% 100% at 88% 20%, rgba(150, 110, 50, 0.20), transparent 50%),
    linear-gradient(var(--lu-parch), #e2cd98);
  border-left:  2px solid rgba(120, 90, 40, 0.35);
  border-right: 2px solid rgba(120, 90, 40, 0.35);
  box-shadow: inset 0 0 44px rgba(150, 110, 50, 0.28), inset 0 0 3px rgba(90, 60, 20, 0.4);
}
.lu-parch::before, .lu-parch::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 15px;
  pointer-events: none;
}
.lu-parch::before { top: 0;    background: linear-gradient(rgba(90, 62, 24, 0.42), transparent); }
.lu-parch::after  { bottom: 0; background: linear-gradient(transparent, rgba(90, 62, 24, 0.42)); }

.lu-eyebrow {
  text-align: center;
  font-family: var(--font-main);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--lu-band);
  font-weight: 700;
  margin: 0 0 2px;
  padding-left: 0.4em;
}
.lu-banner {
  text-align: center;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  color: var(--lu-band);
  text-shadow: 0 1px 0 rgba(255, 244, 210, 0.6);
  margin: 0;
}
.lu-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 14px;
}
.lu-flourish .lu-ln {
  height: 1px;
  width: 66px;
  background: linear-gradient(90deg, transparent, var(--lu-gold));
}
.lu-flourish .lu-ln.lu-r { background: linear-gradient(90deg, var(--lu-gold), transparent); }
.lu-flourish .lu-dot {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  background: var(--lu-gold);
  box-shadow: 0 0 0 3px rgba(184, 137, 47, 0.22);
}

.lu-emblem {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: radial-gradient(circle at 42% 34%, #f6e8bf, #d9bd7f 70%, #c2a165);
  border: 2px solid var(--lu-gold);
  box-shadow: 0 0 0 4px rgba(184, 137, 47, 0.18),
              inset 0 2px 6px rgba(255, 255, 255, 0.5),
              inset 0 -4px 8px rgba(120, 90, 40, 0.35);
}
/* Rendered skill glyph (SkillIcons SVG) sits inside the parchment medallion. */
.lu-emblem--icon > svg { width: 46px; height: 46px; display: block; filter: drop-shadow(0 1px 1px rgba(90, 60, 20, 0.35)); }

/* Unlock-line icon: the item's pixel-art inventory sprite (ArmourIcons PNG). */
.lu-ic-img {
  width: 28px;
  height: 28px;
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 rgba(255, 246, 214, 0.5));
}

.lu-congrats {
  text-align: center;
  font-family: var(--font-main);
  font-size: 18px;
  line-height: 1.42;
  color: var(--lu-ink);
  font-weight: 600;
  margin: 0 auto;
  max-width: 30ch;
}
.lu-congrats .lu-lv { color: var(--lu-wax);  font-weight: 700; }
.lu-congrats .lu-sk { color: var(--lu-band); font-weight: 700; }

.lu-unlocks { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lu-unlock {
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: center;
  margin: 0 auto;
  max-width: 34ch;
  padding: 10px 14px;
  border-radius: 6px;
  background: linear-gradient(rgba(184, 137, 47, 0.16), rgba(184, 137, 47, 0.08));
  border: 1px solid rgba(184, 137, 47, 0.5);
}
.lu-unlock .lu-ic {
  font-size: 21px;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 0 rgba(255, 246, 214, 0.5));
}
.lu-unlock .lu-tx {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
  color: var(--lu-ink-soft);
  text-align: left;
}
.lu-unlock .lu-tx b { color: var(--lu-band); font-weight: 700; }

.lu-more {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: rgba(91, 58, 28, 0.7);
  margin: 14px 0 0;
}

.lu-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  border: 0;
  cursor: pointer;
  border-radius: 50%;
  color: #f2d9c8;
  font-family: var(--font-main);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  background: radial-gradient(circle at 38% 32%, var(--lu-wax-hi), var(--lu-wax) 62%, #6d2318);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5),
              inset 0 2px 4px rgba(255, 180, 160, 0.4),
              inset 0 -3px 6px rgba(0, 0, 0, 0.45),
              0 0 0 3px rgba(90, 32, 22, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.lu-close:hover  { transform: scale(1.07); filter: brightness(1.08); }
.lu-close:active { transform: scale(0.96); }
.lu-close:focus-visible { outline: 2px solid var(--lu-gold-hi); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .lu-scroll { transition: opacity 0.2s ease; }
  .lu-scroll, #levelup-layer.lu-open .lu-scroll { transform: none; }
}
