/* ==========================================================
   Emberfall Online — classic 2000s MMORPG interface
   ========================================================== */
:root {
  --panel: rgba(13, 14, 17, 0.84);
  --panel-2: rgba(28, 27, 24, 0.9);
  --border: #5c4d33;
  --border-hi: #8a744c;
  --gold: #e3c98c;
  --text: #d9d3c2;
  --dim: #8d8676;
  --hp: #c0262b;
  --hp2: #6e1014;
  --mp: #2c63c8;
  --mp2: #142c66;
  --cp: #d0952a;
  --cp2: #6a4410;
  --exp: #9a7ae0;
  --exp2: #40286e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: var(--app-h, 100dvh); overflow: hidden; overscroll-behavior: none; background: #000; color: var(--text);
  font-family: Tahoma, Verdana, "Segoe UI", sans-serif; font-size: 11px; -webkit-user-select: none; user-select: none; }
#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
#game-canvas.cur-attack { cursor: crosshair; }
#game-canvas.cur-talk { cursor: help; }
#game-canvas.cur-pick { cursor: pointer; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
b { color: #f0e6cc; }
button { font-family: inherit; font-size: 11px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 225, 170, 0.06), 0 4px 14px rgba(0, 0, 0, 0.55);
}

/* ---------- buttons & tabs ---------- */
.btn {
  background: linear-gradient(#4a4232, #2a2519);
  border: 1px solid #7a6844; border-bottom-color: #3a3020; border-right-color: #3a3020;
  color: var(--gold); padding: 4px 10px; cursor: pointer; border-radius: 2px; text-shadow: 0 1px 0 #000;
}
.btn:hover { background: linear-gradient(#5c523c, #353022); color: #fff2cc; }
.btn:active { background: linear-gradient(#2a2519, #3a3426); }
.btn.small { padding: 2px 7px; font-size: 10.5px; }
.btn.tiny { padding: 1px 6px; font-size: 10px; }
.btn.big { padding: 9px 22px; font-size: 13px; letter-spacing: 1px; }
.link { background: none; border: none; color: var(--gold); text-decoration: underline; cursor: pointer; padding: 6px; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  flex: 1; background: linear-gradient(#2e2b25, #1a1915); border: 1px solid #4a4030; border-bottom: none;
  color: var(--dim); padding: 3px 6px; cursor: pointer; border-radius: 3px 3px 0 0;
}
.tabs button.active { background: linear-gradient(#5a4c30, #2e2818); color: var(--gold); }
.tabs button:disabled { opacity: 0.4; cursor: default; }

/* ---------- overlay: nameplates & floating text ---------- */
#overlay-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.plate { position: absolute; left: 0; top: 0; text-align: center; white-space: nowrap; will-change: transform;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.pl-name { font-size: 11px; font-weight: bold; }
.pl-name .lv { font-weight: normal; color: #d8d8d8; font-size: 10px; }
.pl-title { font-size: 10px; color: #c8e4ff; }
.plate-monster .pl-title, .plate-player .pl-title, .plate-remote .pl-title { display: none; }
.pl-bubble { display: none; max-width: 220px; white-space: normal; margin: 0 auto 4px; padding: 4px 8px; background: rgba(250,246,232,0.94); color: #1e1a12;
  border: 1px solid #6a5a3a; border-radius: 6px; font-size: 11.5px; line-height: 1.3; text-shadow: none; position: relative; width: max-content; }
.pl-bubble.show { display: block; }
.pl-bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -5px; border: 5px solid transparent; border-top-color: rgba(250,246,232,0.94); border-bottom: 0; }
.pl-mark { font: bold 22px Georgia, serif; color: #ffd030; line-height: 1; }
.pl-mark.ready { color: #ffe860; }
.pl-mark:empty { display: none; }
.pl-hp { width: 64px; height: 5px; margin: 2px auto 0; background: #200; border: 1px solid #000; }
.pl-hp i { display: block; height: 100%; background: linear-gradient(#e04040, #900); }
.plate.targeted .pl-name { text-decoration: underline; }
.plate-drop { font-size: 10px; font-weight: bold; }
.float { position: absolute; left: 0; top: 0; font: bold 15px Tahoma, sans-serif; white-space: nowrap; will-change: transform, opacity;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 0 6px #000; }
.float.dmg { color: #ffffff; }
.float.skill { color: #ffd060; font-size: 17px; }
.float.crit { color: #ff9a20; font-size: 20px; }
.float.taken { color: #ff4a3a; }
.float.other { color: #c8c8c8; font-size: 11px; }
.float.miss { color: #a8c8ff; font-size: 12px; }
.float.heal { color: #60ff80; }
.float.mana { color: #60a8ff; }
.float.exp { color: #c8a8ff; font-size: 14px; }
.float.gold { color: #ffd84a; font-size: 14px; }
.float.loot { color: #ffffff; font-size: 13px; }
.float.skillname { color: #ffe9a0; font-size: 13px; letter-spacing: 1px; }

/* ---------- status panel ---------- */
#status-panel { position: fixed; left: calc(8px + env(safe-area-inset-left)); top: calc(8px + env(safe-area-inset-top)); display: flex; gap: 6px; padding: 5px; width: 268px; z-index: 20; }
#status-panel.low-hp { box-shadow: 0 0 0 1px #000, 0 0 14px rgba(255, 30, 30, 0.6); }
#portrait { width: 56px; height: 56px; border: 1px solid var(--border-hi); align-self: flex-start; }
.status-info { flex: 1; min-width: 0; }
.status-name { font-weight: bold; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.status-sub { color: var(--dim); margin-bottom: 3px; }
.pvp-badge { font-size: 9px; padding: 0 4px; background: #5a2080; border: 1px solid #a060d0; color: #f0d8ff; border-radius: 2px; }
.pvp-badge.karma { background: #801818; border-color: #e04040; }
.bar { position: relative; height: 12px; background: #0a0a0a; border: 1px solid #000; margin-top: 2px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; transition: width 0.15s; }
.bar label { position: absolute; left: 3px; top: -1px; font-size: 9.5px; font-weight: bold; color: #fff; text-shadow: 1px 1px 0 #000; z-index: 1; }
.bar span { position: absolute; left: 0; right: 0; top: -1px; text-align: center; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000; z-index: 1; }
.bar.hp .fill { background: linear-gradient(#e03a3e, var(--hp) 50%, var(--hp2)); }
.bar.mp .fill { background: linear-gradient(#4a80e8, var(--mp) 50%, var(--mp2)); }
.bar.cp .fill { background: linear-gradient(#f0b040, var(--cp) 50%, var(--cp2)); }
.bar.exp { height: 9px; }
.bar.exp .fill { background: linear-gradient(#b89af0, var(--exp) 50%, var(--exp2)); }
.bar.exp span, .bar.exp label { font-size: 8.5px; top: -2px; }

/* ---------- target frame ---------- */
#target-frame { position: fixed; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); width: 250px; padding: 5px 7px; z-index: 20; }
.tg-top { display: flex; justify-content: space-between; align-items: center; }
#tg-name { font-weight: bold; font-size: 12px; text-shadow: 1px 1px 0 #000; }
#tg-name .lv { color: #ccc; font-weight: normal; }
#tg-hpwrap { height: 11px; margin: 3px 0 2px; }
#tg-info { font-size: 10px; }

/* ---------- messages ---------- */
#sys-msg { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); color: #ff6a5a; font-weight: bold; font-size: 12px; opacity: 0;
  text-shadow: 1px 1px 0 #000, 0 0 4px #000; pointer-events: none; z-index: 30; white-space: nowrap; }
#sys-msg.show { animation: fadeMsg 2.2s ease-out; }
@keyframes fadeMsg { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
#zone-banner { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); font: 26px Georgia, "Times New Roman", serif; color: #f0dca0;
  letter-spacing: 3px; opacity: 0; pointer-events: none; text-shadow: 0 0 10px #000, 2px 2px 0 #000; z-index: 25; white-space: nowrap; }
#zone-banner.show { animation: zoneIn 3.4s ease-out; }
@keyframes zoneIn { 0% { opacity: 0; letter-spacing: 8px; } 15% { opacity: 1; letter-spacing: 3px; } 75% { opacity: 1; } 100% { opacity: 0; } }
.notify { position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(0.9); text-align: center; opacity: 0; pointer-events: none; z-index: 26;
  transition: opacity 0.3s, transform 0.3s; }
.notify.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.notify .n-title { font: bold 34px Georgia, serif; color: #ffe080; text-shadow: 0 0 14px rgba(255, 180, 40, 0.8), 2px 2px 0 #000; letter-spacing: 2px; }
.notify .n-sub { font-size: 13px; color: #f0e8d0; text-shadow: 1px 1px 0 #000; margin-top: 4px; }
.notify.levelup .n-title { font-size: 44px; }
.notify.quest .n-title { font-size: 22px; color: #a8e0ff; text-shadow: 0 0 10px rgba(80,160,255,0.7), 2px 2px 0 #000; }
.notify.quest-done .n-title { font-size: 28px; color: #9aff9a; text-shadow: 0 0 12px rgba(60,255,100,0.6), 2px 2px 0 #000; }
.notify.rare-drop .n-title { color: #ffcf5a; font-size: 34px; text-shadow: 0 0 14px rgba(255,190,40,0.9), 2px 2px 0 #000; }
.notify.pk .n-title { color: #ff3a3a; text-shadow: 0 0 14px rgba(255,30,30,0.8), 2px 2px 0 #000; font-size: 36px; letter-spacing: 4px; }
.notify.pvp-kill .n-title { color: #e080ff; text-shadow: 0 0 12px rgba(200,60,255,0.7), 2px 2px 0 #000; font-size: 30px; }
.cl.pk { color: #ff4a4a; font-weight: bold; }

/* ---------- right column ---------- */
#right-column { --rs: 124px; position: fixed; right: calc(8px + env(safe-area-inset-right)); top: calc(8px + env(safe-area-inset-top)); width: calc(max(var(--rs), 140px) + 12px); z-index: 20; display: flex; flex-direction: column; gap: 6px; }
#minimap-panel { padding: 4px; }
.mm-head { position: relative; text-align: center; color: var(--gold); font-weight: bold; padding: 1px 16px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
#mm-toggle { position: absolute; right: 0; top: -1px; width: 16px; height: 16px; padding: 0; line-height: 13px; background: rgba(20,20,20,0.85); border: 1px solid var(--border); color: var(--gold); cursor: pointer; border-radius: 2px; font-size: 12px; }
html.touch #mm-toggle { width: 24px; height: 20px; }
#minimap-panel.collapsed .mm-wrap, #minimap-panel.collapsed .mm-foot { display: none; }
#minimap-panel.collapsed .mm-head { padding-bottom: 1px; }
.mm-wrap { position: relative; width: var(--rs); height: var(--rs); border: 1px solid #000; outline: 1px solid var(--border); overflow: hidden; border-radius: 50%; margin: 0 auto; }
#minimap { display: block; width: calc(var(--rs) - 2px); height: calc(var(--rs) - 2px); }
.mm-n { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font: bold 11px Georgia; color: #ffe0a0; text-shadow: 1px 1px 0 #000; }
.mm-btns { position: absolute; right: 8%; bottom: 8%; display: flex; flex-direction: column; gap: 2px; }
.mm-btns button { width: 18px; height: 18px; line-height: 14px; padding: 0; background: rgba(20,20,20,0.85); border: 1px solid var(--border-hi); color: var(--gold); cursor: pointer; border-radius: 50%; }
.mm-foot { display: flex; justify-content: center; align-items: center; padding-top: 2px; color: var(--dim); font-size: 10px; }
#quest-tracker { padding: 4px 6px 6px; max-height: 32vh; overflow-y: auto; }
.qt-head { color: var(--gold); font-weight: bold; border-bottom: 1px solid #3a3226; padding-bottom: 2px; margin-bottom: 3px; }
.tq { padding: 3px 0; cursor: pointer; }
.tq-name { color: #f0d890; font-weight: bold; }
.tq-obj { color: #cfc8b4; padding-left: 6px; }
.tq.ready .tq-obj { color: #8f8; }
.tq-done { color: #ffe060; padding-left: 6px; }
.mk { color: #ffd030; font-weight: bold; font-family: Georgia, serif; }
.mk.ready { color: #ffe860; }

/* ---------- chat ---------- */
#chat-panel { position: fixed; left: calc(8px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 380px; height: 200px; display: flex; flex-direction: column; z-index: 20; padding: 3px; }
#chat-log { flex: 1; overflow-y: auto; padding: 2px 4px; font-size: 11px; line-height: 1.32; user-select: text; -webkit-user-select: text; }
#chat-log::-webkit-scrollbar, #quest-tracker::-webkit-scrollbar, .shop-list::-webkit-scrollbar, .win-body::-webkit-scrollbar { width: 8px; }
#chat-log::-webkit-scrollbar-thumb, #quest-tracker::-webkit-scrollbar-thumb, .shop-list::-webkit-scrollbar-thumb, .win-body::-webkit-scrollbar-thumb { background: #4a4030; border: 1px solid #000; }
.cl { text-shadow: 1px 1px 0 #000; }
.cl.ch-system { color: #d8cfa8; }
.cl.ch-combat { color: #c0bcb0; }
.cl.ch-general { color: #ffffff; }
.cl.player-chat { color: #e8e8e8; }
.cl.self-chat { color: #ffffff; }
.cl.error { color: #ff6a5a; }
.cl.danger { color: #ff7060; }
.cl.crit { color: #ffb040; }
.cl.exp { color: #c8a8ff; }
.cl.skill { color: #a0d0ff; }
.cl.loot { color: #f0e080; }
.cl.loot-uncommon { color: #6fd35f; }
.cl.loot-rare { color: #5fa8ff; }
.cl.loot-epic { color: #c77dff; }
.cl.loot-rare { color: #e2b552; font-weight: bold; }
.cl.quest { color: #8fe88f; }
.cl.levelup { color: #ffe060; font-weight: bold; }
#chat-input { margin: 2px 0; background: rgba(0,0,0,0.6); border: 1px solid #3a3226; color: #fff; padding: 3px 5px; font: inherit; outline: none; }
#chat-input:focus { border-color: var(--border-hi); }
#chat-tabs button { font-size: 10px; padding: 2px 4px; border-radius: 0 0 3px 3px; border: 1px solid #4a4030; border-top: none; }

/* ---------- hotbar ---------- */
#hotbar-wrap { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#hotbar { display: flex; gap: 3px; padding: 4px; }
.hb-slot { position: relative; width: 44px; height: 44px; border: 1px solid #000; outline: 1px solid #5a4c33; cursor: pointer; background: #111; overflow: hidden; }
.hb-slot img { width: 100%; height: 100%; display: block; image-rendering: auto; }
.hb-slot:hover { outline-color: #e0c070; }
.hb-slot:active img { transform: scale(0.92); }
.hb-slot .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,0.7); pointer-events: none; }
.hb-slot .key { position: absolute; left: 2px; top: 0; font-weight: bold; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.hb-slot .qty { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.hb-slot.disabled img { filter: grayscale(0.8) brightness(0.55); }
.hb-slot.active { outline: 2px solid #ffd040; }
#prompt { background: rgba(10,10,12,0.8); border: 1px solid var(--border); padding: 4px 12px; color: #f0e8d0; cursor: pointer; border-radius: 2px; }
#prompt b { color: #ffd040; }

/* ---------- menu ---------- */
#menu-bar { position: fixed; right: calc(8px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(6, 26px); gap: 2px; padding: 3px; z-index: 20; }
.menu-btn { width: 26px; height: 26px; padding: 0; border: 1px solid #000; outline: 1px solid #5a4c33; background: #111; cursor: pointer; }
.menu-btn img { width: 100%; height: 100%; display: block; }
.menu-btn:hover { outline-color: #e0c070; }

/* ---------- exp line (bottom) ---------- */
#exp-line { position: fixed; left: env(safe-area-inset-left); right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom); height: 9px; background: #0b0910; border-top: 1px solid #000; z-index: 21; }
#exp-line-fill { height: 100%; background: linear-gradient(#b89af0, #6a4ab0); width: 0; transition: width 0.3s; }
#exp-line-txt { position: absolute; left: 0; right: 0; top: -2px; text-align: center; font-size: 8.5px; color: #fff; text-shadow: 1px 1px 0 #000; }

/* ---------- windows ---------- */
#windows { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.window { position: absolute; pointer-events: auto; min-width: 220px; max-height: calc(100vh - 20px); display: flex; flex-direction: column; }
.win-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 4px 3px 8px; cursor: move;
  background: linear-gradient(#3a3224, #1c1912); border-bottom: 1px solid #000; color: var(--gold); font-weight: bold; letter-spacing: 0.5px; }
.win-x { width: 17px; height: 17px; line-height: 13px; padding: 0; background: linear-gradient(#5a3a2a, #2a1810); border: 1px solid #8a5a40; color: #f0d0b0; cursor: pointer; border-radius: 2px; font-size: 13px; }
.win-x:hover { background: linear-gradient(#8a4a3a, #4a2010); }
.win-body { padding: 6px; overflow-y: auto; }
.sect { color: var(--gold); font-weight: bold; margin: 8px 0 3px; border-bottom: 1px solid #3a3226; padding-bottom: 1px; }
.hint { color: var(--dim); font-size: 10px; margin-top: 5px; }
.pad { padding: 8px; }

/* slots */
.slot { position: relative; width: 36px; height: 36px; background: linear-gradient(#141412, #1e1d1a); border: 1px solid #000; outline: 1px solid #3a3226; }
.slot img { width: 100%; height: 100%; display: block; }
.slot .qty { position: absolute; right: 1px; bottom: -1px; font-size: 10px; color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.slot:not(.empty) { cursor: pointer; }
.slot:not(.empty):hover { outline-color: #e0c070; }
.slot.r-uncommon { outline-color: #3e7a36; }
.slot.r-rare { outline-color: #2e5a8a; }
.slot.r-epic { outline-color: #6a3a8a; }
.slot .grade { position: absolute; left: 1px; top: -1px; font: bold 9px Tahoma, sans-serif; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.g-D { color: #e2b552; }
.g-NG { color: #bdb6a4; }
.slot.locked img { filter: grayscale(0.6) brightness(0.6) sepia(0.4) hue-rotate(-30deg); }
.slot.locked::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(220, 60, 50, 0.7); pointer-events: none; }
.inv-sets { margin-top: 5px; padding: 4px 6px; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; color: var(--dim); }
.inv-sets .on { color: #9fe07f; }
.inv-sets b { color: #f0d890; }
.sr-req { font-size: 10px; color: var(--dim); margin-left: 3px; }
.sr-req.bad, .tt-req.bad { color: #ff6a5a; }
.tag { font-size: 10px; font-weight: bold; }

/* inventory */
.w-inv { width: 498px; }
.paperdoll { grid-auto-rows: 50px; }
.inv-layout { display: flex; gap: 8px; }
.paperdoll { display: grid; grid-template-columns: repeat(3, 44px); grid-auto-rows: 52px; gap: 3px; padding: 5px; background: rgba(0,0,0,0.35); border: 1px solid #2a251c;
  background-image: radial-gradient(ellipse at center, rgba(120,100,60,0.18), transparent 70%); }
.doll-cell { display: flex; flex-direction: column; align-items: center; }
.doll-lbl { font-size: 8.5px; color: var(--dim); height: 12px; }
.doll-gap { }
.slot.eq { width: 38px; height: 38px; }
.slot.eq.empty { background: rgba(0,0,0,0.5); }
.inv-main { flex: 1; }
.inv-tabs { margin-bottom: 0; }
.inv-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; padding: 4px; background: rgba(0,0,0,0.35); border: 1px solid #2a251c; }
.inv-foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px 0; }
.gold-amt { display: flex; align-items: center; gap: 4px; color: #ffd860; font-weight: bold; }
.gold-amt img { width: 16px; height: 16px; }
.inv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px 10px; margin-top: 6px; padding: 4px 6px; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; }
.inv-stats span { display: flex; justify-content: space-between; color: var(--dim); }

/* character */
.w-char { width: 280px; }
.char-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
#char-portrait { width: 52px; height: 52px; border: 1px solid var(--border-hi); }
.char-name { font-weight: bold; font-size: 13px; }
.stat-table { width: 100%; border-collapse: collapse; }
.stat-table td { padding: 1.5px 3px; color: var(--dim); }
.stat-table td.v { color: #f0e6cc; text-align: right; }
.mini-bar { position: relative; height: 12px; background: #0a0a0a; border: 1px solid #000; }
.mini-bar i { position: absolute; left: 0; top: 0; bottom: 0; }
.mini-bar span { position: absolute; left: 0; right: 0; text-align: center; font-size: 10px; top: -1px; color: #fff; text-shadow: 1px 1px 0 #000; }
.mini-bar.hp i { background: linear-gradient(#e03a3e, var(--hp2)); }
.mini-bar.mp i { background: linear-gradient(#4a80e8, var(--mp2)); }
.mini-bar.cp i { background: linear-gradient(#f0b040, var(--cp2)); }
.mini-bar.exp i { background: linear-gradient(#b89af0, var(--exp2)); }

/* skills */
.w-skills { width: 300px; }
.skill-row { display: flex; gap: 8px; padding: 6px; margin-top: 4px; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; cursor: pointer; }
.skill-row:hover { border-color: var(--border-hi); }
.skill-row img { width: 36px; height: 36px; border: 1px solid #000; }
.sk-name { color: #f0d890; font-weight: bold; }
.sk-desc { margin: 2px 0; }

/* quests */
.w-quests { width: 470px; }
.q-layout { display: flex; gap: 6px; min-height: 220px; }
.q-list { width: 150px; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; }
.q-item { padding: 4px 6px; cursor: pointer; border-bottom: 1px solid #1e1a14; display: flex; flex-direction: column; }
.q-item.sel { background: rgba(140,110,50,0.25); color: #fff; }
.q-item .q-st { font-size: 9.5px; color: var(--dim); }
.q-item.st-ready .q-st { color: #8f8; }
.q-detail { flex: 1; padding: 2px 4px; }
.q-title { font: bold 14px Georgia, serif; color: #f0d890; margin-bottom: 4px; }
.q-text { line-height: 1.4; color: #d8d0b8; }
.q-prog { margin-top: 4px; color: #ffe8a0; }
.q-prog.ready { color: #8f8; }
.q-prog.done { color: var(--dim); }
.rewards { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 8px; }
.rw { background: rgba(0,0,0,0.4); border: 1px solid #3a3226; padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px; }
.rw.gold { color: #ffd860; }
.rw img { width: 18px; height: 18px; }

/* dialogue */
.w-dialogue { width: 340px; }
.dlg-text { line-height: 1.5; padding: 6px; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; color: #e8e0c8; font-size: 12px; min-height: 60px; }
.dlg-opts { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.dlg-opt { text-align: left; background: none; border: none; color: #b8d8ff; cursor: pointer; padding: 3px 6px; font-size: 12px; }
.dlg-opt::before { content: '▸ '; color: var(--gold); }
.dlg-opt:hover { color: #fff; background: rgba(255,255,255,0.05); }
.dlg-opt.accept { color: #9aff9a; font-weight: bold; }
.dlg-opt:disabled { color: #666; cursor: default; }

/* shop */
.w-shop { width: 360px; }
.shop-list { max-height: 50vh; overflow-y: auto; background: rgba(0,0,0,0.3); border: 1px solid #2a251c; padding: 3px; }
.shop-row { display: flex; align-items: center; gap: 7px; padding: 3px; border-bottom: 1px solid #1e1a14; }
.shop-row:hover { background: rgba(255,255,255,0.03); }
.sr-info { flex: 1; min-width: 0; }
.sr-info .dim { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-price { color: #ffd860; font-weight: bold; min-width: 44px; text-align: right; }
.sr-price.poor { color: #a04a40; }
.sr-btns { display: flex; gap: 2px; }

/* map */
.w-map { width: auto; }
#worldmap { display: block; border: 1px solid #000; max-width: calc(100vw - 30px); max-height: calc(100vh - 90px); }
.map-legend { display: flex; gap: 12px; padding: 4px 2px 0; }
.lg::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; border: 1px solid #000; }
.lg.you::before { background: #fff; } .lg.mon::before { background: #e06040; } .lg.npc::before { background: #f0d070; } .lg.ply::before { background: #60a0ff; }

/* help */
.w-help { width: 520px; max-width: calc(100vw - 20px); }
.help { line-height: 1.6; font-size: 11.5px; }

/* tooltip */
#tooltip { position: fixed; z-index: 1000; max-width: 260px; background: rgba(8,8,10,0.95); border: 1px solid #6a5a3a; padding: 6px 8px; pointer-events: none;
  box-shadow: 0 0 0 1px #000, 0 4px 12px rgba(0,0,0,0.7); line-height: 1.45; }
.tt-name { font-weight: bold; font-size: 12px; color: #fff; }
.tt-type { color: var(--dim); margin-bottom: 3px; }
.tt-stat b { color: #8fe08f; }
.tt-stat b.neg { color: #ff7060; }
.tt-desc { color: #c8b890; font-style: italic; margin-top: 3px; }
.tt-price { margin-top: 3px; }
.tt-price b { color: #ffd860; }
.tt-hint { color: #8ab0e0; margin-top: 3px; font-size: 10px; }
.tt-grade { font-weight: bold; font-size: 10.5px; letter-spacing: 1px; }
.tt-req { margin-top: 4px; color: #e8e0c8; }
.tt-set { margin-top: 5px; padding-top: 4px; border-top: 1px solid #3a3226; }
.tt-set-name { color: #f0d890; font-weight: bold; }
.tt-set-b { color: #77705f; }
.tt-set-b.on { color: #9fe07f; }
.tt-src { margin-top: 4px; color: #a8a090; font-size: 10px; }
.tt-line { margin-top: 3px; }

/* death */
#death-screen { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(60,0,0,0.35), rgba(0,0,0,0.75)); z-index: 500; display: flex; align-items: center; justify-content: center; }
.death-box { padding: 24px 34px; text-align: center; }
.death-title { font: bold 30px Georgia, serif; color: #d03030; letter-spacing: 3px; text-shadow: 0 0 10px #600; margin-bottom: 10px; }
#death-text { font-size: 13px; margin-bottom: 16px; line-height: 1.6; }

/* ---------- buffs ---------- */
#buff-bar { position: fixed; left: 8px; top: 82px; display: flex; gap: 3px; z-index: 20; }
.buff { position: relative; width: 26px; height: 26px; border: 1px solid #000; outline: 1px solid #6a5a3a; }
.buff img { width: 100%; height: 100%; display: block; }
.buff span { position: absolute; right: 1px; bottom: -1px; font-size: 9.5px; color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }

/* ---------- skills window (extra) ---------- */
.w-skills { width: 360px; }
.sk-class { color: var(--gold); margin: 6px 0 2px; }
.skill-row.locked { opacity: 0.55; cursor: default; }
.skill-row.passive { cursor: default; }
.sk-body { flex: 1; min-width: 0; }
.sk-lv { color: #9fe07f; font-weight: normal; margin-left: 4px; }
.skill-row.locked .sk-lv { color: #b08a70; }
.sk-eff { color: #ffe9a0; margin: 1px 0 2px; }
.sk-next { color: #8ab0e0; font-size: 10px; margin-top: 2px; }
.sk-next.done { color: var(--dim); }

/* ---------- reconnect ---------- */
#reconnect { position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); }
#reconnect .panel { padding: 18px 28px; font-size: 14px; color: var(--gold); }

/* ---------- account screens ---------- */
.tp-head { color: var(--gold); font: bold 14px Georgia, serif; letter-spacing: 1px; margin-bottom: 4px; align-self: stretch; text-align: left; border-bottom: 1px solid #3a3226; padding-bottom: 4px; }
.title-panel label { align-self: flex-start; color: var(--gold); }
.title-panel input[type=text], .title-panel input[type=password] { width: 100%; padding: 7px 9px; font-size: 13px; background: rgba(0,0,0,0.6); border: 1px solid var(--border-hi); color: #fff; outline: none; }
.title-panel input:focus { border-color: #e0c070; }
.tp-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.tp-error { color: #ff6a5a; min-height: 14px; max-width: 320px; }
.tp-status { color: var(--dim); min-height: 14px; }
.tp-status.warn { color: #ffb060; }
#charselect-panel, #charcreate-panel { min-width: 380px; }
#char-list { display: flex; flex-direction: column; gap: 4px; align-self: stretch; max-height: 46vh; overflow-y: auto; }
.char-card { display: flex; gap: 10px; align-items: center; padding: 5px; border: 1px solid #2a251c; background: rgba(0,0,0,0.35); cursor: pointer; text-align: left; }
.char-card:hover { border-color: var(--border-hi); }
.char-card.sel { border-color: #e0c070; background: rgba(140,110,50,0.22); }
.char-card canvas { width: 44px; height: 44px; border: 1px solid #000; }
.cc-name { font: bold 14px Georgia, serif; }
.cc-layout { display: flex; gap: 14px; align-items: flex-start; align-self: stretch; }
#cc-portrait { width: 112px; height: 112px; border: 1px solid var(--border-hi); }
.cc-form { flex: 1; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.cc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cc-row > span { color: var(--dim); }
.seg { display: flex; }
.seg button { background: linear-gradient(#2e2b25, #1a1915); border: 1px solid #4a4030; color: var(--dim); padding: 3px 10px; cursor: pointer; }
.seg button.active { background: linear-gradient(#5a4c30, #2e2818); color: var(--gold); }
.swatches { display: flex; gap: 4px; }
.sw { width: 20px; height: 20px; border: 1px solid #000; outline: 1px solid #4a4030; cursor: pointer; padding: 0; }
.sw.active { outline: 2px solid #e0c070; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- title & loading ---------- */
#title-screen { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.1), rgba(0,0,0,0.7)); }
.title-box { text-align: center; }
.logo { font: bold 64px Georgia, "Times New Roman", serif; letter-spacing: 10px; color: #f0c870;
  background: linear-gradient(#ffe8a8, #c08a3a 55%, #7a4a1a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 2px #000) drop-shadow(0 0 18px rgba(255,150,40,0.35)); }
.logo-sub { font: 13px Georgia, serif; color: #d8c490; letter-spacing: 6px; margin: -4px 0 26px; text-shadow: 1px 1px 0 #000; }
.title-panel { display: inline-flex; flex-direction: column; gap: 8px; padding: 18px 26px; min-width: 300px; align-items: center; }
#new-char-box { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; }
#new-char-box.collapsed { display: none; }
#new-char-box label { color: var(--gold); }
#name-input { width: 100%; padding: 7px 9px; font-size: 13px; background: rgba(0,0,0,0.6); border: 1px solid var(--border-hi); color: #fff; outline: none; text-align: center; }
#title-error { color: #ff6a5a; min-height: 14px; }
.title-foot { margin-top: 20px; color: #c8bfa8; text-shadow: 1px 1px 0 #000; font-size: 11px; }
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; color: var(--gold); font: 16px Georgia, serif; z-index: 1000; letter-spacing: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #chat-panel { width: 300px; height: 160px; }
  .w-inv { transform-origin: top right; }
}
@media (max-width: 860px) {
  #status-panel { width: 220px; }
  #portrait { width: 44px; height: 44px; }
  #quest-tracker { max-height: 20vh; }
  #chat-panel { width: 240px; height: 120px; font-size: 10px; }
  #chat-tabs { display: none; }
  .hb-slot { width: 38px; height: 38px; }
  #menu-bar { grid-template-columns: repeat(6, 24px); bottom: 70px; }
  .menu-btn { width: 24px; height: 24px; }
  .window { left: 50% !important; top: 50% !important; right: auto !important; transform: translate(-50%, -50%) !important; max-width: calc(100vw - 10px); }
  .w-inv { width: 460px; }
  .logo { font-size: 42px; letter-spacing: 6px; }
}
@media (max-width: 560px) {
  #target-frame { top: 70px; width: 200px; }
  #chat-panel { display: none; }
  #quest-tracker { display: none; }
  .w-inv { width: 98vw; }
  .inv-layout { flex-direction: column; }
  .paperdoll { grid-template-columns: repeat(9, 1fr); grid-auto-rows: 46px; }
  .paperdoll .doll-gap { display: none; }
  .inv-grid { grid-template-columns: repeat(8, 1fr); }
  .slot { width: auto; aspect-ratio: 1; height: auto; }
  .hb-slot { width: 34px; height: 34px; }
}

/* ---------- phones: landscape only ---------- */
#rotate-overlay { display: none; position: fixed; inset: 0; z-index: 5000; background: radial-gradient(#1a1410, #000); color: var(--gold); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; font-family: Georgia, serif; padding: 20px; }
.rot-phone { width: 46px; height: 80px; border: 3px solid var(--gold); border-radius: 8px; animation: rotphone 2s ease-in-out infinite; margin-bottom: 14px; }
.rot-title { font-size: 22px; letter-spacing: 2px; text-shadow: 1px 1px 0 #000; }
.rot-sub { color: #c8bfa8; font-size: 13px; }
@keyframes rotphone { 0%, 25% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 700px) {
  #rotate-overlay { display: flex; }
}
html.touch, html.touch body { overscroll-behavior: none; touch-action: none; }
html.touch input, html.touch .win-body, html.touch #chat-log, html.touch #quest-tracker, html.touch .shop-list, html.touch .title-panel, html.touch .dlg-opts, html.touch #char-list { touch-action: pan-y; }

/* landscape phone layout (short screen, finger input) */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  #status-panel { width: 210px; padding: 3px; left: calc(6px + env(safe-area-inset-left)); top: calc(4px + env(safe-area-inset-top)); }
  #portrait { width: 38px; height: 38px; }
  #target-frame { top: calc(4px + env(safe-area-inset-top)); width: 200px; }
  #right-column { top: calc(4px + env(safe-area-inset-top)); right: calc(6px + env(safe-area-inset-right)); width: calc(max(var(--rs), 112px) + 8px); }
  .mm-foot { display: none; }
  #quest-tracker { max-height: 22vh; font-size: 10px; }
  #chat-panel { display: flex; width: 210px; height: 92px; left: calc(6px + env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); font-size: 10px; }
  #chat-tabs { display: none; }
  #hotbar-wrap { bottom: calc(12px + env(safe-area-inset-bottom)); gap: 3px; }
  html.touch #hotbar.long { max-width: 380px; }
  .cc-layout canvas { width: 72px; height: 72px; }
  .cc-cls-d { display: none; }
  #party-panel { width: 140px; top: calc(76px + env(safe-area-inset-top)); left: calc(6px + env(safe-area-inset-left)); font-size: 10px; }
  #summon-panel { width: 140px; top: calc(76px + env(safe-area-inset-top)); left: calc(150px + env(safe-area-inset-left)); }
  #party-panel.hidden + #summon-panel { left: calc(6px + env(safe-area-inset-left)); }
  .pm-bar { height: 3px; }
  #party-invite { top: calc(60px + env(safe-area-inset-top)); }
  .w-party { width: 96vw; }
  #castbar { width: 180px; }
  #a2hs { bottom: calc(4px + env(safe-area-inset-bottom)); }
  #hotbar { gap: 4px; padding: 3px; }
  .hb-slot { width: 42px; height: 42px; }
  #menu-bar { grid-template-columns: repeat(6, 28px); bottom: calc(12px + env(safe-area-inset-bottom)); right: calc(6px + env(safe-area-inset-right)); }
  .menu-btn { width: 28px; height: 28px; }
  .window { max-height: calc(var(--app-h, 100dvh) - 8px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-width: calc(100vw - 8px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  .win-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .w-inv { width: min(640px, 96vw); }
  .inv-layout { flex-direction: row; }
  .notify .n-title { font-size: 22px !important; }
  .title-panel, .cc-panel { max-height: 96vh; overflow-y: auto; }
  .logo { font-size: 30px; letter-spacing: 4px; margin-bottom: 4px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) and (max-width: 760px) {
  #chat-panel { width: 150px; height: 84px; }
  #status-panel { width: 190px; }
  .hb-slot { width: 36px; height: 36px; }
  #hotbar { gap: 3px; }
  #menu-bar { grid-template-columns: repeat(6, 26px); }
  .menu-btn { width: 26px; height: 26px; }
}

/* ===================================================================== expansion UI */
/* character creation: race + class */
.cc-row.top { align-items: flex-start; }
.cc-desc { color: #c8bfa8; font-size: 11px; margin: -2px 0 6px 0; line-height: 1.35; min-height: 30px; }
#cc-class { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cc-cls { text-align: left; background: linear-gradient(#2e2b25, #1a1915); border: 1px solid #4a4030; color: var(--text); padding: 5px 7px; cursor: pointer; border-radius: 2px; }
.cc-cls b { color: var(--gold); }
.cc-cls.active { border-color: var(--border-hi); background: linear-gradient(#4a3e28, #2a2418); box-shadow: 0 0 6px rgba(227,201,140,0.35); }
.cc-cls:disabled { opacity: 0.5; cursor: default; }
.cc-cls .soon { color: #ff9a6a; font-size: 10px; }
.cc-cls-d { display: block; color: #b8b0a0; font-size: 10.5px; margin-top: 2px; }
.cc-cls-p { display: block; color: #8fb8e8; font-size: 10px; margin-top: 2px; }

/* cast bar */
#castbar { position: relative; width: 240px; height: 14px; background: rgba(0,0,0,0.75); border: 1px solid #6a5a3a; border-radius: 2px; overflow: hidden; }
#cb-fill { height: 100%; width: 0; background: linear-gradient(#c890ff, #6a2ac0); }
#cb-name { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 13px; color: #fff; text-shadow: 1px 1px 0 #000; }
#hotbar.long { max-width: 760px; flex-wrap: wrap; justify-content: center; }

/* buffs / debuffs */
.buff.debuff { outline: 1px solid #c03030; }
.buff.debuff img { filter: saturate(1.2) hue-rotate(-20deg); }
#tg-effects { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 2px; }
#tg-effects .buff { width: 18px; height: 18px; }
#tg-effects .buff span { font-size: 8px; }
#tg-actions { margin-top: 3px; text-align: right; }
#tg-actions:empty { display: none; }

/* party panel (left, under the status panel) */
#party-panel { position: fixed; left: calc(8px + env(safe-area-inset-left)); top: calc(104px + env(safe-area-inset-top)); width: 170px; z-index: 19; padding: 3px 4px 4px; }
.pp-head { display: flex; justify-content: space-between; align-items: center; color: var(--gold); font-weight: bold; padding: 0 2px 2px; border-bottom: 1px solid #3a3226; margin-bottom: 2px; }
.pp-btn { background: none; border: 1px solid #4a4030; color: var(--gold); width: 18px; height: 18px; padding: 0; cursor: pointer; border-radius: 2px; line-height: 14px; }
.pm { padding: 2px 3px; cursor: pointer; border-radius: 2px; position: relative; }
.pm:hover { background: rgba(255,255,255,0.06); }
.pm.me { background: rgba(227,201,140,0.07); }
.pm.far { opacity: 0.6; }
.pm.dead .pm-name { color: #888; text-decoration: line-through; }
.pm-top { display: flex; gap: 3px; align-items: baseline; white-space: nowrap; overflow: hidden; }
.pm-name { color: #e8f0ff; font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
.pm-lv { color: var(--dim); font-size: 9.5px; margin-left: auto; }
.crown { color: #ffd040; }
.pm-bar { height: 4px; background: #111; border: 1px solid #000; margin-top: 1px; }
.pm-bar i { display: block; height: 100%; }
.pm-bar.hp i { background: linear-gradient(#e04040, #900); }
.pm-bar.mp i { background: linear-gradient(#4a80e0, #1a3a90); }
.pm-dead { position: absolute; right: 4px; top: 12px; color: #ff6060; font-size: 9px; font-weight: bold; }
/* summon panel */
#summon-panel { position: fixed; left: calc(184px + env(safe-area-inset-left)); top: calc(104px + env(safe-area-inset-top)); width: 170px; z-index: 19; padding: 4px; }
#party-panel.hidden + #summon-panel { left: calc(8px + env(safe-area-inset-left)); }
.sp-name { color: #a0ffc0; font-weight: bold; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-name .dim { font-weight: normal; }
.sp-btns { display: flex; gap: 2px; margin-top: 3px; }
.sp-btns .btn { flex: 1; padding: 2px 0; }
/* invitation */
#party-invite { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 60; padding: 10px 14px; text-align: center; min-width: 260px; }
#pi-text { margin-bottom: 8px; font-size: 12px; }
.pi-timer { height: 3px; background: #222; margin-top: 8px; }
.pi-timer i { display: block; height: 100%; width: 100%; background: var(--gold); }
/* party window */
.w-party { width: 470px; }
.pw-table { width: 100%; border-collapse: collapse; }
.pw-table td { padding: 4px; border-bottom: 1px solid #2a2620; vertical-align: top; }
.pw-table tr.dead td { opacity: 0.6; }
.pw-table .mini-bar { width: 120px; margin-bottom: 2px; }
.pw-table .btn { display: block; margin-bottom: 2px; width: 100%; }
.pw-loot { margin: 8px 0; }
.pw-loot .btn.on { color: #fff; border-color: var(--gold); }
.pw-invite { display: flex; gap: 4px; margin: 8px 0; }
.pw-invite input { flex: 1; background: rgba(0,0,0,0.6); border: 1px solid #3a3226; color: #fff; padding: 3px 5px; font: inherit; }
.bad { color: #ff6060; }
.gold-txt { color: #ffd84a; }
/* quests */
.q-tags { margin: 2px 0 6px; }
.qtag { display: inline-block; font-size: 9.5px; padding: 0 5px; border-radius: 7px; margin-right: 3px; border: 1px solid; }
.qtag.grp { color: #ff9a6a; border-color: #8a4a2a; }
.qtag.rep { color: #8ad0ff; border-color: #2a5a8a; }
.qtag.lv { color: #c8bfa8; border-color: #5a5040; }
.dlg-opts.scroll { max-height: 46vh; overflow-y: auto; }
.class-path { margin: 6px 0 4px; padding: 5px 7px; background: rgba(255,255,255,0.04); border: 1px solid #3a3226; line-height: 1.5; }
.sk-class .adv-ready, .class-path .adv-ready { color: #9fe07f; font-weight: bold; }
.adv-ready { color: #9fe07f; }
.map-legend .lg.elite::before { background: #ff20ff; }
.map-legend .lg.pty::before { background: #40ffd0; }
.float.dot { color: #b0ff70; font-size: 12px; }
.float.ability { color: #ff7050; font-size: 16px; letter-spacing: 1px; }
.cl.party-chat { color: #60ffd0; }
.plate-summon .pl-name { color: #a0ffc0; font-size: 10px; }
/* iPhone "add to home screen" hint */
#a2hs { position: fixed; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; justify-content: center; z-index: 3000; pointer-events: none; }
#a2hs .panel { pointer-events: auto; padding: 8px 12px; max-width: 92vw; font-size: 12px; line-height: 1.5; }
#a2hs .btn { margin-left: 8px; }
.a2hs-ico { display: inline-block; border: 1px solid var(--gold); border-radius: 3px; padding: 0 3px; }

/* touch: collapsible chat (tap the log to expand / collapse; the input only shows when open) */
#chat-toggle { display: none; }
html.touch #chat-toggle { display: block; position: absolute; right: 2px; top: 2px; width: 22px; height: 18px; padding: 0; z-index: 2; background: rgba(0,0,0,0.6); border: 1px solid #4a4030; color: var(--gold); border-radius: 2px; font-size: 11px; line-height: 14px; }
html.touch #chat-panel.min { height: 46px !important; }
html.touch #chat-panel.min #chat-input { display: none; }
html.touch #chat-panel.open { height: 160px !important; width: min(330px, 46vw) !important; z-index: 40; }

/* ---------- developer performance overlay ---------- */
#perf-overlay { position: fixed; left: calc(8px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); z-index: 60; pointer-events: none;
  background: rgba(0,0,0,0.72); color: #cfe8c0; font: 11px/1.45 Consolas, monospace; padding: 6px 8px; border: 1px solid #3a4a30; border-radius: 3px; max-width: 360px; }
#perf-overlay b { color: #fff; }

/* ---------- settings window ---------- */
.w-settings { width: 380px; max-width: calc(100vw - 20px); }
.w-settings .win-body { max-height: min(78vh, calc(var(--app-h, 100vh) - 60px)); overflow-y: auto; }
.set-sect { color: var(--gold); font-weight: bold; margin: 8px 0 4px; border-bottom: 1px solid var(--border); }
.set-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.set-row input[type=range] { flex: 1; min-width: 80px; }
.set-row.seg .btn { flex: 1; }
.btn.on { background: #5a4520; color: #ffe0a0; border-color: #c8a050; }
.set-note { color: var(--dim); font-size: 11px; margin: 2px 0 4px; }
.set-note.warn { color: #ffcc80; }
.set-row.dim { opacity: 0.5; }

/* ---------- Sonic Charges + premium badge ---------- */
.charges { margin-left: 6px; display: inline-flex; gap: 2px; vertical-align: middle; }
.charges i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #2a6a9a; background: #0a1a2a; display: inline-block; }
.charges i.on { background: radial-gradient(circle at 35% 35%, #ffffff, #40a8ff 60%, #1a5a9a); box-shadow: 0 0 4px #40a8ff; }
.prem-badge { margin-left: 5px; color: #ffd27a; text-shadow: 0 0 4px #c08020; }

/* ---------- combat logout countdown ---------- */
#logout-cd { position: fixed; left: 50%; top: 34%; transform: translateX(-50%); z-index: 70; padding: 10px 14px; text-align: center; max-width: 90vw; }
#logout-cd .lc-text { margin-bottom: 6px; line-height: 1.5; }
.over-cap .slot { outline: 1px solid #c04040; opacity: 0.8; }
.inv-foot .warn { color: #ff9080; }
.prem-star { color: #ffd27a; text-shadow: 0 0 3px #a06010; font-size: 0.9em; }
.plate-player .pl-title, .plate-remote .pl-title { color: #e8d8a0; font-style: italic; }
.prem-chat { color: #ffd27a !important; }

/* ---------- login tabs / Google ---------- */
.auth-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.auth-tabs button { flex: 1; }
.tp-link { display: inline-block; margin-top: 6px; color: var(--gold); font-size: 12px; }
.or-line { text-align: center; color: var(--dim); margin: 8px 0 6px; font-size: 12px; }
#google-btn { display: flex; justify-content: center; min-height: 40px; }

/* ---------- donation shop ---------- */
.w-store { width: 720px; max-width: calc(100vw - 16px); }
.w-store .win-body { max-height: min(80vh, calc(var(--app-h, 100vh) - 50px)); overflow-y: auto; }
html.touch .w-store .win-body { touch-action: pan-y; }
.st-banner { padding: 6px 10px; margin-bottom: 6px; border-radius: 3px; font-weight: bold; }
.st-banner.test { background: #5a2a10; color: #ffd0a0; border: 1px solid #c86a30; }
.st-banner.off { background: #2a2420; color: #d8c8a8; border: 1px solid #6a5434; font-weight: normal; }
.st-status { margin: 4px 0 6px; line-height: 1.6; }
.st-claim { background: #2a2210; border: 1px solid #8a7030; padding: 6px; margin-bottom: 6px; border-radius: 3px; }
.st-tabs { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.st-card { background: rgba(0,0,0,0.3); border: 1px solid var(--border); padding: 8px; border-radius: 3px; display: flex; flex-direction: column; gap: 4px; }
.st-name { color: #f0d890; font-weight: bold; display: flex; align-items: center; gap: 6px; }
.st-price { color: #fff; font-size: 15px; }
.st-desc { color: var(--dim); font-size: 11.5px; line-height: 1.45; flex: 1; }
.st-owned { color: #8aff9a; font-weight: bold; }
.st-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #000; display: inline-block; }
.st-hist { width: 100%; border-collapse: collapse; font-size: 12px; }
.st-hist td, .st-hist th { border-bottom: 1px solid #3a3020; padding: 3px 4px; text-align: left; }
.st-slot { margin: 4px 0; line-height: 1.9; }
.st-msg { margin-top: 8px; padding: 6px; background: #1a2a1a; border: 1px solid #3a6a3a; border-radius: 3px; }
.st-msg.err { background: #2a1414; border-color: #8a3a3a; color: #ffb0a0; }
.st-note { margin-top: 8px; }
.st-confirm { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 200; width: 380px; max-width: calc(100vw - 24px); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.st-renew { display: flex; gap: 6px; align-items: center; }
.adm-badge { background: #8a1a1a; color: #fff; padding: 0 5px; border-radius: 2px; font-size: 10px; }
.ok { color: #8aff9a; } .warn { color: #ffb070; } .err { color: #ff8a7a; }

/* login / register forms inside the title panel */
#login-panel { width: 340px; max-width: calc(100vw - 24px); }
#auth-login, #auth-register, #forgot-box, #login-code-row { display: flex; flex-direction: column; gap: 6px; width: 100%; }
#auth-login.hidden, #auth-register.hidden, #forgot-box.hidden, #login-code-row.hidden, #google-box.hidden { display: none; }
#google-box { width: 100%; }
.title-panel input[type=email] { width: 100%; padding: 7px 9px; font-size: 13px; background: rgba(0,0,0,0.6); border: 1px solid var(--border-hi); color: #fff; outline: none; box-sizing: border-box; }
.auth-tabs { width: 100%; }

.legal-links { margin-top: 10px; text-align: center; font-size: 11px; color: #9a8a6a; }
.legal-links a { color: #c8a868; }
