/* ══════════════════════════════════════════
   ClanMMO — Albion Online dark theme
   ══════════════════════════════════════════ */

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0806;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #c8b89a;
  font-size: 13px;
}

.hidden { display: none !important; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(180,140,60,0.4); border-radius: 2px; }
* { scrollbar-width: thin; scrollbar-color: rgba(180,140,60,0.4) transparent; }

/* ══════════ VARIABLES ══════════ */
:root {
  --gold:        #ffd700;
  --gold-dim:    rgba(180,140,60,0.6);
  --gold-hover:  rgba(180,140,60,0.9);
  --panel-bg:    rgba(15,12,8,0.92);
  --panel-bg2:   rgba(20,16,10,0.95);
  --text:        #c8b89a;
  --text-dim:    #7a6e5e;
  --border:      1px solid var(--gold-dim);
  --radius:      4px;
}

/* ══════════ LOGIN SCREEN ══════════ */

#login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1208 0%, #06040a 100%);
  z-index: 100;
}

.login-box {
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8), inset 0 1px 0 rgba(180,140,60,0.15);
}

.login-title {
  font-size: 2rem; font-weight: 700;
  text-align: center; color: var(--gold);
  letter-spacing: 0.08em; margin-bottom: 0.2rem;
  text-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.login-sub {
  text-align: center; font-size: 0.75rem;
  color: var(--text-dim); margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.tab-row {
  display: flex; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--gold-dim);
}

.tab-btn {
  flex: 1; background: none; border: none;
  padding: 0.6rem; color: var(--text-dim); cursor: pointer;
  font-size: 0.82rem; transition: color 0.2s;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-btn:hover { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }

.auth-form input {
  background: rgba(255,255,255,0.04);
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem; color: var(--text);
  font-size: 0.88rem; outline: none; transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--gold); }
.auth-form input::placeholder { color: var(--text-dim); font-size: 0.78rem; }

.class-label { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }

.class-select { display: flex; gap: 6px; }

.class-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 4px;
  background: rgba(255,255,255,0.03);
  border: var(--border); border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer;
  transition: all 0.15s; font-size: 0.72rem;
}
.class-btn:hover { background: rgba(180,140,60,0.08); color: var(--text); }
.class-btn.active {
  border-color: var(--gold); color: var(--gold);
  background: rgba(180,140,60,0.12);
}
.class-icon { font-size: 1.1rem; }
.class-name { font-weight: 600; font-size: 0.78rem; }
.class-desc { font-size: 0.62rem; color: var(--text-dim); text-align: center; }
.class-btn.active .class-desc { color: #a08040; }

.btn-primary {
  background: linear-gradient(180deg, #b8860b 0%, #8b6508 100%);
  color: #1a1000;
  border: 1px solid #d4a017; border-radius: var(--radius);
  padding: 0.7rem; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s; margin-top: 0.25rem;
  letter-spacing: 0.04em;
}
.btn-primary:hover { background: linear-gradient(180deg, #d4a017 0%, #b8860b 100%); }
.btn-primary:active { background: linear-gradient(180deg, #8b6508 0%, #6b4e08 100%); }

.error-msg { color: #cc4444; font-size: 0.78rem; min-height: 1.1em; text-align: center; }

/* ══════════ GAME CONTAINER ══════════ */

#game-container { position: fixed; inset: 0; display: block; }
#phaser-game { position: absolute; inset: 0; }
#phaser-game canvas { display: block; }

/* ══════════ PANEL BASE ══════════ */

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-dim);
  margin-bottom: 10px;
}

.panel-title {
  font-size: 0.88rem; font-weight: 700;
  color: var(--gold); letter-spacing: 0.06em;
}

.btn-close {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 0.85rem; padding: 2px 4px;
  transition: color 0.15s;
}
.btn-close:hover { color: var(--gold); }

/* ══════════ PORTAL STABILITY (haut-droite) ══════════ */

#portal-stability {
  position: absolute; top: 12px; right: 12px;
  z-index: 10;
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  backdrop-filter: blur(6px);
  user-select: none;
  transition: border-color 0.4s, box-shadow 0.4s;
  min-width: 160px;
}

#portal-stability-icon {
  font-size: 13px;
  flex-shrink: 0;
}

#portal-stability-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

#portal-stability-bar-wrap {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}

#portal-stability-bar {
  height: 100%;
  width: 80%;
  background: #55cc55;
  border-radius: 3px;
  transition: width 0.8s ease, background 0.8s ease;
}

#portal-stability-pct {
  font-size: 11px;
  font-weight: 700;
  color: #55cc55;
  min-width: 32px;
  text-align: right;
  transition: color 0.4s;
  font-family: monospace;
}

/* État Portes s'agitent */
#portal-stability.level-agite {
  border-color: rgba(212,200,68,0.5);
}

/* État Flux Noir */
#portal-stability.level-corrompu {
  border-color: rgba(224,112,32,0.6);
}

/* État Alerte — pulsation */
#portal-stability.level-alerte {
  border-color: rgba(204,34,34,0.7);
  box-shadow: 0 0 10px rgba(204,34,34,0.25);
  animation: stability-pulse 1.5s ease-in-out infinite;
}

@keyframes stability-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(204,34,34,0.3); }
  50%       { box-shadow: 0 0 18px rgba(204,34,34,0.6); }
}

