/* ============================================================
   Caravan Road — Phase A
   Navy + gold theme, stone/parchment panels, fluid orbs.
   ============================================================ */

:root {
  --navy-0: #060912;
  --navy-1: #0c1426;
  --navy-2: #101d38;
  --gold-0: #f4d27a;
  --gold-1: #c9a14a;
  --gold-2: #8a6a23;
  --parchment: #e8d8b0;
  --hp: #d8362f;
  --mp: #2f7fd8;
  --exp: #f2c64a;
  --ink: #e9e4d4;
  --stone-a: #2a3247;
  --stone-b: #161d31;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--navy-0);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hidden { display: none !important; }

/* Reusable gold-bordered stone panel */
.panel {
  background:
    linear-gradient(180deg, rgba(42,50,71,0.95), rgba(16,24,46,0.97));
  border: 2px solid var(--gold-1);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6),
    0 6px 18px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 22px rgba(0,0,0,0.45);
}

.btn {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #243049, #131b30);
  border: 1.5px solid var(--gold-2);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: transform .08s ease, filter .15s ease, border-color .15s ease;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}
.btn:hover { filter: brightness(1.18); border-color: var(--gold-0); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.btn-gold {
  color: #2a1d00;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-0), var(--gold-1) 60%, var(--gold-2));
  border-color: #5c4715;
}

/* ===================== MAIN MENU ===================== */
#menu-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 700px at 50% 12%, #16234a 0%, var(--navy-1) 45%, var(--navy-0) 100%);
}
.menu-vignette {
  position: absolute; inset: 0;
  box-shadow: inset 0 0 220px 60px rgba(0,0,0,0.8);
  pointer-events: none;
}

.menu-panel {
  position: relative;
  width: min(620px, 92vw);
  padding: 30px 34px 34px;
  background:
    linear-gradient(180deg, rgba(42,50,71,0.96), rgba(12,20,40,0.98));
  border: 3px solid transparent;
  border-radius: 16px;
  background-clip: padding-box;
  box-shadow:
    0 0 0 2px var(--gold-1),
    0 0 0 4px rgba(0,0,0,0.6),
    0 18px 60px rgba(0,0,0,0.7),
    inset 0 0 40px rgba(0,0,0,0.5);
  text-align: center;
}

