/* ============================================================
   Wyrdscape — base styles (engine layer)
   Dark theme with OSRS-inspired brown / cream palette.
   Visual polish pass by ui-designer (Task #45).
   ============================================================ */

:root {
  --bg-deep:      #0a0a0a;
  --bg-canvas:    #1a1410;
  --panel-bg:     #2a1d12;
  --panel-bg-hi:  #3c2817;
  --panel-bg-lo:  #1e140a;
  --panel-border: #8b6a3b;
  --panel-border-hi: #c89850;
  --panel-glow:   rgba(255, 180, 80, 0.28);

  --text-cream:   #ffe6a6;
  --text-gold:    #ffb83f;
  --text-mute:    #a88c5a;
  --text-warn:    #e54d2e;
  --text-good:    #6abf4e;

  --hud-bg:       rgba(20, 12, 6, 0.85);
  --hud-border:   #5a3a18;

  /* Reusable shadow tokens */
  --shadow-deep:  0 6px 22px rgba(0,0,0,0.85);
  --shadow-soft:  0 4px 14px rgba(0,0,0,0.6);
  --inner-dark:   inset 0 0 10px rgba(0,0,0,0.7);
  --gold-rim:     0 0 0 1px #c89850;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-cream);
  font-family: 'Trebuchet MS', Tahoma, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Game container & canvas ---------------------------------- */

#game-wrapper {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-canvas);
}

#game-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: default;
}

/* Subtle vignette around canvas edges so the world feels framed */
#game-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 55%,
    rgba(0,0,0,0.35) 90%,
    rgba(0,0,0,0.65) 100%);
}

#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  color: var(--text-gold);
  text-shadow: 2px 2px 0 #000, 0 0 12px rgba(255,184,63,0.4);
  pointer-events: none;
  z-index: 5;
  letter-spacing: 1px;
}

/* ---- HUD overlay ---------------------------------------------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

#hud.hidden { display: none; }

#hud > div {
  position: absolute;
  pointer-events: auto;
}

#hud-top-left     { top: 12px;    left: 12px;   }
#hud-top-right    { top: 12px;    right: 12px;  }
#hud-bottom-left  { bottom: 12px; left: 12px;   }
#hud-bottom-right { bottom: 12px; right: 12px;  }

/* ---- Legacy context menu (fallback) -------------------------- */

#context-menu {
  position: fixed;
  z-index: 200;
  min-width: 140px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-cream);
  box-shadow: var(--shadow-deep);
}

#context-menu.hidden { display: none; }

#context-menu .ctx-item {
  padding: 5px 14px;
  cursor: pointer;
  white-space: nowrap;
}

#context-menu .ctx-item:hover {
  background: rgba(255, 180, 80, 0.18);
  color: var(--text-gold);
}

#context-menu .ctx-header {
  padding: 4px 14px;
  color: var(--text-mute);
  font-size: 11px;
  border-bottom: 1px solid var(--hud-border);
  margin-bottom: 4px;
}

/* ---- Legacy tooltip ------------------------------------------ */

#tooltip {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-cream);
  max-width: 240px;
}

#tooltip.hidden { display: none; }

/* ---- Modals (intro / login / future dialogs) ----------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal.hidden { display: none; }

/* Parchment-scroll style centered panel */
.modal-content {
  position: relative;
  background:
    linear-gradient(180deg,
      #4a3018 0%,
      #3c2817 35%,
      #2a1a08 75%,
      #1e140a 100%);
  border: 3px solid var(--panel-border);
  border-radius: 6px;
  padding: 32px 42px 28px;
  max-width: 540px;
  color: #ffd99c;
  box-shadow:
    0 0 60px rgba(255,180,80,0.18),
    0 12px 40px rgba(0,0,0,0.85),
    inset 0 0 24px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,220,150,0.18);
}

/* Inner gold rim — gives a double-border parchment look */
.modal-content::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,200,100,0.35);
  border-radius: 4px;
  pointer-events: none;
}