/* ══════════ PLAYER PANEL (haut-gauche) ══════════ */

#player-panel {
  position: absolute; top: 12px; left: 12px;
  z-index: 10;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-width: 220px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

#player-portrait-wrap {
  flex-shrink: 0;
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  overflow: hidden;
  width: 64px; height: 64px;
}

#player-portrait {
  display: block; width: 64px; height: 64px;
  image-rendering: pixelated;
}

#player-info {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}

.player-name {
  font-size: 0.9rem; font-weight: 700;
  color: var(--gold); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

.player-class {
  font-size: 0.75rem; font-weight: 600;
}

#player-stats {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 0.72rem; color: var(--text-dim);
  margin-top: 2px;
}

#player-stats span { white-space: nowrap; }

.player-gold {
  font-size: 0.75rem; color: var(--gold);
  margin-top: 2px;
}

.btn-logout {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 0.78rem; padding: 2px 4px;
  transition: color 0.15s;
}
.btn-logout:hover { color: #cc4444; }

/* ══════════ HUD BAS CENTRE ══════════ */

#hud-bottom {
  position: absolute; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 500px;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

#hud-level {
  font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.04em;
  align-self: flex-start;
}

#hud-level-num {
  font-size: 1.1rem; font-weight: 700; color: var(--gold);
  margin-left: 2px;
}

#hud-bars {
  width: 100%; display: flex; flex-direction: column; gap: 5px;
}

#hp-bar-wrap, #xp-bar-wrap {
  position: relative; width: 100%;
}

.bar-bg {
  width: 100%; border-radius: 3px; overflow: hidden;
}

.hp-bg  { height: 18px; background: #3a0a0a; border: 1px solid #5a1010; }
.xp-bg  { height: 10px; background: #2a1e00; border: 1px solid #4a3800; }

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

#hp-bar  { background: linear-gradient(90deg, #8b0000, #cc2200); }
#xp-bar  { background: linear-gradient(90deg, #7a5c00, #c8960c); }

.bar-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem; font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
  pointer-events: none; white-space: nowrap;
}

#hotbar {
  display: flex; gap: 5px; margin-top: 4px;
}

.hotbar-slot {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  position: relative; cursor: default;
  transition: border-color 0.15s;
}

.hotbar-slot:hover { border-color: var(--gold); }

.hotbar-slot .hotbar-icon {
  font-size: 1.3rem; line-height: 1;
}

.hotbar-key {
  position: absolute; top: 2px; left: 4px;
  font-size: 0.58rem; color: var(--text-dim);
  line-height: 1;
}

/* ══════════ MINIMAP ══════════ */

#minimap-wrap {
  position: absolute; bottom: 100px; right: 14px;
  z-index: 10;
  background: var(--panel-bg);
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}

#minimap-wrap.collapsed {
  width: 180px; height: 180px;
}

#minimap-wrap.expanded {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  bottom: auto; right: auto;
  width: 400px; height: 460px;
  z-index: 200;
  border-color: var(--gold);
}

#minimap-canvas {
  position: absolute;
  border-radius: 2px;
  cursor: crosshair;
}

#minimap-wrap.collapsed #minimap-canvas {
  top: 10px; left: 10px;
  width: 160px; height: 160px;
}

#minimap-wrap.expanded #minimap-canvas {
  top: 38px; left: 10px;
  width: 380px; height: 340px;
}

/* En-tête en mode agrandi */
#minimap-header {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 34px;
  line-height: 34px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(0,0,0,0.6);
  letter-spacing: 1px;
  z-index: 3;
  pointer-events: none;
}
#minimap-wrap.expanded #minimap-header { display: block; }

#minimap-compass {
  position: absolute; z-index: 2;
  pointer-events: none;
}

#minimap-wrap.collapsed #minimap-compass { inset: 0; }
#minimap-wrap.expanded #minimap-compass { top: 38px; left: 10px; width: 380px; height: 340px; }

.compass-n, .compass-s, .compass-e, .compass-o {
  position: absolute;
  font-size: 0.58rem; color: var(--gold);
  font-weight: 700; letter-spacing: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.compass-n { top: 1px;  left: 50%; transform: translateX(-50%); }
.compass-s { bottom: 1px; left: 50%; transform: translateX(-50%); }
.compass-e { right: 2px; top: 50%; transform: translateY(-50%); }
.compass-o { left: 2px;  top: 50%; transform: translateY(-50%); }

/* Bouton toggle minimap */
#minimap-toggle {
  position: absolute;
  z-index: 3;
  width: 22px; height: 22px;
  background: rgba(20,20,25,0.85);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  color: var(--gold);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
  padding: 0;
}
#minimap-toggle:hover { background: var(--gold); color: #0a0806; }
#minimap-wrap.collapsed #minimap-toggle { bottom: 4px; right: 4px; }
#minimap-wrap.expanded #minimap-toggle { top: 6px; right: 6px; }

/* Légende mode agrandi */
#minimap-legend {
  position: absolute;
  bottom: 6px;
  left: 10px; right: 10px;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  padding: 6px 8px;
  background: rgba(0,0,0,0.55);
  border-radius: 6px;
  display: none;
}
#minimap-wrap.expanded #minimap-legend { display: flex; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-main);
}