.game-title {
  font-size: 52px;
  letter-spacing: 8px;
  font-weight: 800;
  background: linear-gradient(180deg, #fff6da, var(--gold-0) 40%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  filter: drop-shadow(0 3px 10px rgba(201,161,74,0.35));
}
.game-subtitle {
  color: var(--gold-0);
  opacity: .8;
  letter-spacing: 3px;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 22px;
  text-transform: uppercase;
}
.menu-hint { margin-top: 18px; font-size: 12px; opacity: .6; }

/* Cloud-save (Bulut) panel on the menu */
.bulut { margin-top: 16px; border: 1px solid var(--stone-a); border-radius: 10px; background: rgba(12,20,38,.6); text-align: left; }
.bulut > summary { cursor: pointer; padding: 9px 12px; color: var(--gold-0); font-weight: 700; font-size: 13px; list-style: none; }
.bulut > summary::-webkit-details-marker { display: none; }
.bulut-status { font-weight: 400; font-size: 11px; opacity: .7; margin-left: 4px; }
.bulut-status[data-s="synced"] { color: #6fd08a; opacity: 1; }
.bulut-status[data-s="offline"] { color: #d8a36f; opacity: 1; }
.bulut-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.bulut-row { display: flex; align-items: center; gap: 8px; }
.bulut-k { font-size: 12px; opacity: .75; min-width: 72px; }
.bulut-code { flex: 1; font-size: 11px; color: var(--parchment); background: var(--navy-0); border: 1px solid var(--stone-a); border-radius: 6px; padding: 4px 7px; word-break: break-all; }
.bulut-row input { flex: 1; min-width: 0; font: inherit; font-size: 12px; color: var(--ink); background: var(--navy-0); border: 1px solid var(--stone-a); border-radius: 6px; padding: 5px 7px; }
.bulut-btn { padding: 5px 9px; font-size: 12px; }
.bulut-hint { font-size: 11px; opacity: .55; line-height: 1.35; }
.bulut-actions { display: flex; gap: 8px; margin-top: 2px; }
.bulut-danger { border-color: #7a2b2b; color: #e6a6a6; }
.bulut-danger:hover { border-color: var(--hp); }

.slot-list { display: flex; flex-direction: column; gap: 12px; }

.slot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  border: 1.5px solid var(--gold-2);
  background: linear-gradient(180deg, rgba(38,46,66,0.9), rgba(14,21,40,0.95));
  transition: border-color .15s ease, transform .08s ease, filter .15s ease;
}
.slot:hover { border-color: var(--gold-0); filter: brightness(1.12); }
.slot:active { transform: translateY(1px); }

.slot-avatar {
  width: 54px; height: 54px;
  flex: 0 0 54px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px;
  border: 2px solid var(--gold-1);
  background: radial-gradient(circle at 50% 35%, #2c3a5e, #0c1326);
  box-shadow: 0 0 12px rgba(201,161,74,0.4), inset 0 0 10px rgba(0,0,0,0.6);
}
.slot-avatar.has-sprite {
  font-size: 0;
  background-color: #0c1326;
  background-size: cover;
  background-position: center 16%;
  background-repeat: no-repeat;
}
.slot-body { flex: 1; }
.slot-name { font-size: 18px; font-weight: 700; color: var(--parchment); }
.slot-sub { font-size: 12px; opacity: .7; margin-top: 3px; }
.slot-empty .slot-name { color: var(--gold-0); }
.slot-empty .slot-avatar { font-size: 30px; opacity: .8; }
.slot-actions { display: flex; gap: 8px; }
.slot-del {
  font-size: 12px; padding: 5px 9px;
  border-radius: 6px; border: 1px solid #7a2b27;
  background: linear-gradient(180deg, #3a1715, #220c0b);
  color: #f0b9b5; cursor: pointer;
}
.slot-del:hover { filter: brightness(1.25); }

/* ===================== MODAL ===================== */
.modal {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(2,4,10,0.72);
  backdrop-filter: blur(2px);
  z-index: 20;
}
.modal-box {
  width: min(440px, 92vw);
  padding: 26px;
  background: linear-gradient(180deg, rgba(42,50,71,0.97), rgba(12,20,40,0.99));
  border: 2px solid var(--gold-1);
  border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.6), 0 18px 50px rgba(0,0,0,0.7);
}
.modal-box h2 { color: var(--gold-0); margin-bottom: 18px; letter-spacing: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; text-align: left; }
.field span { font-size: 12px; opacity: .75; }
.field input {
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 10px 12px; border-radius: 8px;
  border: 1.5px solid var(--gold-2);
  background: rgba(8,12,24,0.9);
}
.field input:focus { outline: none; border-color: var(--gold-0); }

.race-pick { display: flex; gap: 12px; margin-bottom: 22px; }
.race-btn {
  flex: 1; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 10px; border-radius: 10px;
  border: 2px solid var(--gold-2);
  background: linear-gradient(180deg, rgba(38,46,66,0.9), rgba(14,21,40,0.95));
  color: var(--ink); font-family: inherit;
  transition: border-color .15s, filter .15s, transform .08s;
}
.race-btn:hover { filter: brightness(1.15); }
.race-btn.selected { border-color: var(--gold-0); box-shadow: 0 0 16px rgba(201,161,74,0.45); }
.race-emoji { font-size: 30px; }
.race-portrait {
  width: 64px; height: 64px;
  border-radius: 50%;
  font-size: 28px;
  display: grid; place-items: center;
  color: transparent;
  border: 2px solid var(--gold-1);
  background-color: #0c1326;
  background-size: cover;
  background-position: center 16%;
  background-repeat: no-repeat;
  box-shadow: 0 0 12px rgba(201,161,74,0.35), inset 0 0 10px rgba(0,0,0,0.6);
}
.race-name { font-weight: 700; color: var(--parchment); }
.race-desc { font-size: 11px; opacity: .65; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ===================== GAME / CANVAS ===================== */
#game-screen { background: var(--navy-0); }
#viewport { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.back-btn {
  position: absolute;
  left: 20px; bottom: 22px;
  z-index: 10;
}

/* Chat / log panel */
.chat-panel {
  position: absolute;
  top: 18px; left: 18px;
  width: 290px;
  max-height: 220px;
  display: flex; flex-direction: column;
  padding: 8px 10px;
  z-index: 8;
}
.panel-title {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold-0); opacity: .9;
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(201,161,74,0.35);
}
.chat-log {
  overflow-y: auto;
  font-size: 12px; line-height: 1.5;
  display: flex; flex-direction: column; gap: 2px;
  padding-right: 4px;
}
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--gold-2); border-radius: 3px; }
.log-line { color: #cfd6e6; }
.log-line .t { opacity: .45; margin-right: 6px; }
.log-kill   { color: #ffd9a8; }
.log-drop   { color: var(--gold-0); }
.log-level  { color: #9be37a; font-weight: 700; }
.log-death  { color: #ff8a82; }
.log-sys    { color: #8fb6ff; }
.log-announce {
  color: #ffe14d; font-weight: 700;
  text-shadow: 0 0 8px rgba(255,210,60,0.45);
}

/* ===================== BOTTOM HUD ===================== */
.hud-bar {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 18px;
  z-index: 9;
}

.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.orb-label { font-size: 11px; letter-spacing: 2px; color: var(--gold-0); opacity: .85; }

.orb {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold-1);
  background: radial-gradient(circle at 50% 30%, #0a1020, #05080f);
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.7),
    0 4px 14px rgba(0,0,0,0.6),
    inset 0 0 18px rgba(0,0,0,0.7);
}
.orb-liquid {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60%;
  transition: height .25s ease;
}
.hp-orb .orb-liquid { background: linear-gradient(180deg, #ff5b52, var(--hp) 60%, #7d1a16); }
.mp-orb .orb-liquid { background: linear-gradient(180deg, #5aa6ff, var(--mp) 60%, #163e7d); }

/* fluid wave: two oversized rotating blobs at the liquid surface */
.wave {
  position: absolute;
  left: 50%;
  top: -14px;
  width: 200%;
  height: 28px;
  transform: translateX(-50%);
  background: inherit;
}
.wave::before, .wave::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -160%;
  width: 180px; height: 180px;
  margin-left: -90px;
  border-radius: 42%;
  background: rgba(255,255,255,0.10);
}
.wave::before { animation: wave-spin 5s linear infinite; }
.wave::after  { animation: wave-spin 8s linear infinite reverse; border-radius: 46%; background: rgba(255,255,255,0.06); }

@keyframes wave-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.orb-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  z-index: 2;
}

/* HUD center */
.hud-center {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px 12px;
  min-width: 320px;
}
.portrait-wrap { position: relative; width: 66px; height: 66px; }
.portrait-ring {
  position: absolute; inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--gold-0), var(--gold-2), var(--gold-0));
  box-shadow: 0 0 14px rgba(201,161,74,0.6);
}
.portrait {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 32px;
  background: radial-gradient(circle at 50% 35%, #2c3a5e, #0a1224);
  border: 2px solid #1a2236;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.7);
}
.portrait.has-sprite {
  background-color: #0a1224;
  background-size: cover;
  background-position: center 18%;
  background-repeat: no-repeat;
}
.level-badge {
  position: absolute;
  bottom: -6px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 800; color: #2a1d00;
  padding: 1px 8px; border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-0), var(--gold-2));
  border: 1px solid #5c4715;
  white-space: nowrap;
}

.hud-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hero-name { font-size: 15px; font-weight: 700; color: var(--parchment); }

.exp-bar {
  position: relative;
  height: 16px;
  border-radius: 8px;
  background: rgba(6,10,20,0.9);
  border: 1px solid var(--gold-2);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.7);
}
.exp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #ffe27a, var(--exp) 60%, #b8870f);
  box-shadow: 0 0 10px rgba(242,198,74,0.6);
  transition: width .25s ease;
}
.exp-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: #2a1d00;
  text-shadow: 0 1px 1px rgba(255,255,255,0.25);
}

.gold-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.gold-coin { font-size: 14px; }
.gold-text { color: var(--gold-0); font-weight: 700; }
.stat-mini { margin-left: auto; font-size: 11px; opacity: .65; }

/* ===================== TOOLBAR ===================== */
.toolbar {
  position: absolute;
  top: 18px; right: 18px;
  display: flex; gap: 8px;
  z-index: 11;
}
.tool-btn {
  position: relative;
  width: 46px; height: 46px;
  font-size: 20px;
  display: grid; place-items: center;
  color: var(--ink);
  background: linear-gradient(180deg, #243049, #131b30);
  border: 1.5px solid var(--gold-2);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color .15s, filter .15s, transform .08s;
}
.tool-btn:hover { border-color: var(--gold-0); filter: brightness(1.15); }
.tool-btn:active { transform: translateY(1px); }
.tool-btn.active { border-color: var(--gold-0); box-shadow: 0 0 12px rgba(201,161,74,0.5); }
.tool-key {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 9px; font-weight: 700; color: var(--gold-0); opacity: .8;
}

/* ===================== POP-UP WINDOWS ===================== */
.window {
  position: absolute;
  width: 360px;
  max-height: 72vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(42,50,71,0.97), rgba(12,20,40,0.98));
  border: 2px solid var(--gold-1);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 14px 40px rgba(0,0,0,0.6), inset 0 0 22px rgba(0,0,0,0.4);
  z-index: 15;
}
.window.dragging { opacity: .96; }
.win-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  cursor: move;
  border-bottom: 1px solid rgba(201,161,74,0.35);
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(60,72,102,0.6), rgba(20,28,50,0.6));
}
.win-title h3 {
  font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold-0); font-weight: 700;
}
.win-close {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid var(--gold-2);
  background: linear-gradient(180deg, #3a1715, #220c0b);
  color: #f0b9b5; cursor: pointer; font-size: 14px; line-height: 1;
}
.win-close:hover { filter: brightness(1.25); }
.win-body {
  padding: 12px 14px;
  overflow-y: auto;
  font-size: 13px; line-height: 1.5;
}
.win-body::-webkit-scrollbar { width: 7px; }
.win-body::-webkit-scrollbar-thumb { background: var(--gold-2); border-radius: 3px; }

.win-section { margin-bottom: 16px; }
.win-section:last-child { margin-bottom: 0; }
.win-h {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold-0); opacity: .85; margin-bottom: 8px;
  border-bottom: 1px dotted rgba(201,161,74,0.3); padding-bottom: 4px;
}
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.kv .k { opacity: .7; }
.kv .v { color: var(--parchment); font-weight: 600; }