.modal-content h1 {
  position: relative;
  color: var(--text-gold);
  text-shadow:
    2px 2px 0 #000,
    0 0 14px rgba(255,180,80,0.55),
    0 0 24px rgba(255,180,80,0.25);
  margin-bottom: 8px;
  font-size: 32px;
  text-align: center;
  letter-spacing: 4px;
  font-weight: bold;
}

.modal-content .subtitle {
  text-align: center;
  color: var(--text-mute);
  font-style: italic;
  margin-bottom: 18px;
  position: relative;
}

.modal-content p { margin: 12px 0; font-size: 15px; position: relative; }
.modal-content ul { margin: 10px 0 16px 22px; position: relative; }
.modal-content li { margin: 6px 0; font-size: 14px; }
.modal-content small { color: var(--text-mute); }

#start-btn {
  display: block;
  margin: 24px auto 0;
  padding: 13px 38px;
  font-size: 18px;
  font-weight: bold;
  color: var(--text-cream);
  background: linear-gradient(180deg, #7a5024 0%, #4a2f14 50%, #2f1c08 100%);
  border: 2px solid var(--panel-border-hi);
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
  font-family: inherit;
  letter-spacing: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.25),
    inset 0 -2px 4px rgba(0,0,0,0.4),
    0 4px 10px rgba(0,0,0,0.5);
  transition: transform 0.05s, box-shadow 0.1s, border-color 0.1s;
}

#start-btn:hover {
  background: linear-gradient(180deg, #9b6630 0%, #5d3a18 50%, #3d2510 100%);
  border-color: #e6b760;
  box-shadow:
    inset 0 1px 0 rgba(255,230,160,0.35),
    inset 0 -2px 4px rgba(0,0,0,0.4),
    0 4px 14px rgba(255,180,80,0.35);
}

#start-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.6),
    0 1px 4px rgba(0,0,0,0.5);
}

/* ---- Login modal --------------------------------------------- */

.login-modal-content {
  text-align: center;
  max-width: 420px;
}

#login-username {
  display: block;
  margin: 18px auto 8px;
  width: 80%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--text-cream);
  background: #1a1109;
  border: 2px solid var(--panel-border-hi);
  border-radius: 4px;
  text-align: center;
  outline: none;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.7),
    0 0 0 1px rgba(0,0,0,0.5);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#login-username:focus {
  border-color: #e6b760;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.7),
    0 0 14px var(--panel-glow);
}

#login-username::placeholder {
  color: #6a5538;
  font-size: 14px;
  letter-spacing: 0;
}

.login-error {
  color: #ff8a4a;
  font-size: 14px;
  margin: 6px 0 0;
  min-height: 18px;
  text-shadow: 1px 1px 0 #000;
}

.login-error.hidden { display: none; }

#login-btn {
  display: block;
  margin: 18px auto 0;
  padding: 12px 36px;
  font-size: 18px;
  font-weight: bold;
  color: var(--text-cream);
  background: linear-gradient(180deg, #7a5024 0%, #4a2f14 50%, #2f1c08 100%);
  border: 2px solid var(--panel-border-hi);
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
  font-family: inherit;
  letter-spacing: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.25),
    inset 0 -2px 4px rgba(0,0,0,0.4),
    0 4px 10px rgba(0,0,0,0.5);
  transition: transform 0.05s, box-shadow 0.1s, border-color 0.1s;
}

#login-btn:hover {
  background: linear-gradient(180deg, #9b6630 0%, #5d3a18 50%, #3d2510 100%);
  border-color: #e6b760;
  box-shadow:
    inset 0 1px 0 rgba(255,230,160,0.35),
    inset 0 -2px 4px rgba(0,0,0,0.4),
    0 4px 14px rgba(255,180,80,0.35);
}

#login-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.6),
    0 1px 4px rgba(0,0,0,0.5);
}

#login-btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

/* ---- Generic panel/button helpers ---------------------------- */

.panel {
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text-cream);
  box-shadow: var(--inner-dark);
}