.legend-icon {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.legend-icon.player { background: #ffffff; box-shadow: 0 0 4px #fff; }
.legend-icon.village { background: #ffffff; }
.legend-icon.resource { background: #44aa44; }
.legend-icon.mob { background: #cc2200; }
.legend-icon.boss { background: linear-gradient(45deg, #ff4400, #ff8800); }

/* Coordonnées en mode agrandi */
#minimap-coords {
  display: none;
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 10px;
  color: var(--gold);
  font-family: monospace;
  z-index: 3;
  pointer-events: none;
}
#minimap-wrap.expanded #minimap-coords { display: block; }

/* Overlay backdrop (expanded) */
#minimap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  cursor: pointer;
}

/* Clignotement joueur */
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ══════════ QUEST TRACKER (droite) ══════════ */

#quest-tracker {
  position: absolute; top: 12px; right: 14px;
  z-index: 10;
  width: 200px;
  max-height: 45vh;
  overflow-y: auto;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.qt-title {
  font-size: 0.68rem; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(180,140,60,0.25);
}

.qt-quest {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.qt-quest:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.qt-quest.qt-complete .qt-name { color: #55cc55; }

.qt-name {
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  margin-bottom: 3px;
}

.qt-obj {
  font-size: 0.68rem; color: var(--text-dim);
  padding-left: 12px;
  margin-bottom: 1px;
  display: flex; justify-content: space-between;
}

.qt-obj.qt-obj-done { color: #55cc55; }

.qt-count {
  font-weight: 600; font-variant-numeric: tabular-nums;
  color: #cc8844;
}

.qt-obj-done .qt-count { color: #55cc55; }

.qt-ready {
  font-size: 0.65rem; color: #55cc55;
  font-style: italic; padding-left: 12px;
  margin-top: 2px;
}

/* ══════════ CONTROLS HINT ══════════ */

#controls-hint {
  position: absolute; bottom: 14px; right: 14px;
  z-index: 10;
  font-size: 0.65rem; color: var(--text-dim);
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  white-space: nowrap;
}

/* ══════════ INVENTORY PANEL ══════════ */

#inventory-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
  width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85),
              inset 0 1px 0 rgba(180,140,60,0.1);
}

#inv-body {
  display: flex; gap: 12px;
}

#inv-left { flex: 1; }

#inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.inv-slot {
  width: 50px; height: 50px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 0.58rem; color: var(--text-dim);
  cursor: default; position: relative; overflow: hidden;
  transition: border-color 0.12s, background 0.12s;
}

.inv-slot.has-item {
  border-color: rgba(180,140,60,0.45);
  background: rgba(180,140,60,0.07);
  cursor: pointer;
}
.inv-slot.has-item:hover {
  border-color: var(--gold);
  background: rgba(180,140,60,0.14);
}

.inv-icon { font-size: 1.3rem; line-height: 1; }
.inv-name {
  font-size: 0.55rem; color: #b0a080;
  text-align: center; line-height: 1.2;
  padding: 0 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.inv-qty {
  position: absolute; bottom: 2px; right: 3px;
  font-size: 0.6rem; color: var(--gold); font-weight: 700;
  background: rgba(0,0,0,0.7); padding: 0 2px; border-radius: 2px;
  line-height: 1.3;
}

.inv-hint {
  margin-top: 8px; font-size: 0.62rem; color: var(--text-dim); text-align: center;
}

/* ── Right side : equipment slots ── */

#inv-right {
  width: 110px; flex-shrink: 0;
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.equip-slot-label {
  font-size: 0.6rem; color: var(--text-dim); margin-top: 6px; margin-bottom: 2px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.equip-slot {
  min-height: 32px;
  background: rgba(180,140,60,0.07);
  border: 1px solid rgba(180,140,60,0.35);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 0.68rem; color: var(--text);
  padding: 2px 6px; text-align: center;
  line-height: 1.3;
  overflow: hidden;
}

.equip-stat-line {
  font-size: 0.62rem;
  color: #88dd88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.equip-empty {
  color: var(--text-dim); font-size: 0.65rem;
  background: rgba(255,255,255,0.02);
  border-color: rgba(180,140,60,0.15);
}

.inv-section-title {
  font-size: 0.65rem; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
}

/* ══════════ CRAFTING PANEL ══════════ */

#crafting-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
  width: 480px; max-height: 75vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85),
              inset 0 1px 0 rgba(180,140,60,0.1);
}

#crafting-body {
  display: flex; gap: 10px;
  height: 380px;
}

#crafting-list {
  width: 180px; flex-shrink: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  padding-right: 4px;
}

#crafting-detail {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
  padding: 10px;
  overflow-y: auto;
}

.craft-detail-hint {
  color: var(--text-dim); font-size: 0.72rem;
  text-align: center; margin-top: 40%;
}

/* Recipe list items */
.craft-list-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  cursor: pointer; transition: all 0.12s;
}
.craft-list-item:hover {
  background: rgba(180,140,60,0.08);
  border-color: rgba(180,140,60,0.4);
}
.craft-list-item.active {
  background: rgba(180,140,60,0.12);
  border-color: var(--gold);
}
.craft-list-item.can-craft-item {
  border-color: rgba(80,160,80,0.4);
}
.craft-list-item.can-craft-item:hover,
.craft-list-item.can-craft-item.active {
  border-color: #4aaa4a;
}