.stat-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.stat-row .label { flex: 1; }
.mini-btn {
  font-size: 13px; font-weight: 700;
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--gold-2);
  background: linear-gradient(180deg, #243049, #131b30);
  color: var(--gold-0); cursor: pointer;
}
.mini-btn:hover { filter: brightness(1.2); border-color: var(--gold-0); }
.mini-btn:disabled { opacity: .4; cursor: not-allowed; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  background: rgba(201,161,74,0.16); color: var(--gold-0);
  border: 1px solid rgba(201,161,74,0.4);
}
.badge-points { color: #9be37a; }

/* sliders / inputs */
.slider-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.slider-row label { flex: 0 0 90px; opacity: .8; }
.slider-row input[type=range] { flex: 1; accent-color: var(--gold-1); }
.slider-row .sval { flex: 0 0 46px; text-align: right; color: var(--parchment); font-weight: 600; }

/* skill trees */
.tree-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tree-tab {
  font-size: 11px; padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--gold-2); cursor: pointer;
  background: linear-gradient(180deg, #243049, #131b30); color: var(--ink);
}
.tree-tab.active { border-color: var(--gold-0); color: var(--gold-0); }
.mastery-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mastery-head .name { flex: 1; font-weight: 700; color: var(--parchment); }

.skill-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; border-radius: 8px; margin-bottom: 5px;
  border: 1px solid rgba(201,161,74,0.18);
  background: rgba(8,12,24,0.5);
}
.skill-row.locked { opacity: .5; }
.skill-row .s-icon { font-size: 16px; }
.skill-row .s-main { flex: 1; }
.skill-row .s-name { font-weight: 600; color: var(--parchment); }
.skill-row .s-sub { font-size: 10px; opacity: .6; }
.skill-row .s-lv { font-size: 11px; color: var(--gold-0); margin-right: 4px; }