.btn {
  background: linear-gradient(180deg, #7a5024 0%, #4a2f14 50%, #2f1c08 100%);
  border: 1px solid var(--panel-border-hi);
  border-radius: 3px;
  color: var(--text-cream);
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  text-shadow: 1px 1px 0 #000;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.18),
    inset 0 -1px 2px rgba(0,0,0,0.4),
    0 2px 4px rgba(0,0,0,0.4);
  transition: border-color 0.1s, transform 0.05s;
}

.btn:hover {
  background: linear-gradient(180deg, #9b6630 0%, #5d3a18 50%, #3d2510 100%);
  border-color: #e6b760;
}

.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.4);
}

/* Utility */
.hidden { display: none !important; }

/* ============================================================
   UI overlay layer
   All UI elements live inside #ui-overlay above the canvas.
   ============================================================ */

#ui-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  font-family: 'Trebuchet MS', Tahoma, sans-serif;
}

#ui-overlay * { pointer-events: auto; }
#ui-overlay .pe-none { pointer-events: none !important; }

/* ---- Top-right HUD cluster (compass + minimap) -------------- */

.ws-top-right-cluster {
  position: absolute;
  top: 10px;
  right: 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 70;
}

/* Compass — round, recessed, brighter gold rim, inner glow */
.ws-compass {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #6e4520 0%, #3a230c 50%, #150a02 100%);
  border: 2px solid #b8893d;
  box-shadow:
    inset 0 0 10px rgba(0,0,0,0.85),
    inset 0 1px 2px rgba(255,220,150,0.25),
    0 0 8px rgba(255,180,80,0.28),
    0 2px 6px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.ws-compass:hover {
  border-color: #e6b760;
  box-shadow:
    inset 0 0 10px rgba(0,0,0,0.85),
    inset 0 1px 2px rgba(255,220,150,0.35),
    0 0 14px rgba(255,200,100,0.5),
    0 2px 6px rgba(0,0,0,0.6);
}

.ws-compass-needle {
  width: 4px;
  height: 30px;
  background: linear-gradient(180deg,
    #ff4040 0%,
    #d92020 49%,
    #f0e0a8 51%,
    #c8b870 100%);
  border-radius: 1px;
  transform-origin: center center;
  box-shadow:
    0 0 4px rgba(0,0,0,0.7),
    0 0 6px rgba(255,80,80,0.35);
}

.ws-compass-letter {
  position: absolute;
  font-size: 9px;
  color: var(--text-cream);
  font-weight: bold;
  text-shadow: 1px 1px 0 #000, 0 0 3px rgba(0,0,0,0.8);
  pointer-events: none;
  letter-spacing: 0.5px;
}
.ws-compass-letter.n { top: 2px;    left: 50%; transform: translateX(-50%); color: #ffb83f; }
.ws-compass-letter.s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.ws-compass-letter.e { right: 3px;  top: 50%;  transform: translateY(-50%); }
.ws-compass-letter.w { left: 3px;   top: 50%;  transform: translateY(-50%); }

/* Minimap frame — recessed circle with gold rim */
.ws-minimap-frame {
  position: relative;
  width: 158px;
  height: 158px;
  border-radius: 50%;
  background: #0a0a0a;
  border: 3px solid #b8893d;
  overflow: hidden;
  box-shadow:
    inset 0 0 16px rgba(0,0,0,0.9),
    inset 0 2px 3px rgba(255,220,150,0.18),
    0 0 10px rgba(255,180,80,0.18),
    0 3px 8px rgba(0,0,0,0.6);
}

.ws-minimap-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 25%, #2e4a1a 0%, #1f3214 35%, #14210d 70%),
    #1a200f;
  image-rendering: pixelated;
}

.ws-minimap-player {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #ffd700;
  transform: translate(-50%, -60%) rotate(0deg);
  transform-origin: center 70%;
  pointer-events: none;
  filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 3px rgba(255,215,0,0.5));
}

.ws-minimap-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 2px #000;
}
.ws-minimap-dot.npc      { background: #ffd700; }
.ws-minimap-dot.aggro    { background: #ff3030; }
.ws-minimap-dot.item     { background: #ff6060; }
.ws-minimap-dot.resource { background: #60ff60; }

/* ---- Orbs (HP / Prayer / Run) ------------------------------- */

.ws-orb-stack {
  position: absolute;
  top: 10px;
  right: 210px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 71;
}

/* Round 3D orb with radial gradient body and recessed inset */
.ws-orb {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #6e4520 0%, #3a230c 60%, #0f0703 100%);
  border: 2px solid #b8893d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: var(--text-cream);
  text-shadow: 1px 1px 0 #000, 0 0 3px rgba(0,0,0,0.8);
  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.75),
    inset 0 1px 2px rgba(255,220,150,0.25),
    0 0 4px rgba(255,180,80,0.18),
    0 2px 4px rgba(0,0,0,0.55);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.ws-orb:hover {
  border-color: #e6b760;
  transform: scale(1.08);
  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.75),
    inset 0 1px 2px rgba(255,220,150,0.35),
    0 0 12px rgba(255,200,100,0.5),
    0 2px 4px rgba(0,0,0,0.55);
}

/* Liquid-fill effect inside the orb */
.ws-orb-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #d83838 0%, #8a1818 60%, #5c0808 100%);
  transition: height 0.25s ease;
  pointer-events: none;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.18);
}
.ws-orb.prayer .ws-orb-fill {
  background: linear-gradient(180deg, #5cb8f0 0%, #2560a0 60%, #143868 100%);
}
.ws-orb.run .ws-orb-fill {
  background: linear-gradient(180deg, #f0d860 0%, #a08020 60%, #604810 100%);
}

.ws-orb-label {
  position: relative;
  z-index: 2;
  letter-spacing: 0.3px;
}

/* ---- Right sidebar ------------------------------------------ */

.ws-sidebar {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: 220px;
  background:
    linear-gradient(180deg,
      #4a3018 0%,
      var(--panel-bg-hi) 30%,
      #2a1a08 70%,
      var(--panel-bg-lo) 100%);
  border: 2px solid var(--panel-border-hi);
  border-radius: 5px;
  box-shadow:
    0 0 18px rgba(0,0,0,0.7),
    0 4px 16px rgba(0,0,0,0.55),
    inset 0 0 12px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,220,150,0.2);
  display: flex;
  flex-direction: column;
  z-index: 65;
  overflow: hidden;
}

/* Tab row across the top of the sidebar */
.ws-sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: linear-gradient(180deg, #0e0702 0%, #1a0e04 100%);
  padding: 4px;
  border-bottom: 2px solid #5a3a18;
  box-shadow: inset 0 -1px 0 rgba(255,200,100,0.12);
}

.ws-tab-btn {
  background: linear-gradient(180deg, #4a2f14 0%, #2a1a08 100%);
  border: 1px solid #5a3a18;
  border-radius: 3px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: var(--text-mute);
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.08),
    inset 0 -1px 2px rgba(0,0,0,0.5);
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.05s;
}

.ws-tab-btn:hover {
  color: var(--text-cream);
  background: linear-gradient(180deg, #6e4420 0%, #3a230c 100%);
  border-color: #8b6a3b;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.18),
    inset 0 -1px 2px rgba(0,0,0,0.5);
}

/* Active tab — raised, glowing, gold-bordered */
.ws-tab-btn.active {
  background: linear-gradient(180deg, #a86a30 0%, #5e3a14 60%, #3a2208 100%);
  color: #ffe28a;
  border-color: #e6b760;
  font-weight: bold;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(255,200,100,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,230,160,0.4),
    inset 0 0 8px rgba(255,200,80,0.35),
    0 0 8px rgba(255,180,80,0.4),
    0 2px 4px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}

/* Sidebar content area (where active tab panel renders) */
.ws-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: #5a3a18 #1a0e04;
  background:
    linear-gradient(180deg,
      rgba(0,0,0,0.25) 0%,
      rgba(0,0,0,0.05) 4%,
      rgba(0,0,0,0) 100%);
}
.ws-sidebar-content::-webkit-scrollbar { width: 8px; }
.ws-sidebar-content::-webkit-scrollbar-track {
  background: #1a0e04;
  border-left: 1px solid #2a1a08;
}
.ws-sidebar-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6e4420, #3a230c);
  border-radius: 3px;
  border: 1px solid #2a1a08;
}
.ws-sidebar-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #8b5a28, #4a2f14);
}

.ws-tab-panel { display: none; }
.ws-tab-panel.active { display: block; }
.ws-tab-panel h3 {
  text-align: center;
  font-size: 14px;
  color: var(--text-gold);
  margin-bottom: 10px;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(255,180,80,0.35);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: bold;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(139,106,59,0.4);
}

/* ---- Inventory grid ----------------------------------------- */

.ws-inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px 2px;
}