.craft-list-icon { font-size: 1.1rem; flex-shrink: 0; }
.craft-list-name { font-size: 0.75rem; color: var(--text); flex: 1; min-width: 0; }
.craft-list-check { font-size: 0.7rem; color: #4aaa4a; }

/* Recipe detail */
.craft-det-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.craft-det-icon { font-size: 1.6rem; }
.craft-det-nom { font-size: 0.9rem; font-weight: 700; color: var(--gold); }
.craft-det-desc { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 10px; }

.craft-det-ing-title {
  font-size: 0.65rem; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px;
}

.craft-ing-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; font-size: 0.78rem;
}
.craft-ing-row .ing-icon { font-size: 1rem; }
.craft-ing-row .ing-label { flex: 1; }
.craft-ing-row .ing-count { font-weight: 600; }
.ing-ok    { color: #55cc55; }
.ing-missing { color: #cc4444; }

.craft-forge-btn {
  margin-top: 12px; width: 100%;
  background: linear-gradient(180deg, #7a5c00 0%, #5a4000 100%);
  color: var(--gold); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 8px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
  letter-spacing: 0.05em; transition: all 0.15s;
}
.craft-forge-btn:hover {
  background: linear-gradient(180deg, #c8960c 0%, #9a7000 100%);
  color: #1a1000;
}
.craft-forge-btn:disabled {
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  border-color: rgba(255,255,255,0.1);
  cursor: default;
}

/* Legacy compat */
.craft-recipe { display: none; }

/* ══════════ BUFF TIMERS ══════════ */

#buff-timers {
  position: absolute; top: 90px; left: 12px; z-index: 10;
  display: flex; flex-direction: column; gap: 4px;
}

.buff-tag {
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 0.7rem; color: #ffaa44;
  backdrop-filter: blur(4px);
}

/* ══════════ CHAT ══════════ */

#chat-container {
  position: absolute; bottom: 14px; left: 14px;
  width: 320px; z-index: 10;
  display: flex; flex-direction: column;
}

#chat-tabs {
  display: flex; gap: 0;
}

.chat-tab {
  flex: 1; background: rgba(15,12,8,0.7);
  border: var(--border); border-bottom: none;
  border-radius: 3px 3px 0 0;
  padding: 4px 6px; color: var(--text-dim);
  font-size: 0.7rem; cursor: pointer;
  transition: all 0.15s;
}
.chat-tab + .chat-tab { border-left: none; }
.chat-tab.active { background: rgba(15,12,8,0.95); color: var(--gold); }
.chat-tab:hover:not(.active) { color: var(--text); }

#chat-messages {
  background: rgba(10,8,4,0.88);
  border: var(--border); border-top: none;
  padding: 8px; height: 130px;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 3px;
  backdrop-filter: blur(4px);
}

.chat-msg { font-size: 0.75rem; line-height: 1.4; word-break: break-word; color: #b8a888; }
.chat-msg.system { color: #ccaa22; font-style: italic; }
.chat-msg.whisper { color: #c080d8; }
.chat-user { font-weight: 600; color: #7ab4e0; }

#chat-input-row { display: flex; }

#chat-input {
  flex: 1;
  background: rgba(10,8,4,0.9);
  border: var(--border); border-top: none; border-right: none;
  border-radius: 0 0 0 var(--radius);
  padding: 5px 8px; color: var(--text);
  font-size: 0.78rem; outline: none;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: var(--gold); }
#chat-input::placeholder { color: var(--text-dim); font-size: 0.72rem; }

#chat-send {
  background: rgba(10,8,4,0.9);
  border: var(--border); border-top: none; border-left: none;
  border-radius: 0 0 var(--radius) 0;
  padding: 5px 10px; color: var(--gold);
  font-size: 0.9rem; cursor: pointer;
  transition: background 0.15s;
}
#chat-send:hover { background: rgba(180,140,60,0.12); }

/* ══════════ TOOLTIP ══════════ */

#item-tooltip {
  position: fixed; z-index: 200;
  background: rgba(8,6,3,0.96);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  max-width: 200px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
}

.tooltip-name { font-size: 0.82rem; font-weight: 700; color: var(--gold); margin-bottom: 3px; }
.tooltip-desc { font-size: 0.72rem; color: var(--text-dim); }
.tooltip-stat { font-size: 0.72rem; color: #88dd88; margin-top: 2px; }
.tooltip-compare { font-size: 0.72rem; margin-top: 4px; font-style: italic; }

/* ══════════ QUEST JOURNAL ══════════ */

#quest-journal {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
  width: 520px; max-height: 75vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85),
              inset 0 1px 0 rgba(180,140,60,0.1);
}

#quest-journal-body {
  display: flex; gap: 10px;
  height: 360px;
}

#quest-list {
  width: 180px; flex-shrink: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  padding-right: 4px;
}

#quest-detail {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
  padding: 10px;
  overflow-y: auto;
}

.quest-empty {
  color: var(--text-dim); font-size: 0.75rem;
  text-align: center; margin-top: 40%;
}

.quest-detail-hint {
  color: var(--text-dim); font-size: 0.72rem;
  text-align: center; margin-top: 40%;
}

.quest-list-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  cursor: pointer; transition: all 0.12s;
  font-size: 0.75rem; color: var(--text);
}
.quest-list-item:hover {
  background: rgba(180,140,60,0.08);
  border-color: rgba(180,140,60,0.4);
}
.quest-list-item.active {
  background: rgba(180,140,60,0.12);
  border-color: var(--gold);
}
.quest-list-item.quest-ready {
  border-color: rgba(80,200,80,0.5);
}
.quest-list-item.quest-ready.active {
  border-color: #4aaa4a;
}