/* inventory grid */
.inv-equipped { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-bottom: 10px; }
.eq-slot {
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px 7px; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(201,161,74,0.25); background: rgba(8,12,24,0.55);
}
.eq-slot:hover { border-color: var(--gold-0); }
.eq-slot .slot-k { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; opacity: .55; }
.eq-slot .slot-v { font-size: 11px; color: var(--parchment); }
.eq-slot.empty .slot-v { opacity: .4; }

.inv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.inv-cell {
  aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(201,161,74,0.25); background: rgba(8,12,24,0.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 18px; position: relative; text-align: center;
}
.inv-cell:hover { border-color: var(--gold-0); }
.inv-cell .cell-name { font-size: 8px; opacity: .7; margin-top: 2px; line-height: 1.1; padding: 0 2px; }
.inv-cell .cell-count {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 10px; font-weight: 700; color: var(--gold-0);
}
.inv-cell .cell-plus { position: absolute; top: 1px; left: 4px; font-size: 9px; color: #9be37a; }
.inv-cell.rare { border-color: #5aa6ff; }
.inv-cell.unique { border-color: #f4d27a; box-shadow: 0 0 8px rgba(244,210,122,0.4); }

/* ===================== ZONE BANNER ===================== */
.zone-banner {
  position: absolute;
  top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 10;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--gold-0);
  padding: 6px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(42,50,71,0.92), rgba(14,21,40,0.95));
  border: 1.5px solid var(--gold-2);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  white-space: nowrap;
}

/* ===================== ZONE WINDOW ===================== */
.zone-list { display: flex; flex-direction: column; gap: 6px; }
.zone-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(201,161,74,0.25); background: rgba(8,12,24,0.55);
  transition: border-color .15s, filter .12s;
}
.zone-row:hover { border-color: var(--gold-0); filter: brightness(1.1); }
.zone-row.active { border-color: var(--gold-0); box-shadow: inset 0 0 0 1px var(--gold-1), 0 0 10px rgba(201,161,74,0.35); }
.zone-row.locked { opacity: .5; cursor: not-allowed; }
.zone-row.locked:hover { filter: none; }
.zone-main { flex: 1; }
.zone-name { font-weight: 700; color: var(--parchment); }
.zone-sub { font-size: 11px; opacity: .65; margin-top: 2px; }

/* Region grouping + hunting sub-slots */
.zone-list { gap: 10px; }
.zone-group { display: flex; flex-direction: column; gap: 4px; }
.zone-group > .zone-row { display: block; }
.zone-group.active > .zone-row { border-color: var(--gold-0); box-shadow: inset 0 0 0 1px var(--gold-1), 0 0 10px rgba(201,161,74,0.30); }
.zone-slot-list { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 2px 14px; padding-left: 10px; border-left: 2px solid rgba(201,161,74,0.20); }
.zone-slot {
  padding: 6px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(201,161,74,0.18); background: rgba(8,12,24,0.40);
  transition: border-color .15s, filter .12s;
}
.zone-slot:hover { border-color: var(--gold-0); filter: brightness(1.12); }
.zone-slot.active { border-color: var(--gold-0); background: rgba(201,161,74,0.10); box-shadow: inset 0 0 0 1px var(--gold-1); }
.zone-slot.locked { opacity: .45; cursor: not-allowed; }
.zone-slot.locked:hover { filter: none; border-color: rgba(201,161,74,0.18); }
.zone-slot-name { font-weight: 600; font-size: 13px; color: var(--parchment); }
.zone-slot-sub { font-size: 10px; opacity: .6; margin-top: 1px; }

/* ===================== WORLD MAP WINDOW ===================== */
/* The Harita window is the map-centric one — give it more room than the
   default 360px so the İpek Yolu map reads big, not cramped. */
.window[data-win="zone"] { width: 560px; max-height: 86vh; }
.map-wrap { width: 100%; }
.caravan-map { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid rgba(201,161,74,0.30); }
.map-road { fill: none; stroke: rgba(201,161,74,0.55); stroke-width: 0.7; stroke-dasharray: 2 1.6; stroke-linecap: round; stroke-linejoin: round; }
.map-link { fill: none; stroke: rgba(201,161,74,0.30); stroke-width: 0.5; stroke-dasharray: 1 1.4; }
.map-dot { fill: rgba(120,130,160,0.85); stroke: rgba(8,12,24,0.9); stroke-width: 0.5; transition: fill .15s, r .15s; }
.map-label { font: 700 3.1px "Trebuchet MS", sans-serif; fill: var(--parchment); text-anchor: middle; pointer-events: none; }
.map-sub { font: 600 2.2px "Trebuchet MS", sans-serif; fill: rgba(220,210,180,0.6); text-anchor: middle; pointer-events: none; }
.map-node { cursor: default; }
.map-node[data-region] { cursor: pointer; }
.map-node.open .map-dot { fill: var(--gold-0, #c9a14a); }
.map-node[data-region]:hover .map-dot { fill: #f4d27a; r: 3.2; }
.map-node[data-region]:hover .map-label { fill: #fff; }
.map-node.current .map-dot { fill: #f4d27a; }
.map-node.current .map-label { fill: #f4d27a; }
.map-node.hub .map-dot { fill: #5fa8d6; }
.map-node.wild .map-dot { fill: #d6a85f; }
.map-node.locked .map-dot, .map-node.other .map-dot { fill: rgba(90,98,120,0.6); }
.map-node.locked .map-label, .map-node.other .map-label { fill: rgba(200,195,180,0.45); }
.map-pulse { fill: none; stroke: #f4d27a; stroke-width: 0.6; opacity: 0; transform-origin: center; transform-box: fill-box; animation: mapPulse 1.8s ease-out infinite; }
@keyframes mapPulse { 0% { opacity: .7; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.5); } }
.map-foot { margin-top: 8px; font-size: 12px; opacity: .8; }

/* ===================== ALCHEMY WINDOW ===================== */
.alc-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.alc-picker label { font-size: 11px; opacity: .7; flex: 0 0 auto; }
.alc-select {
  flex: 1; font-family: inherit; font-size: 12px; color: var(--ink);
  padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--gold-2); background: rgba(8,12,24,0.9);
}
.alc-select:focus { outline: none; border-color: var(--gold-0); }
.alc-panel { display: flex; flex-direction: column; gap: 4px; }
.alc-req { margin-top: 8px; padding-top: 6px; border-top: 1px dotted rgba(201,161,74,0.25); }
.alc-toggle {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 0; font-size: 12px; cursor: pointer;
}
.alc-toggle.disabled { opacity: .45; cursor: not-allowed; }
.alc-toggle input { accent-color: var(--gold-1); }
.alc-bas { width: 100%; margin-top: 12px; }
.alc-stones { display: flex; flex-wrap: wrap; gap: 6px; }
.alc-stone { font-size: 11px; padding: 6px 9px; }
.muted { opacity: .55; }
.inv-cell.consumable { border-color: rgba(127,182,255,0.4); }
.inv-cell .cell-blue { position: absolute; top: 1px; right: 4px; font-size: 10px; color: #7fb6ff; }

/* ===================== OFFLINE MODAL ===================== */
.offline-modal { z-index: 30; }
.offline-box { width: min(460px, 92vw); }
.offline-sub { font-size: 12px; opacity: .75; margin-bottom: 16px; }
.offline-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px;
  margin-bottom: 14px;
}
.offline-drops { margin-bottom: 16px; }
.offline-drops ul { list-style: none; max-height: 120px; overflow-y: auto; }
.offline-drops li { font-size: 12px; color: var(--parchment); padding: 2px 0; }
.offline-drops li.muted { color: var(--ink); }

/* ===================== SKILL BAR ===================== */
.skill-bar {
  position: absolute;
  bottom: 120px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 9;
}
.sb-slot {
  position: relative;
  width: 44px; height: 44px; border-radius: 9px;
  border: 1.5px solid var(--gold-2);
  background: linear-gradient(180deg, #1c2742, #0c1426);
  display: grid; place-items: center; font-size: 20px;
  overflow: hidden;
}
.sb-slot.imbue { border-color: #7fb6ff; }
.sb-slot.imbue.on { box-shadow: 0 0 10px rgba(127,182,255,0.7); }
.sb-cd {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  transition: height .08s linear;
}
.sb-name {
  position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
  font-size: 8px; white-space: nowrap; opacity: .6;
}

/* ===================== BERSERK DOTS (Phase D) ===================== */
.portrait-wrap { cursor: pointer; }
.berserk-dots { position: absolute; inset: -10px; pointer-events: none; }
.berserk-dots .bd {
  position: absolute;
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #5a3550, #2a1726);
  border: 1px solid rgba(255,122,192,0.5);
  box-shadow: inset 0 0 3px rgba(0,0,0,0.6);
  transition: background .15s ease, box-shadow .15s ease;
}
/* 5 dots arranged in a fan around the top half of the portrait */
.berserk-dots .bd0 { top: -4px;  left: 50%; transform: translateX(-50%); }
.berserk-dots .bd1 { top: 12%;   right: -6px; }
.berserk-dots .bd2 { bottom: 8%; right: -2px; }
.berserk-dots .bd3 { bottom: 8%; left: -2px; }
.berserk-dots .bd4 { top: 12%;   left: -6px; }
.berserk-dots .bd.lit {
  background: radial-gradient(circle at 40% 35%, #ffd1ec, #ff5ab0 70%, #c12c84);
  border-color: #ffaede;
  box-shadow: 0 0 8px rgba(255,90,176,0.85);
}
.portrait-wrap.berserk-ready .portrait-ring {
  background: conic-gradient(#ff7ac0, #c12c84, #ff7ac0);
  box-shadow: 0 0 16px rgba(255,90,176,0.7);
  animation: berserk-pulse 0.9s ease-in-out infinite;
}
.portrait-wrap.berserk-active .portrait-ring {
  background: conic-gradient(#ff9ad4, #ff2e95, #ff9ad4);
  box-shadow: 0 0 22px rgba(255,46,149,0.95);
  animation: berserk-pulse 0.55s ease-in-out infinite;
}
.portrait-wrap.berserk-active .portrait { box-shadow: inset 0 0 16px rgba(255,90,176,0.6); }
@keyframes berserk-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }

/* ===================== BOSS WINDOW (Phase D) ===================== */
.boss-list { display: flex; flex-direction: column; gap: 7px; }
.boss-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(201,161,74,0.25); background: rgba(8,12,24,0.55);
}
.boss-row.locked { opacity: .55; }
.boss-main { flex: 1; }
.boss-name { font-weight: 700; color: var(--parchment); }
.boss-sub { font-size: 11px; opacity: .65; margin-top: 2px; }
.boss-fight { padding: 6px 12px; font-size: 12px; flex: 0 0 auto; }

/* generic thin progress bar (boss HP / caravan progress) */
.bar {
  position: relative; height: 12px; margin-top: 6px;
  border-radius: 7px; overflow: hidden;
  background: rgba(6,10,20,0.9); border: 1px solid var(--gold-2);
}
.bar-fill { height: 100%; width: 0%; transition: width .2s ease; border-radius: 7px; }
.bar-fill.hp  { background: linear-gradient(180deg, #ff5b52, var(--hp) 60%, #7d1a16); }
.bar-fill.exp { background: linear-gradient(180deg, #ffe27a, var(--exp) 60%, #b8870f); }

/* ===================== KERVAN WINDOW (Phase D) ===================== */
.job-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.job-pick label { font-size: 11px; opacity: .7; flex: 0 0 54px; }
.job-select {
  flex: 1; font-family: inherit; font-size: 12px; color: var(--ink);
  padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--gold-2); background: rgba(8,12,24,0.9);
}
.job-select:focus { outline: none; border-color: var(--gold-0); }

/* ===================== PETS WINDOW (Phase E) ===================== */
.pet-list { display: flex; flex-direction: column; gap: 8px; }
.pet-row {
  display: flex; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  border: 1px solid rgba(201,161,74,0.22); background: rgba(8,12,24,0.55);
}
.pet-row.active { border-color: var(--gold-0); box-shadow: 0 0 10px rgba(201,161,74,0.28); }
.pet-row.locked { opacity: .6; }
.pet-icon { font-size: 26px; flex: 0 0 auto; line-height: 1.2; }
.pet-main { flex: 1; min-width: 0; }
.pet-name { font-weight: 700; color: var(--parchment); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pet-sub { font-size: 11px; opacity: .7; margin-top: 2px; }
.pet-desc { font-size: 11px; opacity: .55; margin: 3px 0 6px; }
.pet-actions { margin-top: 6px; }
.pet-actions .btn { padding: 6px 12px; font-size: 12px; }

/* ===================== QUESTS WINDOW (Phase E) ===================== */
.quest-row {
  padding: 9px 10px; border-radius: 9px; margin-bottom: 8px;
  border: 1px solid rgba(201,161,74,0.22); background: rgba(8,12,24,0.55);
}
.quest-row:last-child { margin-bottom: 0; }
.quest-row.claimable { border-color: var(--gold-0); box-shadow: 0 0 10px rgba(201,161,74,0.3); }
.quest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quest-name { font-weight: 700; color: var(--parchment); }
.quest-desc { font-size: 11px; opacity: .65; margin: 3px 0; }
.quest-foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.quest-prog { font-size: 11px; color: var(--gold-0); font-weight: 700; }
.quest-reward { font-size: 11px; opacity: .75; flex: 1; }
.quest-claim { padding: 5px 12px; font-size: 12px; flex: 0 0 auto; }

/* ============================================================
   MOBILE — portrait phones (≤720px). Bottom thumb-nav + full-screen
   sheets, edge-safe insets. Desktop/Steam keep the floating windows.
   ============================================================ */
@media (max-width: 720px) {
  /* --- Toolbar → bottom, thumb-reachable, horizontally scrollable nav --- */
  .toolbar {
    top: auto; right: auto;
    left: 0; bottom: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(6,10,20,0), rgba(6,10,20,0.9) 45%);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    z-index: 40;               /* above the full-screen sheets so you can swap panels */
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .tool-btn { width: 48px; height: 48px; flex: 0 0 auto; font-size: 22px; }
  .tool-key { display: none; } /* hotkeys are meaningless on touch */

  /* --- HUD: full width, orbs pinned to the edges, center flexes (no clipping) --- */
  .hud-bar {
    left: 0; right: 0; transform: none;
    width: 100%;
    bottom: calc(66px + env(safe-area-inset-bottom));
    padding: 0 calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left));
    gap: 8px;
    justify-content: space-between; align-items: flex-end;
  }
  .orb { width: 52px; height: 52px; border-width: 2px; }
  .orb-label { font-size: 9px; letter-spacing: 1px; }
  .orb-text { font-size: 10px; }
  .hud-center { min-width: 0; flex: 1; padding: 7px 10px 8px; gap: 14px; }
  .portrait-wrap { width: 48px; height: 48px; }
  .portrait { font-size: 22px; }
  .hero-name { font-size: 13px; }
  .stat-mini { display: none; }          /* lives in the Character panel */
  .exp-bar { height: 14px; }

  /* --- Skill bar just above the HUD --- */
  .skill-bar { bottom: calc(130px + env(safe-area-inset-bottom)); }

  /* --- Top strip: zone banner centered, back (icon) top-right, chat top-left --- */
  .zone-banner {
    top: calc(8px + env(safe-area-inset-top));
    max-width: 56vw;
    overflow: hidden; text-overflow: ellipsis;
  }
  .back-btn {
    left: auto; bottom: auto;
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    width: 42px; height: 40px; padding: 0;
    font-size: 0;                 /* hide the long label — show only the arrow */
    display: grid; place-items: center;
  }
  .back-btn::before { content: '←'; font-size: 20px; color: var(--ink); }
  .chat-panel {
    top: calc(52px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    width: min(64vw, 250px);
    max-height: 128px;
    padding: 6px 8px;
  }

  /* --- Windows → full-screen sheets between the top edge and the bottom nav.
         !important overrides the inline left/top/right ui.js sets for desktop. --- */
  .window {
    left: 0 !important; right: 0 !important;
    top: 0 !important;
    bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    border-radius: 0;
    border-width: 0 0 2px 0;
    z-index: 30;
  }
  .win-title {
    cursor: default; border-radius: 0;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  }
  .win-title h3 { font-size: 15px; }
  .win-close { width: 34px; height: 34px; font-size: 18px; }
  .win-body { flex: 1; min-height: 0; padding: 12px 16px 20px; font-size: 14px; }

  /* Roomier tap targets inside panels. */
  .win-body .btn { padding: 9px 13px; }

  /* Menu: give the create modal / panels a touch of breathing room. */
  .menu-panel { width: min(620px, 94vw); }
}

/* Wave 3: "Nuke" badge on magical-damage attack skills in the skill window. */
.s-nuke { display:inline-block; margin-left:6px; padding:0 6px; border-radius:6px; font-size:10px; font-weight:700;
  color:#0b0d12; background:linear-gradient(180deg,#7db8ff,#3d7fe0); vertical-align:middle; letter-spacing:.03em; }