/* Each slot — recessed dark cell with warm gold inset on hover */
.ws-inv-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(ellipse at 50% 30%, #1d130a 0%, #0e0904 100%);
  border: 1px solid #5a3a18;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-cream);
  text-shadow: 1px 1px 0 #000;
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.7),
    inset 0 -1px 0 rgba(255,200,100,0.06);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}

/* Filled slot — subtle dark backdrop under the icon */
.ws-inv-slot:not(.empty) {
  background:
    radial-gradient(ellipse at 50% 35%,
      rgba(80,55,25,0.5) 0%,
      rgba(20,12,4,0.95) 70%);
  border-color: #6a4520;
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.6),
    inset 0 0 8px rgba(139,106,59,0.18),
    inset 0 -1px 0 rgba(255,200,100,0.08);
}

.ws-inv-slot:hover {
  border-color: #e6b760;
  background:
    radial-gradient(ellipse at 50% 30%, #3a2510 0%, #150c05 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,200,100,0.35),
    inset 0 0 10px rgba(255,180,80,0.2),
    0 0 8px rgba(255,180,80,0.3);
}

.ws-inv-slot.empty { color: transparent; }

.ws-inv-slot .icon {
  width: 70%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 2px rgba(0,0,0,0.45);
}

/* Quantity number — bigger, drop-shadowed, color-tiered */
.ws-inv-qty {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 11px;
  font-weight: bold;
  color: #ffffff;
  text-shadow:
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000,
    0 0 3px rgba(0,0,0,0.9);
  pointer-events: none;
  letter-spacing: 0.3px;
}
.ws-inv-qty.med {
  color: #ffd700;
  text-shadow:
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000,
    0 0 4px rgba(255,180,0,0.5);
}
.ws-inv-qty.big {
  color: #50ee50;
  text-shadow:
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000,
    0 0 4px rgba(80,238,80,0.55);
}

/* ---- Stats grid --------------------------------------------- */

.ws-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 2px;
}