.quest-list-icon {
  font-size: 0.7rem; flex-shrink: 0; width: 16px; text-align: center;
  color: var(--gold);
}
.quest-list-item.quest-ready .quest-list-icon { color: #4aaa4a; }
.quest-list-name { flex: 1; min-width: 0; }

.quest-det-header {
  font-size: 0.92rem; font-weight: 700; color: var(--gold);
  margin-bottom: 6px;
}

.quest-det-desc {
  font-size: 0.72rem; color: var(--text-dim);
  margin-bottom: 10px; line-height: 1.5;
}

.quest-det-section {
  font-size: 0.65rem; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 6px; margin-top: 8px;
}

.quest-obj {
  font-size: 0.78rem; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.quest-obj.obj-done { color: #55cc55; }
.quest-obj.obj-pending { color: var(--text); }
.quest-obj-count {
  margin-left: auto; font-weight: 600; font-size: 0.72rem;
}
.obj-done .quest-obj-count { color: #55cc55; }
.obj-pending .quest-obj-count { color: #cc8844; }

.quest-rewards-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 4px;
}

.reward-item {
  font-size: 0.75rem; color: var(--text);
  background: rgba(180,140,60,0.08);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
  padding: 3px 8px;
}

.quest-ready-hint {
  margin-top: 12px; font-size: 0.75rem; color: #55cc55;
  font-weight: 600; text-align: center;
}

/* ── Quest tabs ── */
#quest-tabs {
  display: flex; gap: 4px; margin-bottom: 8px;
}
.quest-tab {
  flex: 1; padding: 5px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: var(--radius);
  color: var(--text-dim); font-size: 0.72rem;
  cursor: pointer; transition: all 0.12s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.quest-tab:hover { background: rgba(180,140,60,0.07); color: var(--text); }
.quest-tab-active {
  background: rgba(180,140,60,0.12);
  border-color: var(--gold);
  color: var(--gold); font-weight: 600;
}
.quest-tab-badge {
  background: var(--gold); color: #000;
  border-radius: 9px; padding: 1px 6px;
  font-size: 0.65rem; font-weight: 700; line-height: 1.5;
}

/* ── Available quest items ── */
.quest-available-item .quest-list-icon { color: #aaddff; }
.quest-available-item { border-color: rgba(100,160,220,0.2); }
.quest-available-item:hover { border-color: rgba(100,160,220,0.5); }
.quest-available-item.active { border-color: #aaddff; background: rgba(100,160,220,0.08); }

/* ── Accept button ── */
.btn-accept-quest {
  display: block; width: 100%; margin-top: 14px;
  padding: 8px 0;
  background: rgba(180,140,60,0.15);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--gold); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-accept-quest:hover {
  background: rgba(180,140,60,0.3);
}

.quest-det-level {
  font-size: 0.68rem; color: var(--text-dim); margin-bottom: 6px;
}

/* ══════════ NPC DIALOGUE ══════════ */

#npc-dialogue {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 14px;
  width: 440px; max-height: 80vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85),
              inset 0 1px 0 rgba(180,140,60,0.1);
}

#npc-dialogue-text {
  font-size: 0.82rem; color: var(--text);
  line-height: 1.6; margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: var(--radius);
  font-style: italic;
}

#npc-quest-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 10px;
}

.npc-quest-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  cursor: pointer; transition: all 0.12s;
}
.npc-quest-item:hover {
  background: rgba(180,140,60,0.08);
  border-color: rgba(180,140,60,0.5);
}

.npc-quest-name { font-size: 0.78rem; color: var(--text); font-weight: 600; }

.npc-quest-tag {
  font-size: 0.62rem; font-weight: 700;
  padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.npc-quest-tag.available { background: rgba(80,160,80,0.15); color: #55cc55; border: 1px solid rgba(80,160,80,0.3); }
.npc-quest-tag.active    { background: rgba(200,150,30,0.15); color: #ccaa22; border: 1px solid rgba(200,150,30,0.3); }
.npc-quest-tag.ready     { background: rgba(80,200,80,0.2);   color: #44ee44; border: 1px solid rgba(80,200,80,0.4); }
.npc-quest-tag.completed { background: rgba(100,100,100,0.15);color: #888; border: 1px solid rgba(100,100,100,0.3); }

#npc-quest-detail {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: var(--radius);
  padding: 10px;
}

#npc-quest-title {
  font-size: 0.88rem; font-weight: 700; color: var(--gold);
  margin-bottom: 4px;
}

#npc-quest-desc {
  font-size: 0.72rem; color: var(--text-dim);
  margin-bottom: 8px; line-height: 1.5;
}

#npc-quest-objectives {
  margin-bottom: 8px;
}

#npc-quest-rewards {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}

#npc-quest-actions {
  display: flex; gap: 8px; justify-content: center;
}

.quest-accept-btn, .quest-complete-btn {
  background: linear-gradient(180deg, #4a8c3a 0%, #2e6620 100%);
  color: #e0ffe0;
  border: 1px solid #55aa44;
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 0.82rem; font-weight: 700;
  cursor: pointer; letter-spacing: 0.04em;
  transition: all 0.15s;
}
.quest-accept-btn:hover, .quest-complete-btn:hover {
  background: linear-gradient(180deg, #5aaa4a 0%, #3a8830 100%);
}

.quest-complete-btn {
  background: linear-gradient(180deg, #b8860b 0%, #8b6508 100%);
  color: #1a1000;
  border-color: #d4a017;
}
.quest-complete-btn:hover {
  background: linear-gradient(180deg, #d4a017 0%, #b8860b 100%);
}

.quest-progress-hint {
  font-size: 0.72rem; color: var(--text-dim);
  font-style: italic; text-align: center;
  padding: 6px;
}

/* ══════════ GROUP FRAME ══════════ */

#group-frame {
  position: absolute; top: 12px; right: 210px;
  z-index: 10;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-width: 180px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.group-header {
  font-size: 0.72rem; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}

.group-member {
  margin-bottom: 6px;
}

.gm-name {
  font-size: 0.78rem; font-weight: 700;
}

.gm-info {
  font-size: 0.62rem; color: var(--text-dim);
  margin-bottom: 2px;
}

.gm-hp-bar-wrap {
  position: relative; height: 12px;
  background: #3a0a0a; border: 1px solid #5a1010;
  border-radius: 2px; overflow: hidden;
}

.gm-hp-bar {
  height: 100%;
  background: linear-gradient(90deg, #8b0000, #cc2200);
  border-radius: 2px;
  transition: width 0.2s;
}

.gm-hp-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.58rem; font-weight: 600;
  color: rgba(255,255,255,0.8);
  text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
  pointer-events: none;
}

/* ── Group invite area ── */
#group-invite-area {
  position: absolute; top: 92px; left: 12px;
  z-index: 10;
}

.btn-group-invite {
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 0.72rem; color: var(--gold);
  cursor: pointer; transition: all 0.15s;
}
.btn-group-invite:hover {
  background: rgba(180,140,60,0.12);
}

/* ── Group invite popup ── */
#group-invite-popup {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 14px;
  width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85);
}

/* ── Group invite received ── */
#group-invite-received {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 16px;
  width: 340px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85);
}

