* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hidden { display: none !important; }

body {
  background: #000;
  overflow: hidden;
  font-family: monospace;
  color: #aaffaa;
}

canvas {
  display: block;
}

body.pointer-locked {
  cursor: none;
}

/* HUD overlay — sits on top of the canvas */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
}

#hud-floor {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 16px;
  text-shadow: 0 0 6px #00ff00;
}

#hud-level {
  position: absolute;
  top: 36px;
  left: 16px;
  font-size: 14px;
  color: #cc88ff;
  text-shadow: 0 0 6px #9933cc;
}

#hud-seed {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 16px;
  text-shadow: 0 0 6px #00ff00;
}

#hud-prompt {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 16px;
  border: 1px solid #aaffaa;
  display: none;
  pointer-events: none;
  white-space: nowrap;
}

/* Controls hint — top-center */
#hud-controls {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #557755;
  pointer-events: none;
  white-space: nowrap;
}

/* HP / MP bars — bottom-left */
#hud-bars {
  position: absolute;
  bottom: 20px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-label {
  font-size: 11px;
  color: #aaffaa;
  width: 16px;
  text-align: right;
}

.bar-bg {
  width: 130px;
  height: 10px;
  background: #1a1a1a;
  border: 1px solid #446644;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.25s ease;
}

.hp-fill { background: #cc2200; }
.mp-fill { background: #2244cc; }
.xp-fill { background: #9933cc; }

.bar-text {
  font-size: 10px;
  color: #888888;
  min-width: 52px;
}

.gold-text {
  color: #ffcc00;
  font-size: 11px;
  min-width: auto;
}

/* ── Bottom bar: off-hand | hotbar | main-hand ──────────────────────────── */
#hud-bottom-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

#hud-hotbar {
  display: flex;
  gap: 5px;
}

/* ── Hand slots ─────────────────────────────────────────────────────────── */
.hud-hand-slot {
  width: 60px;
  height: 68px;
  border: 1px solid #553322;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 3px;
}

.hud-hand-slot img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.hand-slot-label {
  font-size: 8px;
  color: #775544;
  letter-spacing: 1px;
}

.hand-slot-name {
  font-size: 7px;
  color: #aaaaaa;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  padding: 0 2px;
}

.hud-hand-slot.hand-active {
  border-color: #bb7733;
  box-shadow: 0 0 6px rgba(190,120,50,0.35);
}

/* ── Full-screen hit effect overlay ────────────────────────────────────────── */
#hit-effect {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

/* Blood splatter — red radial vignette that pulses in from the edges */
@keyframes hit-blood {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  100% { opacity: 0; }
}
.hit-effect-attack {
  animation: hit-blood 0.55s ease-out forwards;
  background: radial-gradient(ellipse at center,
    transparent 35%,
    rgba(160, 0, 0, 0.30) 65%,
    rgba(200, 0, 0, 0.65) 100%);
}

/* Arcane blast — blue/violet radial flash from the centre */
@keyframes hit-arcane {
  0%   { opacity: 0;    transform: scale(0.85); }
  15%  { opacity: 1;    transform: scale(1.02); }
  60%  { opacity: 0.45; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1); }
}
.hit-effect-cast {
  animation: hit-arcane 0.55s ease-out forwards;
  background: radial-gradient(ellipse at center,
    rgba(140, 80, 255, 0.55) 0%,
    rgba(80, 40, 200, 0.35) 45%,
    transparent 75%);
}

/* Strike flash — main hand attack (warm orange lunge forward) */
@keyframes hand-strike {
  0%   { transform: translateY(0)   scale(1);    box-shadow: 0 0 6px rgba(190,120,50,0.35); }
  25%  { transform: translateY(-8px) scale(1.08); box-shadow: 0 0 18px rgba(255,180,60,0.9); border-color: #ffcc44; }
  55%  { transform: translateY(-4px) scale(1.04); box-shadow: 0 0 10px rgba(255,180,60,0.5); }
  100% { transform: translateY(0)   scale(1);    box-shadow: 0 0 6px rgba(190,120,50,0.35); }
}
.hud-hand-slot.anim-strike {
  animation: hand-strike 0.35s ease-out forwards;
}

/* Cast flash — spell cast (cool blue/purple pulse) */
@keyframes hand-cast {
  0%   { transform: scale(1);    box-shadow: 0 0 6px rgba(190,120,50,0.35); border-color: #bb7733; }
  30%  { transform: scale(1.10); box-shadow: 0 0 22px rgba(120,100,255,0.95); border-color: #9988ff; }
  65%  { transform: scale(1.05); box-shadow: 0 0 12px rgba(120,100,255,0.5);  border-color: #7766cc; }
  100% { transform: scale(1);    box-shadow: 0 0 6px rgba(190,120,50,0.35);  border-color: #bb7733; }
}
.hud-hand-slot.anim-cast {
  animation: hand-cast 0.4s ease-out forwards;
}

.hotbar-slot {
  width: 52px;
  height: 52px;
  border: 1px solid #335533;
  background: rgba(0, 0, 0, 0.70);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 10px;
  color: #557755;
}

.hotbar-slot img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.hk-label {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  color: #556655;
  pointer-events: none;
}

.hk-qty {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  color: #ffcc44;
  pointer-events: none;
}

.hk-equipped {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  color: #aaffaa;
  pointer-events: none;
}

.hotbar-slot.hk-active {
  border-color: #aaffaa;
  box-shadow: 0 0 4px rgba(170,255,170,0.3);
}

.hotbar-slot.hk-selected {
  border-color: #ffcc44;
  box-shadow: 0 0 10px rgba(255,204,68,0.5), inset 0 0 8px rgba(255,204,68,0.15);
}

.hotbar-slot.hk-selected .hk-label {
  color: #ffdd77;
}

/* ── Save / Load toast ────────────────────────────────────────────────────── */
#save-toast {
  display: none;
  position: fixed;
  bottom: 82px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #aaffaa;
  font-size: 13px;
  padding: 6px 20px;
  border: 1px solid #446644;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

/* Inspect panel — centered popup */
#hud-inspect {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid #446644;
  padding: 22px 30px;
  min-width: 320px;
  max-width: 460px;
  pointer-events: none;
  z-index: 5;
}

#inspect-name {
  font-size: 18px;
  color: #aaffaa;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

#inspect-stats {
  font-size: 13px;
  color: #ffcc66;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

#inspect-desc {
  font-size: 13px;
  color: #888888;
  line-height: 1.6;
  margin-bottom: 14px;
}

#inspect-hint {
  font-size: 11px;
  color: #446644;
}

/* Enemy HP bar — top-right, visible only during combat */
#enemy-bar {
  display: none;
  position: absolute;
  top: 36px;
  right: 16px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid #882222;
  padding: 8px 12px;
  min-width: 200px;
  pointer-events: none;
  z-index: 6;
}

#enemy-bar-name {
  font-size: 12px;
  color: #cc4444;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.enemy-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Combat action hint — bottom-center */
#combat-hint {
  display: none;
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #88cc88;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
}

/* Combat toast messages */
#combat-toast {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 6;
}