/* Each skill cell — left-color stripe + name + level + xp bar */
.ws-stat-cell {
  position: relative;
  background:
    linear-gradient(180deg, #1f1409 0%, #0e0904 100%);
  border: 1px solid #5a3a18;
  border-radius: 2px;
  padding: 5px 4px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-cream);
  box-shadow:
    inset 0 1px 0 rgba(255,200,100,0.06),
    inset 0 -1px 2px rgba(0,0,0,0.5);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
.ws-stat-cell:hover {
  border-color: #e6b760;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.15),
    inset 0 0 8px rgba(255,180,80,0.18),
    0 0 6px rgba(255,180,80,0.25);
  transform: translateY(-1px);
}

.ws-stat-name {
  font-size: 9px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: bold;
  text-shadow: 1px 1px 0 #000;
}

.ws-stat-level {
  font-size: 14px;
  font-weight: bold;
  color: var(--text-gold);
  text-shadow: 1px 1px 0 #000, 0 0 4px rgba(255,180,80,0.4);
  margin-top: 1px;
  letter-spacing: 0.3px;
}

/* XP bar at bottom of cell */
.ws-stat-xp-bar {
  width: 100%;
  height: 4px;
  background: #0a0502;
  border: 1px solid #2a1a08;
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.7);
}
.ws-stat-xp-fill {
  height: 100%;
  background: linear-gradient(90deg,
    #6abf4e 0%,
    #b8d040 50%,
    #ffd700 100%);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 0 4px rgba(255,200,80,0.4);
}

.ws-stats-total {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-gold);
  border-top: 1px solid rgba(139,106,59,0.5);
  padding-top: 10px;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 0.5px;
}
.ws-stats-total b {
  color: var(--text-cream);
  font-size: 15px;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(255,180,80,0.35);
}