#group-invite-text {
  font-size: 0.82rem; color: var(--text);
  margin-bottom: 14px; line-height: 1.5;
}

.group-invite-actions {
  display: flex; gap: 10px; justify-content: center;
}

/* ══════════ DUNGEON HUD ══════════ */

#dungeon-hud {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  min-width: 300px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  text-align: center;
}

#dungeon-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}

#dungeon-name {
  font-size: 0.88rem; font-weight: 700; color: #aa66ff;
  letter-spacing: 0.04em;
}

#dungeon-timer {
  font-size: 1rem; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums;
}

#dungeon-room-info {
  display: flex; justify-content: space-between;
  font-size: 0.72rem; color: var(--text-dim);
  margin-bottom: 6px;
}

#dungeon-group-hp {
  display: flex; gap: 8px;
}

.dgn-member {
  flex: 1;
}
.dgn-member.dgn-dead { opacity: 0.4; }

.dgn-name {
  font-size: 0.68rem; font-weight: 600;
  display: block; margin-bottom: 2px;
}

.dgn-hp-bar-bg {
  height: 8px; background: #3a0a0a;
  border: 1px solid #5a1010;
  border-radius: 2px; overflow: hidden;
}

.dgn-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b0000, #cc2200);
  transition: width 0.2s;
}

/* ── Dungeon Canvas ── */

#dungeon-canvas {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  border: 2px solid rgba(136,68,255,0.5);
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(136,68,255,0.2);
  image-rendering: auto;
  max-width: 90vw;
  max-height: 80vh;
}

/* ── Dungeon Result ── */

#dungeon-result {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 24px 30px;
  width: 380px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.9);
}

#dungeon-result-title {
  font-size: 1.8rem; font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(255,215,0,0.3);
}

#dungeon-result-stats {
  margin-bottom: 14px;
}

.dgn-stat {
  font-size: 0.82rem; color: var(--text);
  margin-bottom: 4px;
}

#dungeon-result-loot {
  margin-bottom: 16px;
}

.dgn-loot-title {
  font-size: 0.72rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.dgn-loot-item {
  font-size: 0.78rem; color: var(--text);
  padding: 4px 8px; margin-bottom: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: var(--radius);
}

.dgn-loot-item.rare {
  border-color: rgba(80,120,255,0.5);
  color: #6699ff;
}

.dgn-loot-item.epique {
  border-color: rgba(180,80,255,0.5);
  color: #bb66ff;
}

.dgn-loot-item.legendaire {
  border-color: rgba(255,170,0,0.6);
  color: #ffaa00;
  background: rgba(255,170,0,0.08);
  font-weight: 700;
}

/* ══════════ WORLD BOSS ══════════ */

#boss-announce {
  position: absolute; top: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(120,0,0,0.85);
  border: 2px solid #ff4444;
  border-radius: 6px;
  padding: 12px 24px;
  box-shadow: 0 0 30px rgba(255,0,0,0.4), 0 4px 20px rgba(0,0,0,0.8);
  animation: bossAnnounceIn 0.4s ease-out;
}

@keyframes bossAnnounceIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.8); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

#boss-announce-text {
  font-size: 1.1rem; font-weight: 700; color: #ff4444;
  text-shadow: 0 0 12px rgba(255,60,0,0.5);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