.toast-line {
  font-size: 14px;
  padding: 2px 12px;
  white-space: nowrap;
  animation: toastFade 2.8s ease forwards;
}
.toast-player { color: #aaffaa; }
.toast-enemy  { color: #ff8866; }
.toast-result { color: #ffdd44; }
.toast-defeat { color: #ff4444; }

@keyframes toastFade {
  0%   { opacity: 0; transform: translateY(6px); }
  12%  { opacity: 1; transform: translateY(0);   }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* HUD minimap — bottom-right */
#minimap-hud {
  position: absolute;
  bottom: 16px;
  right: 16px;
  border: 1px solid #446644;
  background: #000;
  pointer-events: auto;
  cursor: pointer;
  image-rendering: pixelated;
}

/* Fullscreen map canvas (now lives inside #game-panel map pane) */

#minimap-full {
  display: block;
  image-rendering: pixelated;
}

#map-close-hint {
  color: #557755;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* ── Inspect items list (loot popup) ──────────────────────────────────── */
#inspect-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.loot-item {
  font-size: 12px;
  padding: 2px 0;
  letter-spacing: 1px;
}

/* ── Inventory section (now a pane inside #game-panel) ─────────────────── */

#inventory-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #334433;
}

#inventory-title {
  font-size: 16px;
  color: #aaffaa;
  letter-spacing: 3px;
  flex: 1;
}

#inv-item-count {
  font-size: 12px;
  color: #557755;
}

#inventory-close-hint {
  font-size: 11px;
  color: #334433;
}

#inventory-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 16px 0;
  border-bottom: 1px solid #334433;
}

.inv-tab {
  background: transparent;
  border: 1px solid #334433;
  border-bottom: none;
  color: #557755;
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 4px 12px;
  cursor: pointer;
  pointer-events: auto;
}

.inv-tab:hover { color: #aaffaa; border-color: #446644; }
.inv-tab.active { color: #aaffaa; border-color: #446644; background: rgba(0,255,0,0.05); }

.inv-tab.gp-controller-focus {
  color: #d8ffd8;
  border-color: #aaffaa;
  background: rgba(30, 70, 30, 0.45);
}

#inventory-grid {
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  align-items: stretch;
}

.inv-empty {
  color: #334433;
  font-size: 13px;
  padding: 20px;
  width: 100%;
  text-align: center;
}

.inv-card {
  width: 220px;
  min-height: 230px;
  border: 1px solid #334433;
  background: rgba(0,0,0,0.5);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}


.inv-card.gp-inventory-selected,
.eq-slot.gp-inventory-selected {
  position: relative;
  outline: 1px solid rgba(231,255,143,0.75);
  outline-offset: 1px;
  box-shadow: 0 0 14px rgba(170,255,120,0.18), inset 0 -4px 0 #e7ff8f;
  background: rgba(26, 40, 12, 0.9);
}

.eq-slot.gp-inventory-selected .eq-slot-label,
.inv-card.gp-inventory-selected .inv-card-type,
.inv-card.gp-inventory-selected .inv-card-freq {
  color: #e7ff8f;
}

.eq-slot.gp-inventory-selected .eq-slot-name,
.inv-card.gp-inventory-selected .inv-card-name {
  color: #f7ffe6;
  text-decoration: underline;
  text-decoration-color: #e7ff8f;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.eq-slot.gp-inventory-selected .eq-slot-stats,
.inv-card.gp-inventory-selected .inv-card-stats,
.inv-card.gp-inventory-selected .inv-card-desc,
.eq-slot.gp-inventory-selected .eq-slot-empty {
  color: #c4d6b1;
}

.gp-inventory-selected-action {
  border-color: #d7ff7a !important;
  color: #f2ffd3 !important;
  background: rgba(56, 92, 28, 0.9) !important;
  box-shadow: 0 0 10px rgba(180,255,110,0.25);
}

.inv-card-header {
  display: flex;
  justify-content: space-between;
}

.inv-card-body {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex: 1;
}

.inv-card-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.inv-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 100%;
}

.inv-card-type {
  color: #557755;
  font-size: 10px;
}

.inv-card-freq {
  font-size: 9px;
  letter-spacing: 1px;
}

.inv-card-name {
  font-size: 14px;
  color: #cccccc;
  letter-spacing: 1px;
}

.inv-card-qty {
  font-size: 12px;
  color: #ffcc00;
  margin-left: 5px;
  letter-spacing: 0;
}

.inv-card-stats {
  font-size: 11px;
  color: #888;
}

.inv-card-desc {
  font-size: 11px;
  color: #555;
  line-height: 1.4;
  margin-top: 2px;
  flex: 1;
}

/* ── Inventory card action row (equip + hotbar assign) ─────────────────────── */
.inv-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid #222;
}