/* ---- Chat box ----------------------------------------------- */

.ws-chat-box {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 520px;
  max-width: calc(100vw - 240px);
  height: 168px;
  background:
    linear-gradient(180deg,
      rgba(50, 30, 14, 0.92) 0%,
      rgba(30, 18, 8, 0.94) 50%,
      rgba(18, 10, 4, 0.95) 100%);
  border: 2px solid var(--panel-border-hi);
  border-radius: 4px;
  box-shadow:
    0 0 14px rgba(0,0,0,0.7),
    0 4px 16px rgba(0,0,0,0.55),
    inset 0 0 12px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,220,150,0.2);
  display: flex;
  flex-direction: column;
  z-index: 65;
}

/* Message log — scroll fade at top via gradient mask */
.ws-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 6px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  scrollbar-width: thin;
  scrollbar-color: #5a3a18 #1a0e04;
  -webkit-mask-image: linear-gradient(180deg,
    transparent 0%,
    #000 14px,
    #000 100%);
  mask-image: linear-gradient(180deg,
    transparent 0%,
    #000 14px,
    #000 100%);
}
.ws-chat-messages::-webkit-scrollbar { width: 8px; }
.ws-chat-messages::-webkit-scrollbar-track { background: #1a0e04; }
.ws-chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6e4420, #3a230c);
  border-radius: 3px;
}

.ws-chat-msg {
  margin: 1px 0;
  word-wrap: break-word;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.85);
}
.ws-chat-msg .ts {
  color: #6a5538;
  font-size: 11px;
  margin-right: 5px;
  font-weight: normal;
}

/* Color hierarchy: yellow=system, white=public/game, cyan=private,
   red=warning, green=friend */