#boss-reward {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  background: var(--panel-bg2);
  border: 2px solid #ffaa00;
  border-radius: var(--radius);
  padding: 24px 30px;
  width: 400px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255,170,0,0.2), 0 8px 40px rgba(0,0,0,0.9);
}

#boss-reward-title {
  font-size: 1.4rem; font-weight: 700; color: #ffaa00;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  text-shadow: 0 0 16px rgba(255,170,0,0.3);
}

#boss-reward-stats { margin-bottom: 12px; }
#boss-reward-loot { margin-bottom: 16px; }

/* ══════════ BOUTIQUE ══════════ */

#shop-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: var(--panel-bg2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
  width: 620px; max-height: 80vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.85),
              inset 0 1px 0 rgba(180,140,60,0.1);
}

#shop-gold-display {
  font-size: 0.75rem; color: #ffd700;
  margin-bottom: 8px;
  text-align: right;
}

#shop-body {
  display: flex; gap: 10px;
  height: 400px;
}

#shop-left {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

#shop-right {
  width: 220px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px;
}

#shop-grid, #shop-inv-grid {
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto;
}

.shop-item {
  padding: 6px 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.72rem;
}
.shop-item:hover { border-color: rgba(255,215,0,0.4); background: rgba(255,215,0,0.06); }
.shop-item-name { flex: 1; }
.shop-item-price { color: #ffd700; font-size: 0.68rem; white-space: nowrap; }
.shop-item-stats { color: var(--text-dim); font-size: 0.65rem; }

.shop-inv-item {
  padding: 5px 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  cursor: context-menu;
  font-size: 0.7rem;
  display: flex; align-items: center; gap: 6px;
}
.shop-inv-item:hover { border-color: rgba(255,100,100,0.4); background: rgba(255,60,60,0.06); }
.shop-inv-sell-price { color: #aaa; font-size: 0.65rem; margin-left: auto; }

#shop-sell-hint {
  font-size: 0.6rem; color: var(--text-dim);
  margin-top: 4px; text-align: center;
}

/* ══════════ AUDIO PANEL ══════════ */

#audio-panel {
  position: absolute;
  right: 186px;
  bottom: 200px;
  width: 300px;
  background: var(--panel-bg);
  border: var(--border);
  border-radius: var(--radius);
  z-index: 10;
  padding-bottom: 12px;
  box-sizing: border-box;
}

#audio-body {
  padding: 4px 0;
}

.audio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
}

.audio-row label {
  width: 90px;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.audio-row input[type="range"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 4px;
  accent-color: var(--gold);
  cursor: pointer;
}

.audio-row span {
  width: 38px;
  font-size: 11px;
  color: var(--gold);
  text-align: right;
  flex-shrink: 0;
}

#audio-mute-btn {
  display: block;
  margin: 6px 14px 0;
  width: calc(100% - 28px);
  font-size: 12px;
  padding: 6px;
}

/* ══════════════════════════════════════════
   Context menu + Trade system
   ══════════════════════════════════════════ */

#player-context-menu {
  position: fixed;
  z-index: 9000;
  background: rgba(15,12,8,0.96);
  border: 1px solid rgba(180,140,60,0.6);
  border-radius: 6px;
  min-width: 160px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}

.ctx-player-name {
  padding: 5px 12px 4px;
  font-size: 0.75rem;
  color: #e8d5a3;
  font-weight: bold;
  border-bottom: 1px solid rgba(180,140,60,0.3);
  margin-bottom: 2px;
}

.ctx-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #c8b89a;
  padding: 6px 14px;
  text-align: left;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s;
}
.ctx-menu-item:hover { background: rgba(180,140,60,0.18); color: #e8d5a3; }

#trade-request-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8500;
  background: rgba(15,12,8,0.95);
  border: 1px solid rgba(180,140,60,0.6);
  border-radius: 8px;
  padding: 18px 22px 14px;
  min-width: 260px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.8);
  color: #c8b89a;
  font-size: 0.9rem;
}

#trade-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8400;
  background: rgba(15,12,8,0.97);
  border: 1px solid rgba(180,140,60,0.6);
  border-radius: 8px;
  padding: 0 0 14px;
  min-width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.9);
}

.trade-body {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 12px 14px 6px;
}

.trade-side {
  flex: 1;
}

.trade-side-title {
  font-size: 0.78rem;
  color: #e8d5a3;
  margin-bottom: 6px;
  text-align: center;
}

.trade-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 60px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  padding: 6px;
}

.trade-slot {
  background: rgba(40,32,20,0.9);
  border: 1px solid rgba(180,140,60,0.4);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #c8b89a;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-slot:hover { border-color: rgba(180,140,60,0.8); }
.trade-slot.selected { border-color: #b4a03c; background: rgba(180,140,60,0.22); color: #e8d5a3; }

.trade-divider {
  padding: 0 10px;
  font-size: 1.2rem;
  color: rgba(180,140,60,0.7);
  align-self: center;
}

.trade-confirmed-badge {
  min-height: 18px;
  margin-top: 5px;
  font-size: 0.8rem;
  color: #44cc44;
  text-align: center;
}

.trade-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 8px 14px 0;
}

.trade-hint {
  text-align: center;
  font-size: 0.72rem;
  color: #666;
  margin-top: 8px;
  padding: 0 14px;
}

/* ══════════════════════════════════════
   GUILDE
══════════════════════════════════════ */

#guild-area {
  position: fixed;
  top: 130px;
  left: 10px;
  z-index: 6200;
}