.inv-card-status {
  font-size: 10px;
  color: #88cc88;
  margin-top: 1px;
}

.inv-btn-equip {
  font-size: 10px;
  padding: 3px 8px;
  background: #0d1a0d;
  border: 1px solid #446644;
  color: #aaffaa;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-align: left;
}

.inv-btn-equip:hover { background: #1a2e1a; }

.inv-btn-unequip {
  border-color: #557755;
  color: #88cc88;
}

.inv-hotbar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.inv-hotbar-row > span {
  font-size: 10px;
  color: #556655;
  margin-right: 2px;
}

.inv-btn-slot {
  font-size: 10px;
  width: 22px;
  height: 22px;
  background: #111;
  border: 1px solid #334433;
  color: #556655;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inv-btn-slot.active {
  border-color: #aaffaa;
  color: #aaffaa;
  background: #0d1a0d;
}

.inv-btn-slot:hover { background: #1a2e1a; border-color: #557755; }

/* Rarity colours — border + freq badge */
.freq-common    { border-color: #446644; }
.freq-common    .inv-card-freq { color: #557755; }

.freq-unusual   { border-color: #2266aa; }
.freq-unusual   .inv-card-freq { color: #4488cc; }

.freq-rare      { border-color: #6633aa; }
.freq-rare      .inv-card-freq { color: #9955cc; }

.freq-elite     { border-color: #886622; }
.freq-elite     .inv-card-freq { color: #ccaa44; }

.freq-epic      { border-color: #882244; }
.freq-epic      .inv-card-freq { color: #cc4466; }

.freq-legendary { border-color: #aa6622; }
.freq-legendary .inv-card-freq { color: #ff8833; }

/* Loot item list colours */
.loot-item.freq-common    { color: #557755; }
.loot-item.freq-unusual   { color: #4488cc; }
.loot-item.freq-rare      { color: #9955cc; }
.loot-item.freq-elite     { color: #ccaa44; }
.loot-item.freq-epic      { color: #cc4466; }
.loot-item.freq-legendary { color: #ff8833; }

/* ── Equipped panel (Equipped tab in inventory overlay) ─────────────────── */
#equipped-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px;
  width: 100%;
  box-sizing: border-box;
}

.eq-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.eq-slot {
  border: 1px solid #223322;
  background: rgba(0, 0, 0, 0.35);
  padding: 5px;
  min-height: 50px;
  box-sizing: border-box;
}

.eq-slot-label {
  display: block;
  font-size: 9px;
  color: #446644;
  letter-spacing: 1px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.eq-slot-empty {
  font-size: 10px;
  color: #333;
  font-style: italic;
}

.eq-slot-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.eq-slot-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.eq-slot-info { flex: 1; min-width: 0; }

.eq-slot-name {
  font-size: 11px;
  color: #aaffaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eq-slot-stats {
  font-size: 9px;
  color: #556655;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eq-btn-unequip {
  display: inline-block;
  margin-top: 3px;
  font-size: 9px;
  padding: 2px 5px;
  background: #0d1a0d;
  border: 1px solid #335533;
  color: #88cc88;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.eq-btn-unequip:hover { background: #1a2a1a; }

.gp-controller-focus {
  outline: 1px solid #aaffaa;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(170,255,170,0.15), 0 0 10px rgba(120,220,120,0.25);
}

.gp-tab.gp-controller-focus,
.inv-tab.gp-controller-focus,
.inv-btn-equip.gp-controller-focus,
.inv-btn-slot.gp-controller-focus,
.eq-btn-unequip.gp-controller-focus,
#profile-skill-tree-btn.gp-controller-focus,
#controls-reset-btn.gp-controller-focus,
.st-learn-btn.gp-controller-focus,
#shop-body button.gp-controller-focus {
  border-color: #aaffaa;
  color: #d8ffd8;
  background: rgba(30, 70, 30, 0.45);
}

/* Ring column — compact slots */
.eq-col-rings .eq-slot { min-height: 40px; }

/* Rarity border tint for equipped slots */
.eq-slot.freq-unusual   { border-color: #2a4466; }
.eq-slot.freq-rare      { border-color: #4a2a66; }
.eq-slot.freq-elite     { border-color: #665522; }
.eq-slot.freq-epic      { border-color: #661a33; }
.eq-slot.freq-legendary { border-color: #664411; }

/* ── Debug teleport console ─────────────────────────────────────────────── */
#debug-console {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.90);
  border: 1px solid #00cc44;
  padding: 5px 14px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #00cc44;
  z-index: 200;
  white-space: nowrap;
}

.debug-prompt {
  color: #00ff77;
  font-weight: bold;
  user-select: none;
}

#debug-input {
  background: transparent;
  border: none;
  outline: none;
  color: #00ff77;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  width: 280px;
}

#debug-input::placeholder {
  color: #2a5c2a;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHARACTER SELECT
   ═══════════════════════════════════════════════════════════════════════════ */

#char-select-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  justify-content: center; align-items: flex-start;
  overflow-y: auto; z-index: 30;
  pointer-events: auto;
}

#char-select-inner {
  width: min(96vw, 1200px);
  padding: 24px 24px 32px;
  display: flex; flex-direction: column; gap: 16px;
}

#char-select-header { text-align: center; }
#char-select-title  { font-size: 28px; color: #aaffaa; letter-spacing: 4px; margin: 0 0 6px; }
#char-select-sub    { font-size: 13px; color: #557755; margin: 0; }

.cs-section-label {
  font-size: 12px; letter-spacing: 3px; color: #557755;
  border-bottom: 1px solid #224422;
  padding-bottom: 6px;
  display: flex; align-items: center; gap: 12px;
}

.cs-gender-group { display: flex; gap: 6px; margin-left: auto; }
.cs-gender-btn {
  background: transparent; border: 1px solid #334433;
  color: #557755; font-family: monospace; font-size: 11px;
  padding: 3px 10px; cursor: pointer; pointer-events: auto;
}
.cs-gender-btn:hover, .cs-gender-btn.active { color: #aaffaa; border-color: #446644; }

/* Race grid */
#char-race-grid, #char-class-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.cs-card {
  flex: 1 1 140px; max-width: 180px;
  border: 1px solid #334433; background: rgba(0,0,0,0.5);
  padding: 10px; cursor: pointer; pointer-events: auto;
  display: flex; flex-direction: column; gap: 5px;
  transition: border-color 0.15s;
}
.cs-card:hover   { border-color: #446644; }
.cs-card.selected { border-color: #aaffaa; background: rgba(0,80,0,0.2); }
.cs-card.gp-controller-focus {
  border-color: #e7ff8f;
  background: rgba(24, 42, 12, 0.88);
  box-shadow: 0 0 0 2px rgba(231,255,143,0.18), 0 0 16px rgba(170,255,120,0.14);
}
.cs-card.selected.gp-controller-focus {
  box-shadow: 0 0 0 2px rgba(231,255,143,0.28), 0 0 18px rgba(170,255,120,0.2);
}
.cs-gender-btn.gp-controller-focus,
#char-select-confirm.gp-controller-focus {
  border-color: #e7ff8f;
  color: #f1ffd0;
  background: rgba(36, 60, 18, 0.5);
  box-shadow: 0 0 0 2px rgba(231,255,143,0.16);
}

.cs-portrait { width: 100%; aspect-ratio: 1/1; overflow: hidden; }
.cs-portrait img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.cs-class-icon { font-size: 32px; text-align: center; padding: 8px 0; }

.cs-card-name  { font-size: 13px; color: #aaffaa; letter-spacing: 1px; }
.cs-card-desc  { font-size: 10px; color: #557755; line-height: 1.4; }
.cs-base-stats { font-size: 10px; color: #4488cc; }

#char-stats-preview { padding: 10px; background: rgba(0,40,0,0.3); border: 1px solid #224422; }
#char-combined-stats { font-size: 13px; color: #88bbff; padding-top: 6px; }
.cs-dot { color: #446644; }

#char-select-confirm {
  align-self: center;
  background: transparent; border: 1px solid #446644;
  color: #aaffaa; font-family: monospace; font-size: 15px;
  letter-spacing: 2px; padding: 12px 32px; cursor: pointer;
  pointer-events: auto;
}
#char-select-confirm:hover:not(:disabled) { background: rgba(0,80,0,0.3); }
#char-select-confirm:disabled { opacity: 0.4; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   SKILL TREE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Skill tree now lives inside #game-panel skills pane */

#st-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #334433;
}
#st-title       { font-size: 16px; color: #aaffaa; letter-spacing: 3px; flex: 1; }
#st-skill-points { font-size: 13px; color: #ffcc00; }
#st-close-hint  { font-size: 11px; color: #334433; }

#st-columns {
  display: flex; flex: 1; overflow: hidden;
}

.st-col {
  flex: 1; overflow-y: auto; padding: 12px;
  border-right: 1px solid #224422;
  display: flex; flex-direction: column; gap: 8px;
}
.st-col:last-child { border-right: none; }

.st-col-title { font-size: 11px; letter-spacing: 2px; color: #557755; padding-bottom: 6px; border-bottom: 1px solid #224422; }
.st-empty     { font-size: 12px; color: #334433; padding: 16px 0; }

.st-skill {
  border: 1px solid #334433; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.st-skill.st-available { border-color: #446644; }
.st-skill.st-learned   { border-color: #225522; background: rgba(0,60,0,0.2); }
.st-skill.st-locked    { opacity: 0.45; }

.st-skill-header { display: flex; justify-content: space-between; align-items: baseline; }
.st-skill-name   { font-size: 13px; color: #cccccc; }
.st-skill-cost   { font-size: 10px; color: #557755; }
.st-skill-desc   { font-size: 11px; color: #666; }
.st-skill-mods   { font-size: 10px; color: #9cbef4; line-height: 1.4; }
.st-skill-action { margin-top: 2px; }

.st-learn-btn {
  background: transparent; border: 1px solid #446644;
  color: #aaffaa; font-family: monospace; font-size: 11px;
  padding: 3px 10px; cursor: pointer; pointer-events: auto;
}
.st-learn-btn:hover { background: rgba(0,80,0,0.3); }
.st-badge-learned { font-size: 10px; color: #447744; }
.st-badge-locked  { font-size: 10px; color: #444; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Profile now lives inside #game-panel profile pane */

#profile-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #334433;
}
#profile-title     { font-size: 16px; color: #aaffaa; letter-spacing: 3px; flex: 1; }
#profile-close-hint { font-size: 11px; color: #334433; }

#profile-body {
  display: flex; gap: 16px; padding: 16px;
  border-bottom: 1px solid #224422;
}

#profile-portrait {
  width: 120px; height: 120px; flex-shrink: 0;
  border: 1px solid #334433; overflow: hidden;
}
#profile-portrait img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.profile-no-portrait  { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #334433; }

#profile-identity { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.profile-id-row   { display: flex; gap: 8px; font-size: 13px; }
.profile-id-label { color: #557755; width: 60px; flex-shrink: 0; }
#profile-identity span:not(.profile-id-label) { color: #aaffaa; }

#profile-stats { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.profile-stat-row { display: flex; justify-content: space-between; font-size: 12px; }
.profile-stat-key { color: #557755; }
.profile-stat-val { color: #88bbff; }

.profile-stat-row-detailed {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #152115;
  padding: 4px 0;
}

.profile-stat-base {
  color: #6da8ff;
}

.profile-stat-mod {
  color: #f1f1f1;
}

.profile-stat-mod.is-negative {
  color: #ff6666;
}

.profile-stat-total {
  color: #8be28b;
  font-weight: bold;
}

.profile-stat-suffix {
  color: #6a6a6a;
  font-size: 10px;
}

#profile-tags-section,
#profile-equipment-section,
#profile-skills-section {
  padding: 12px 16px;
  border-bottom: 1px solid #224422;
}

#profile-tags,
#profile-equipment-breakdown,
#profile-skills-learned {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.profile-tag-row,
.profile-equip-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  font-size: 12px;
}

.profile-tag-label,
.profile-equip-name {
  color: #8ab88a;
}

.profile-tag-value,
.profile-equip-effect {
  color: #d0d0d0;
}

.profile-skill-card {
  border: 1px solid #264026;
  background: rgba(4, 24, 4, 0.2);
  padding: 8px 10px;
}

.profile-skill-name {
  color: #aaffaa;
  font-size: 12px;
}

.profile-skill-desc {
  color: #7f907f;
  font-size: 11px;
  margin-top: 3px;
}

.profile-skill-effect {
  color: #bcd6ff;
  font-size: 10px;
  margin-top: 4px;
}

.profile-empty-note {
  color: #4c5d4c;
  font-size: 12px;
}

#profile-skill-tree-btn {
  margin: 12px 16px;
  background: transparent; border: 1px solid #446644;
  color: #aaffaa; font-family: monospace; font-size: 12px;
  letter-spacing: 1px; padding: 8px 20px; cursor: pointer;
  pointer-events: auto; align-self: flex-start;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UNIFIED GAME PANEL  — vertical tab nav + content panes
   ═══════════════════════════════════════════════════════════════════════════ */

#game-panel {
  display: none;             /* shown by JS */
  position: fixed;
  top: 5vh;  left: 5vw;
  width: 90vw;  height: 90vh;
  background: rgba(4, 8, 4, 0.97);
  border: 1px solid #2a4a2a;
  border-radius: 4px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  z-index: 30;
  pointer-events: auto;
  flex-direction: row;       /* flex is set when display:flex */
}

/* ── Left vertical nav ───────────────────────────────────────────────────── */
#gp-nav {
  width: 110px;
  flex-shrink: 0;
  background: #050505;
  border-right: 1px solid #1a2e1a;
  display: flex;
  flex-direction: column;
  padding: 20px 0 12px;
  gap: 2px;
}

.gp-tab {
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: #446644;
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  pointer-events: auto;
  transition: color 0.1s, border-color 0.1s;
}
.gp-tab:hover { color: #88cc88; }
.gp-tab.gp-tab-active {
  color: #aaffaa;
  border-left-color: #aaffaa;
  background: rgba(0, 255, 0, 0.04);
}

.gp-nav-spacer { flex: 1; }

.gp-close-hint {
  font-size: 9px;
  color: #334433;
  letter-spacing: 1px;
  text-align: center;
  padding: 8px;
}

/* ── Right content area ──────────────────────────────────────────────────── */
#gp-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #090909;
}

.gp-pane {
  display: none;           /* hidden by default */
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Profile pane — keep existing profile inner styles, just set padding */
.gp-pane[data-pane="profile"] { padding: 0; }
.gp-pane[data-pane="inventory"] { padding: 0; gap: 0; }
.gp-pane[data-pane="shop"] { padding: 0; position: relative; }
.gp-pane[data-pane="skills"] { padding: 0; }

#shop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid #3a2d1d;
  background: linear-gradient(180deg, rgba(18, 12, 7, 0.92), rgba(11, 8, 5, 0.85));
  position: relative;
  z-index: 1;
}

#shop-title {
  font-size: 18px;
  letter-spacing: 3px;
  color: #f0d3a0;
}

#shop-subtitle {
  font-size: 12px;
  color: #9d8564;
  margin-top: 6px;
}

#shop-player-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.shop-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #b9a383;
}

.shop-summary-row span:last-child {
  color: #f4dd9e;
}

#shop-body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
  padding: 18px 20px 20px;
  background:
    linear-gradient(rgba(5, 3, 2, 0.76), rgba(5, 3, 2, 0.88)),
    url('src/sprites/merchant_front.png') center top / cover no-repeat;
}

.shop-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(8, 7, 6, 0.78);
  border: 1px solid #4b3823;
  backdrop-filter: blur(2px);
}

.shop-column-title {
  padding: 10px 12px;
  border-bottom: 1px solid #3b2d1d;
  color: #caa46e;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#shop-merchant-grid,
#shop-player-grid {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-card {
  border: 1px solid #594126;
  background: rgba(18, 13, 9, 0.88);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-card-body {
  display: flex;
  gap: 10px;
}

.shop-card-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.shop-card-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.shop-card-title {
  color: #f0e1c6;
  font-size: 14px;
}

.shop-card-price {
  color: #ffcf70;
  font-size: 12px;
}

.shop-card-desc {
  color: #998366;
  font-size: 11px;
  line-height: 1.4;
}

.shop-card-mods {
  color: #b6d1ff;
  font-size: 10px;
  line-height: 1.4;
}

.shop-action-btn {
  align-self: flex-start;
  background: #1e1710;
  border: 1px solid #8c6a39;
  color: #f4ddb2;
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 4px 10px;
  cursor: pointer;
}

.shop-action-btn:hover {
  background: #2b2117;
}

.shop-action-sell {
  border-color: #5d875d;
  color: #bfe8bf;
}

.shop-empty {
  color: #7e684d;
  font-size: 12px;
  padding: 16px;
}

/* ── Map pane ────────────────────────────────────────────────────────────── */
#gp-map-scroll-handle {
  flex-shrink: 0;
  align-self: stretch;
  background: transparent;
  border: none;
  color: #5aaa5a;
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 6px 12px;
  text-align: center;
  cursor: default;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#gp-map-scroll-handle.gp-controller-focus {
  outline: none;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
}

#gp-map-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 12px;
  overflow-y: auto;
}

.gp-map-legend {
  font-size: 11px;
  color: #557755;
  letter-spacing: 1px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.ml-dot { font-size: 14px; }

/* ── Quests pane (empty state) ───────────────────────────────────────────── */
.gp-pane-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: #446644;
  font-size: 13px;
  letter-spacing: 2px;
}
.gp-empty-icon { font-size: 40px; }
.gp-empty-sub  { font-size: 11px; color: #2a3d2a; }

/* ── History pane ────────────────────────────────────────────────────────── */
.gp-pane-title {
  font-size: 13px;
  letter-spacing: 3px;
  color: #557755;
  padding: 14px 18px 8px;
  border-bottom: 1px solid #1a2e1a;
  flex-shrink: 0;
}

#gp-history-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gp-history-entry {
  display: flex;
  gap: 10px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid #111;
}
.gp-history-time { color: #334433; flex-shrink: 0; width: 38px; }
.gp-history-msg  { color: #aaaaaa; }
.gp-history-empty { color: #334433; font-size: 12px; padding: 16px 0; }

/* Category tints */
.gp-log-loot   .gp-history-msg { color: #aaaa55; }
.gp-log-combat .gp-history-msg { color: #cc6655; }
.gp-log-floor  .gp-history-msg { color: #5599bb; }
.gp-log-system .gp-history-msg { color: #667766; }

/* ── Controls / Keybinds panel ──────────────────────────────────────────── */

#controls-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.ctrl-row:hover {
  background: #1a2a1a;
  border-color: #2a3a2a;
}
.ctrl-row-waiting {
  background: #1a2a0a;
  border-color: #3a5a1a;
}
.ctrl-row-conflict {
  background: #2a1a0a;
  border-color: #4a2a0a;
}

.ctrl-action-label {
  font-size: 12px;
  color: #99aa88;
  flex: 1;
}

.ctrl-key-badge {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  background: #111a11;
  border: 1px solid #2a3a2a;
  border-radius: 3px;
  padding: 2px 8px;
  min-width: 56px;
  text-align: center;
  color: #88cc88;
}
.ctrl-key-waiting {
  background: #1e2e0e;
  border-color: #4a7a1a;
  color: #aada55;
  animation: ctrl-blink 0.8s step-end infinite;
}
.ctrl-key-conflict {
  background: #2e1a0a;
  border-color: #7a3a0a;
  color: #dd8855;
}

.ctrl-guide {
  margin-top: 12px;
  border-top: 1px solid #1a2e1a;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ctrl-guide-title {
  font-size: 12px;
  letter-spacing: 2px;
  color: #88cc88;
}

.ctrl-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 8px 16px;
}

.ctrl-guide-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  font-size: 11px;
  padding: 6px 8px;
  border: 1px solid #1c2a1c;
  background: rgba(8, 16, 8, 0.45);
}

.ctrl-guide-key {
  color: #aaffaa;
}

.ctrl-guide-value {
  color: #6f8a6f;
  line-height: 1.4;
}

@keyframes ctrl-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#controls-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid #1a2e1a;
  flex-shrink: 0;
}

#controls-reset-btn {
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  color: #88cc88;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
#controls-reset-btn:hover {
  background: #223322;
  border-color: #3a6a3a;
}

.controls-hint {
  font-size: 11px;
  color: #445544;
  line-height: 1.4;
}
.controls-hint kbd {
  background: #111a11;
  border: 1px solid #2a3a2a;
  border-radius: 2px;
  padding: 1px 4px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
}

/* ── Save / Load panel ───────────────────────────────────────────────────── */
#save-slots-container {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.save-slot-card {
  background: rgba(14, 22, 10, 0.85);
  border: 1px solid #2a3d2a;
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.save-slot-header {
  font-size: 11px;
  letter-spacing: 3px;
  color: #557755;
  text-transform: uppercase;
}

.save-slot-info {
  font-size: 12px;
  color: #99bb88;
  line-height: 1.6;
}

.save-slot-info.save-slot-empty {
  color: #334433;
  font-style: italic;
}

.save-slot-date {
  font-size: 10px;
  color: #446644;
}

.save-slot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.save-slot-btn {
  padding: 6px 16px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  background: rgba(20, 35, 20, 0.9);
  color: #88aa66;
  border: 1px solid #2a3d2a;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.save-slot-btn:hover,
.save-slot-btn.gp-controller-focus {
  background: rgba(40, 70, 30, 0.9);
  border-color: #e7ff8f;
  color: #e7ff8f;
  outline: none;
}

.save-load-btn {
  color: #88bbcc;
  border-color: #2a3d4a;
}

.save-load-btn:hover,
.save-load-btn.gp-controller-focus {
  background: rgba(20, 50, 60, 0.9);
  border-color: #8fd4e7;
  color: #8fd4e7;
}

.save-export-btn {
  color: #a0cc88;
  border-color: #2a4020;
}

.save-export-btn:hover,
.save-export-btn.gp-controller-focus {
  background: rgba(20, 50, 15, 0.9);
  border-color: #8fd47a;
  color: #8fd47a;
}

.save-import-btn {
  color: #cc9a55;
  border-color: #3d2a10;
}

.save-import-btn:hover,
.save-import-btn.gp-controller-focus {
  background: rgba(50, 30, 10, 0.9);
  border-color: #e7b87a;
  color: #e7b87a;
}

/* ════════════════════════════════════════════════════════════════════════════
   QUEST SYSTEM
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Quest Panel (Quests pane) ───────────────────────────────────────────── */
.quest-card {
  margin: 14px 18px;
  padding: 14px 16px;
  border: 1px solid #2a3d2a;
  background: rgba(8, 18, 8, 0.6);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quest-card.quest-complete {
  border-color: #3a6a3a;
  background: rgba(0, 30, 0, 0.4);
}
.quest-card-title {
  font-size: 13px;
  letter-spacing: 2px;
  color: #ccddcc;
  text-transform: uppercase;
}
.quest-card-desc {
  font-size: 11px;
  color: #667766;
  line-height: 1.5;
}
.quest-status {
  font-size: 11px;
  color: #88aa66;
  letter-spacing: 1px;
}
.quest-progress {
  font-size: 13px;
  color: #ffcc55;
  font-weight: bold;
}
.quest-clue-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quest-clue-slot {
  min-width: 60px;
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 12px;
  text-align: center;
  border: 1px solid #2a3a2a;
  background: rgba(10, 20, 10, 0.6);
}
.quest-clue-slot.collected {
  border-color: #446644;
  background: rgba(0, 40, 0, 0.5);
}
.quest-clue-slot.missing {
  opacity: 0.45;
}
.clue-word   { color: #88dd88; font-style: italic; }
.clue-unknown { color: #334433; }
.quest-btn {
  align-self: flex-start;
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
  background: rgba(20, 40, 20, 0.8);
  color: #88aa66;
  border: 1px solid #2a3d2a;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.quest-btn:hover { background: rgba(30, 60, 20, 0.9); border-color: #88cc66; }
.quest-complete-note {
  font-size: 11px;
  color: #557755;
  font-style: italic;
}

/* ── Quest Scroll Popup ──────────────────────────────────────────────────── */
#quest-scroll-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#quest-scroll-popup.hidden { display: none; }
#quest-scroll-inner {
  background: rgba(8, 16, 8, 0.97);
  border: 2px solid #446644;
  border-radius: 6px;
  padding: 36px 40px 28px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 40px rgba(0, 120, 0, 0.3);
}
#quest-scroll-icon { font-size: 48px; }
#quest-scroll-title {
  font-size: 16px;
  letter-spacing: 3px;
  color: #ccddaa;
  text-transform: uppercase;
  margin: 0;
}
#quest-scroll-body {
  font-size: 13px;
  color: #88aa77;
  line-height: 1.7;
  text-align: center;
  white-space: pre-line;
  font-style: italic;
}
#quest-scroll-close {
  padding: 8px 24px;
  font-size: 11px;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  background: rgba(20, 40, 20, 0.9);
  color: #88aa66;
  border: 1px solid #2a3d2a;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 8px;
}
#quest-scroll-close:hover { border-color: #88cc66; }

/* ── Quest Table Modal ───────────────────────────────────────────────────── */
#quest-table-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#quest-table-modal.hidden { display: none; }
#qt-inner {
  background: rgba(8, 16, 8, 0.97);
  border: 2px solid #3a5a3a;
  border-radius: 6px;
  padding: 28px 32px 24px;
  max-width: 520px;
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 0 50px rgba(0, 100, 0, 0.25);
}
#qt-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
#qt-icon   { font-size: 40px; }
#qt-title  {
  font-size: 15px;
  letter-spacing: 3px;
  color: #ccddaa;
  text-transform: uppercase;
  margin: 0;
}
#qt-subtitle {
  font-size: 11px;
  color: #667766;
  font-style: italic;
  margin: 0;
}
.qt-section-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #446644;
  margin-bottom: 6px;
  text-transform: uppercase;
}
#qt-slots {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.qt-slot {
  min-width: 90px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px dashed #2a3a2a;
  border-radius: 4px;
  background: rgba(10, 20, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  font-size: 13px;
  transition: border-color 0.15s;
}
.qt-slot.filled { border-color: #446644; border-style: solid; }
.qt-slot-num { color: #2a3a2a; font-size: 18px; }
.qt-word     { color: #88ddaa; letter-spacing: 1px; }
.qt-remove {
  background: none;
  border: none;
  color: #446644;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}
.qt-remove:hover { color: #cc4444; }
#qt-words {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 40px;
  padding: 8px;
  border: 1px solid #1a2a1a;
  border-radius: 4px;
  background: rgba(5, 12, 5, 0.4);
}
.qt-word-chip {
  padding: 6px 14px;
  background: rgba(20, 50, 20, 0.8);
  border: 1px solid #2a4a2a;
  border-radius: 3px;
  font-size: 13px;
  color: #aaddaa;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.1s, border-color 0.1s;
}
.qt-word-chip:hover { background: rgba(30, 70, 20, 0.9); border-color: #66aa55; color: #ccffcc; }
.qt-no-words { font-size: 11px; color: #334433; font-style: italic; align-self: center; }
#qt-feedback {
  font-size: 11px;
  color: #cc5544;
  text-align: center;
  min-height: 16px;
  font-style: italic;
}
#qt-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
}
#qt-submit {
  padding: 9px 28px;
  font-size: 12px;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  background: rgba(0, 50, 0, 0.9);
  color: #88cc66;
  border: 1px solid #3a6a3a;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
#qt-submit:hover:not(:disabled) { background: rgba(10, 80, 10, 0.9); border-color: #66cc44; }
#qt-submit:disabled { opacity: 0.35; cursor: not-allowed; }
#qt-close {
  padding: 9px 20px;
  font-size: 12px;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  background: rgba(20, 30, 20, 0.8);
  color: #667766;
  border: 1px solid #2a3a2a;
  border-radius: 3px;
  cursor: pointer;
}
#qt-close:hover { border-color: #446644; color: #99aa88; }

@keyframes qt-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.qt-shake { animation: qt-shake 0.45s ease-in-out; }

/* ── Elemental skill tree columns ─────────────────────────────────────────── */
.st-elemental-col { border-left: 1px solid #1a2a1a; }
.st-magic-locked  { font-size: 11px; color: #334433; text-align: center; padding: 12px 6px; line-height: 1.6; }
.st-elemental-title { font-size: 11px; letter-spacing: 2px; padding-bottom: 6px; border-bottom: 1px solid #1a2a1a; }
.st-elemental-fire   { color: #cc6633; border-bottom-color: #441a00; }
.st-elemental-water  { color: #3366cc; border-bottom-color: #001a44; }
.st-elemental-earth  { color: #6a8833; border-bottom-color: #1a2a00; }
.st-elemental-wind   { color: #88aacc; border-bottom-color: #1a2a33; }
.st-elemental-energy { color: #cc99ff; border-bottom-color: #2a1a44; }

/* ── Log entry type for quest messages ────────────────────────────────────── */
.gp-log-quest .gp-history-msg { color: #aacc88; }

/* Quest items in inventory */
.freq-quest { border-color: #5a4a22 !important; }
.freq-quest .inv-card-freq { color: #ccaa44; }

/* ═══ Mob Almanac ══════════════════════════════════════════════════════════ */
#almanac-body { display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow-y: auto; }
.alm-empty { color: #666; font-style: italic; text-align: center; margin-top: 40px; }
.alm-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: #1a1a1a; border: 1px solid #333; border-radius: 6px;
  padding: 10px 14px;
}
.alm-card-boss { border-color: #8b0000; background: #1a0a0a; }
.alm-portrait { flex-shrink: 0; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.alm-portrait img { max-width: 64px; max-height: 64px; image-rendering: pixelated; }
.alm-details { flex: 1; min-width: 0; }
.alm-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.alm-name { font-size: 1.0em; font-weight: bold; color: #cccccc; }
.alm-boss-badge {
  font-size: 0.65em; background: #8b0000; color: #ffaaaa;
  border-radius: 3px; padding: 1px 5px; letter-spacing: 1px;
}
.alm-defeats { margin-left: auto; font-size: 0.75em; color: #557733; }
.alm-stats-row { display: flex; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.alm-stat { font-size: 0.8em; padding: 2px 7px; border-radius: 3px; }
.alm-hp  { background: #3a1010; color: #ff8888; }
.alm-atk { background: #2a1a08; color: #ffaa44; }
.alm-def { background: #0e1e2e; color: #6699cc; }
.alm-tags-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.alm-tag-label { font-size: 0.72em; color: #666; min-width: 58px; }
.alm-tag {
  font-size: 0.72em; border-radius: 3px; padding: 1px 6px; text-transform: capitalize;
  background: #222; color: #999; border: 1px solid #444;
}
.alm-tag-none { color: #444; border-color: #333; }
.alm-tag-fire    { background: #3a1000; color: #ff7733; border-color: #aa3300; }
.alm-tag-magic   { background: #170d2a; color: #bb88ff; border-color: #552299; }
.alm-tag-physical{ background: #1a1a0a; color: #aaa855; border-color: #555522; }
.alm-tag-poison  { background: #0a1a0a; color: #55bb55; border-color: #226622; }
.alm-tag-fear    { background: #1a0a1a; color: #cc88cc; border-color: #662266; }
.alm-tag-water   { background: #071520; color: #5599ff; border-color: #224488; }
.alm-tag-earth   { background: #100d00; color: #aa8844; border-color: #443300; }
.alm-tag-wind    { background: #0a1208; color: #88cc77; border-color: #336622; }
.alm-tag-energy  { background: #1a1000; color: #ffdd44; border-color: #aa8800; }
.alm-desc { font-size: 0.75em; color: #666; font-style: italic; margin-top: 4px; line-height: 1.4; }