.ws-chat-msg.system  { color: #ffd700; font-weight: bold; }
.ws-chat-msg.game    { color: #ffffff; }
.ws-chat-msg.public  { color: #ffffff; }
.ws-chat-msg.private { color: #60d8ff; }
.ws-chat-msg.warning { color: #ff5050; font-weight: bold; }
.ws-chat-msg.friend  { color: #60ff60; }

/* Tab row at the bottom of the chat box */
.ws-chat-tabs {
  display: flex;
  gap: 2px;
  background: linear-gradient(180deg, #0e0702 0%, #1a0e04 100%);
  padding: 4px;
  border-top: 2px solid #5a3a18;
  box-shadow: inset 0 1px 0 rgba(255,200,100,0.12);
}
.ws-chat-tab {
  flex: 1;
  background: linear-gradient(180deg, #4a2f14 0%, #2a1a08 100%);
  border: 1px solid #5a3a18;
  border-radius: 2px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: var(--text-mute);
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 0.3px;
  box-shadow:
    inset 0 1px 0 rgba(255,220,150,0.08),
    inset 0 -1px 2px rgba(0,0,0,0.45);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ws-chat-tab:hover {
  color: var(--text-cream);
  background: linear-gradient(180deg, #6e4420 0%, #3a230c 100%);
  border-color: #8b6a3b;
}
.ws-chat-tab.active {
  background: linear-gradient(180deg, #a86a30 0%, #5e3a14 60%, #3a2208 100%);
  color: #ffe28a;
  border-color: #e6b760;
  text-shadow: 1px 1px 0 #000, 0 0 5px rgba(255,200,100,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,230,160,0.4),
    inset 0 0 6px rgba(255,200,80,0.3),
    0 0 6px rgba(255,180,80,0.35);
}

/* ---- Right-click context menu ------------------------------- */

.ws-context-menu {
  position: fixed;
  z-index: 200;
  min-width: 160px;
  background:
    linear-gradient(180deg,
      rgba(40, 24, 10, 0.97) 0%,
      rgba(20, 12, 4, 0.97) 100%);
  border: 2px solid var(--panel-border-hi);
  border-radius: 3px;
  padding: 0;
  font-size: 13px;
  color: var(--text-cream);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.92),
    0 2px 8px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,220,150,0.2);
  font-family: 'Trebuchet MS', Tahoma, sans-serif;
  overflow: hidden;
}
.ws-context-menu.hidden { display: none; }

.ws-context-header {
  padding: 5px 14px;
  background: linear-gradient(180deg, #6e4420 0%, #3a230c 100%);
  color: var(--text-gold);
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid #8b6a3b;
  text-shadow: 1px 1px 0 #000, 0 0 4px rgba(255,180,80,0.4);
  letter-spacing: 0.5px;
  box-shadow: inset 0 1px 0 rgba(255,220,150,0.18);
}

.ws-context-item {
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  display: block;
  position: relative;
  transition: background 0.08s, padding-left 0.08s;
}

/* Hover row — gold underline + brighter background */
.ws-context-item:hover {
  background: rgba(255, 200, 80, 0.22);
  padding-left: 18px;
}
.ws-context-item:hover::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,215,0,0.7) 50%,
    transparent 100%);
}

/* Color-coded action types */
.ws-context-item.yellow { color: #ffd700; }
.ws-context-item.cyan   { color: #60d8ff; }
.ws-context-item.orange { color: #ff9930; }
.ws-context-item.white  { color: #ffffff; }
.ws-context-item.red    { color: #ff5050; }

/* Cancel row (always last) — visually de-emphasized */
.ws-context-item:last-child {
  color: #998060;
  border-top: 1px solid rgba(139,106,59,0.4);
  font-style: italic;
  font-size: 12px;
  background: rgba(0,0,0,0.25);
}
.ws-context-item:last-child:hover {
  background: rgba(255, 100, 100, 0.18);
  color: #ffb098;
}
.ws-context-item:last-child:hover::after { display: none; }

/* ---- Hit splats --------------------------------------------- */

.ws-hitsplat {
  position: fixed;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Trebuchet MS', Tahoma, sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: #ffffff;
  text-shadow:
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000;
  pointer-events: none;
  z-index: 80;
  transform: translate(-50%, -50%);
  animation: ws-hitsplat-anim 800ms ease-out forwards;
}
.ws-hitsplat.damage {
  background: radial-gradient(circle, #e83838 0%, #7a1010 70%, transparent 100%);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(232,56,56,0.5);
}
.ws-hitsplat.miss {
  background: #2050a0;
  border: 1px solid #4080d0;
  border-radius: 2px;
  font-size: 11px;
  box-shadow: 0 0 4px rgba(64,128,208,0.4);
}
.ws-hitsplat.heal {
  background: radial-gradient(circle, #50e050 0%, #1a6e1a 70%, transparent 100%);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(80,224,80,0.5);
}

@keyframes ws-hitsplat-anim {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  80%  { opacity: 1; transform: translate(-50%, -90%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(0.95); }
}

/* ---- Click-to-move tile marker ------------------------------ */

.ws-click-marker {
  position: fixed;
  width: 36px;
  height: 36px;
  pointer-events: none;
  z-index: 75;
  transform: translate(-50%, -50%);
  border: 2px solid #00ffff;
  border-radius: 2px;
  box-shadow:
    0 0 10px #00ffff,
    0 0 20px rgba(0,255,255,0.5),
    inset 0 0 8px rgba(0,255,255,0.45);
  animation: ws-click-fade 600ms ease-out forwards;
}

@keyframes ws-click-fade {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
}

/* ---- Tooltip (item / skill hover) --------------------------- */

.ws-tooltip {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(40, 24, 10, 0.96) 0%,
      rgba(20, 12, 4, 0.96) 100%);
  border: 1px solid var(--panel-border-hi);
  border-radius: 3px;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--text-cream);
  max-width: 240px;
  text-shadow: 1px 1px 0 #000;
  box-shadow:
    0 6px 16px rgba(0,0,0,0.75),
    inset 0 1px 0 rgba(255,220,150,0.2);
}
.ws-tooltip.hidden { display: none; }

/* ---- Responsive — small screens ----------------------------- */

@media (max-width: 720px) {
  .ws-sidebar { width: 180px; }
  .ws-chat-box { width: 320px; height: 130px; }
  .ws-top-right-cluster { right: 200px; }
  .ws-orb-stack { right: 175px; }
}