#guild-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8500;
  background: rgba(15,12,8,0.97);
  border: 1px solid rgba(180,140,60,0.6);
  border-radius: 8px;
  padding: 0 0 14px;
  width: 560px;
  max-width: 96vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.9);
}

/* Tabs */
#guild-panel-tabs {
  display: flex;
  border-bottom: 1px solid rgba(180,140,60,0.3);
  padding: 0 12px;
}
.guild-ptab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #888;
  font-size: 0.82rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.guild-ptab:hover { color: #c8b89a; }
.guild-ptab.active { color: #e8d5a3; border-bottom-color: rgba(180,140,60,0.8); }

/* Tab content */
.guild-ptab-content {
  padding: 12px 16px 0;
  overflow-y: auto;
  flex: 1;
}

/* Search row */
.guild-search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.guild-search-row .guild-input { flex: 1; }
.guild-search-row .guild-select { flex: 0 0 110px; }

/* Guild list table */
#guild-list-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.guild-list-row {
  display: grid;
  grid-template-columns: 1fr 80px 50px 40px auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  border-bottom: 1px solid rgba(180,140,60,0.08);
  font-size: 0.81rem;
  color: #c8b89a;
  cursor: default;
}
.guild-list-row:hover { background: rgba(180,140,60,0.07); }
.guild-list-header {
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(180,140,60,0.25) !important;
  padding-bottom: 6px;
}
.glt-name   { color: #e8d5a3; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glt-founder { font-size: 0.78rem; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glt-members { text-align: center; }
.glt-lang   { text-align: center; font-size: 0.78rem; color: #aaa; }
.guild-apply-btn {
  background: none;
  border: 1px solid rgba(180,140,60,0.5);
  border-radius: 4px;
  color: #c8b89a;
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.guild-apply-btn:hover { border-color: #b4a03c; color: #e8d5a3; }
.guild-apply-btn:disabled { opacity: 0.4; cursor: default; }

/* My guild */
#guild-info-bar {
  margin-bottom: 8px;
  font-size: 0.82rem;
}
#guild-mine-header {
  margin-bottom: 8px;
}
.guild-mine-name {
  font-size: 1rem;
  color: #e8d5a3;
  font-weight: bold;
}
.guild-mine-desc {
  font-size: 0.8rem;
  color: #a89880;
  margin-top: 2px;
}

/* Applications */
#guild-applications-section { margin-bottom: 10px; }
.guild-app-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 4px;
  border-bottom: 1px solid rgba(180,140,60,0.1);
  font-size: 0.81rem;
  color: #c8b89a;
}
.guild-app-name { flex: 1; color: #e8d5a3; }
.guild-app-accept {
  background: none;
  border: 1px solid rgba(80,180,80,0.5);
  border-radius: 3px;
  color: #70c870;
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
}
.guild-app-accept:hover { border-color: #70c870; }
.guild-app-reject {
  background: none;
  border: 1px solid rgba(180,80,80,0.5);
  border-radius: 3px;
  color: #c87070;
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
}
.guild-app-reject:hover { border-color: #c87070; }
.guild-badge {
  display: inline-block;
  background: #c84444;
  color: #fff;
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 0.7rem;
  margin-left: 4px;
  vertical-align: middle;
}

.guild-hint {
  color: #c8b89a;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.guild-input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(180,140,60,0.4);
  border-radius: 4px;
  padding: 6px 10px;
  color: #c8b89a;
  font-size: 0.85rem;
  box-sizing: border-box;
}
.guild-input:focus { border-color: rgba(180,140,60,0.8); outline: none; }
.guild-select { appearance: none; cursor: pointer; }

.guild-error-msg {
  color: #ff7070;
  font-size: 0.8rem;
  min-height: 18px;
  margin-top: 6px;
}

.guild-members-title {
  font-size: 0.78rem;
  color: #e8d5a3;
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
}

.guild-member-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #c8b89a;
  border-bottom: 1px solid rgba(180,140,60,0.1);
}
.guild-member-row:hover { background: rgba(180,140,60,0.07); }

.gm-rank-icon { width: 16px; text-align: center; }
.gm-name      { flex: 1; color: #e8d5a3; }
.gm-rank-label { font-size: 0.72rem; color: #888; min-width: 70px; text-align: right; }

.guild-kick-btn {
  background: none;
  border: none;
  color: #884444;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 4px;
}
.guild-kick-btn:hover { color: #ff6666; }

.guild-leave-btn {
  margin-top: 12px;
  background: none;
  border: 1px solid rgba(180,140,60,0.4);
  border-radius: 4px;
  padding: 6px 14px;
  color: #c8b89a;
  cursor: pointer;
  font-size: 0.82rem;
  transition: border-color 0.15s, color 0.15s;
}
.guild-leave-btn:hover { border-color: #b4a03c; color: #e8d5a3; }

/* Popup invite guilde */
#guild-invite-received {
  position: fixed;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  background: rgba(15,12,8,0.97);
  border: 1px solid rgba(180,140,60,0.6);
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 300px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.9);
}
#guild-invite-received-text {
  color: #c8b89a;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

/* Chat guilde */
.chat-msg.guild {
  color: #a0e8a0;
}
.chat-msg.guild .chat-user {
  color: #70c870;
}
