/* ARGENVERSO · interfaz. Estética: vidrio oscuro cósmico con filetes dorados. */
:root {
  --bg: #0b0820;
  --ink: #f4efe6;
  --ink-2: #c9c2d8;
  --ink-3: #8f88a6;
  --gold: #f3c969;
  --gold-2: #d99a2b;
  --gold-ink: #2a1a02;
  --glass: rgba(18, 14, 40, 0.62);
  --glass-2: rgba(28, 22, 60, 0.78);
  --line: rgba(243, 201, 105, 0.28);
  --line-2: rgba(255, 255, 255, 0.1);
  --hp: #ff4d6d;
  --hp-2: #b3123a;
  --mana: #4cc9ff;
  --mana-2: #1857b8;
  --xp: #ffd166;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, sans-serif;
  --display: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }
.layer { position: fixed; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
#galaxy-overlay { z-index: 2; }
#ui { z-index: 3; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
[hidden] { display: none !important; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

/* ───────── Arranque ───────── */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 22px; text-align: center; background: radial-gradient(ellipse at 50% 40%, #2a1b5e 0%, #0b0820 60%); transition: opacity 0.6s ease; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-bar { width: min(320px, 70vw); height: 4px; margin: 0 auto; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 4px; animation: bootbar 1.4s ease-in-out infinite; }
@keyframes bootbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(340%); } }
.boot-text { margin: 0; color: var(--ink-3); font-size: 14px; }

.logo-word { display: block; font-family: var(--display); font-size: clamp(38px, 9vw, 86px); font-weight: 700; letter-spacing: 0.12em; background: linear-gradient(180deg, #fff6d8 0%, var(--gold) 45%, var(--gold-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 24px rgba(243, 201, 105, 0.35)); }
.logo-sub { display: block; margin-top: 4px; color: var(--ink-2); letter-spacing: 0.32em; text-transform: uppercase; font-size: clamp(10px, 2.2vw, 13px); }

/* ───────── Vidrio y botones ───────── */
.glass { background: var(--glass); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: var(--radius); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); color: var(--ink); font-weight: 600; letter-spacing: 0.01em; transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.btn:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffe08a, var(--gold-2)); color: var(--gold-ink); border-color: rgba(255, 230, 160, 0.8); box-shadow: 0 6px 22px rgba(217, 154, 43, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.45); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.tiny { min-height: 28px; padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line-2); color: var(--ink-2); }
.chip.gold { color: var(--gold); border-color: var(--line); }
.chip.lock { color: var(--ink-3); }
.muted { color: var(--ink-3); }
.gold-text { color: var(--gold); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.field { display: grid; gap: 6px; text-align: left; }
.field label { font-size: 13px; color: var(--ink-2); }
.field input, .field select { min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: var(--ink); font-size: 16px; user-select: text; -webkit-user-select: text; }
.field input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.error-text { color: var(--bad); font-size: 13px; min-height: 18px; margin: 0; }

/* ───────── Pantallas de menú ───────── */
.screen { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); overflow: auto; }
.screen.top { place-items: start center; }
.auth-card { width: min(420px, 100%); padding: 28px 24px; text-align: center; }
.auth-card .logo-word { font-size: clamp(28px, 9vw, 42px); letter-spacing: 0.08em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 22px 0 16px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); }
.auth-tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 600; }
.auth-tabs button[aria-selected='true'] { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.auth-foot { margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

.roster { width: min(980px, 100%); display: grid; gap: 16px; padding-top: 10px; }
.roster-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.roster-head .logo-word { font-size: clamp(26px, 5vw, 38px); }
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.char-card { position: relative; display: grid; gap: 8px; padding: 18px; text-align: left; border-radius: var(--radius); border: 1px solid var(--line-2); background: linear-gradient(160deg, rgba(48, 36, 100, 0.7), rgba(16, 12, 36, 0.8)); transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.char-card:hover { transform: translateY(-2px); border-color: var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.char-card h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.char-card .meta { color: var(--ink-2); font-size: 13px; }
.char-card .lvl { position: absolute; top: 14px; right: 14px; font-family: var(--display); font-size: 26px; color: var(--gold); }
.char-card.new { display: grid; place-items: center; min-height: 150px; border-style: dashed; background: rgba(255, 255, 255, 0.03); color: var(--ink-2); font-weight: 600; }
.char-card.ghosted::after { content: '👻 fantasma'; position: absolute; bottom: 14px; right: 14px; font-size: 12px; color: #9ad7ff; }
.unlock-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; }

/* Creación de personaje */
.create { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(300px, 420px) 1fr minmax(280px, 360px); gap: 16px; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); }
.create-col { overflow: auto; padding: 16px; display: grid; align-content: start; gap: 14px; }
.create-col h2 { margin: 0; font-family: var(--display); font-size: 22px; }
.create-col h4 { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.pick { position: relative; display: grid; gap: 2px; padding: 10px; min-height: 64px; text-align: left; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); }
.pick b { font-size: 14px; }
.pick small { color: var(--ink-3); font-size: 11px; line-height: 1.3; }
.pick[aria-pressed='true'] { border-color: var(--gold); background: rgba(243, 201, 105, 0.12); box-shadow: inset 0 0 0 1px rgba(243, 201, 105, 0.4); }
.pick.locked { opacity: 0.55; }
.pick.locked::after { content: '🔒'; position: absolute; top: 8px; right: 8px; font-size: 12px; }
.pick.hero { background: linear-gradient(160deg, rgba(120, 60, 160, 0.35), rgba(20, 10, 40, 0.5)); }
.create-stage { position: relative; display: grid; align-content: end; justify-items: center; padding-bottom: 20px; pointer-events: none; }
.create-stage .stage-name { font-family: var(--display); font-size: clamp(26px, 4vw, 40px); text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6); }
.create-stage .stage-sub { color: var(--ink-2); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
.stat-bars { display: grid; gap: 6px; }
.stat-bar { display: grid; grid-template-columns: 110px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.stat-bar i { display: block; height: 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat-bar i::before { content: ''; display: block; height: 100%; width: var(--v, 50%); background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.blurb { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); }
.swatch[aria-pressed='true'] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243, 201, 105, 0.3); }

/* ───────── HUD ───────── */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top-left { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; display: grid; gap: 8px; width: min(330px, 46vw); }
.portrait { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; padding: 10px 12px; }
.portrait .lv { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--gold); background: radial-gradient(circle at 35% 30%, rgba(255, 220, 140, 0.25), rgba(0, 0, 0, 0.5)); border: 2px solid var(--line); }
.portrait .nm { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portrait .cl { font-size: 11px; color: var(--ink-3); }
.bars { display: grid; gap: 4px; margin-top: 4px; }
.bar { position: relative; height: 13px; border-radius: 7px; background: rgba(0, 0, 0, 0.45); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
.bar i { position: absolute; inset: 0; width: var(--v, 100%); border-radius: 7px; transition: width 0.2s ease; }
.bar.hp i { background: linear-gradient(180deg, var(--hp), var(--hp-2)); }
.bar.mana i { background: linear-gradient(180deg, var(--mana), var(--mana-2)); }
.bar.xp { height: 6px; }
.bar.xp i { background: linear-gradient(90deg, #ffb347, var(--xp)); }
.bar.breath i { background: linear-gradient(90deg, #8be9ff, #2bc0ff); }
.bar span { position: relative; display: block; text-align: center; font-size: 10px; line-height: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.wallet { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet .chip { background: var(--glass-2); }
.seals { display: flex; gap: 4px; }
.seal { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.4); color: var(--ink-3); }
.seal.on { color: #000; border-color: transparent; box-shadow: 0 0 10px rgba(255, 220, 120, 0.6); }
.buffs { display: flex; gap: 4px; flex-wrap: wrap; }
.buff { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; font-size: 14px; background: var(--glass-2); border: 1px solid var(--line-2); }
.buff small { font-size: 9px; color: var(--ink-2); }

.hud-top-right { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; display: grid; gap: 8px; justify-items: end; }
.minimap { position: relative; width: 168px; height: 168px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line); box-shadow: var(--shadow); background: #000; }
.minimap canvas { width: 100%; height: 100%; display: block; }
.minimap .mm-name { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 11px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.minimap .mm-n { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: var(--gold); text-shadow: 0 1px 2px #000; }
.top-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 280px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 20px; position: relative; }
.icon-btn:hover { border-color: var(--line); }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px; font-size: 11px; font-weight: 800; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; }
.icon-btn.ad { background: linear-gradient(180deg, rgba(255, 210, 110, 0.35), rgba(120, 60, 0, 0.4)); border-color: var(--line); animation: adglow 2.4s ease-in-out infinite; }
@keyframes adglow { 50% { box-shadow: 0 0 18px rgba(243, 201, 105, 0.55); } }

.target-frame { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(300px, 46vw); padding: 8px 12px; display: grid; gap: 4px; text-align: center; }
.target-frame .tn { font-weight: 700; font-size: 14px; }
.target-frame .tl { font-size: 11px; color: var(--ink-3); }
.target-frame.boss { border-color: rgba(255, 120, 80, 0.6); box-shadow: 0 0 24px rgba(255, 90, 40, 0.35); }

.hotbar { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; }
.slot { position: relative; width: 58px; height: 58px; border-radius: 14px; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.4)); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.slot:hover { border-color: var(--line); }
.slot.active { border-color: var(--gold); box-shadow: 0 0 14px rgba(243, 201, 105, 0.5); }
.slot.nomana { filter: grayscale(0.8) brightness(0.7); }
.slot .key { position: absolute; top: 3px; left: 6px; font-size: 10px; font-weight: 800; color: var(--ink-2); }
.slot .cost { position: absolute; bottom: 3px; right: 5px; font-size: 9px; font-weight: 700; color: #9fdcff; }
.slot .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0, 0, 0, 0.72) var(--p, 0%), transparent 0); pointer-events: none; }
.slot .lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(0, 0, 0, 0.6); color: var(--ink-2); }
.slot-label { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; white-space: nowrap; color: var(--ink-3); }

.interact-hint { position: absolute; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.interact-hint kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 700 12px var(--font); background: var(--gold); color: var(--gold-ink); }
.work-bar { position: absolute; left: 50%; bottom: calc(146px + var(--safe-b)); transform: translateX(-50%); width: 200px; }

.chat { position: absolute; left: 10px; bottom: calc(14px + var(--safe-b)); width: min(360px, 40vw); display: grid; gap: 6px; }
.chat-log { max-height: 180px; overflow-y: auto; padding: 8px 10px; font-size: 13px; line-height: 1.45; display: grid; gap: 2px; mask-image: linear-gradient(180deg, transparent, #000 22%); -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%); }
.chat-log p { margin: 0; text-shadow: 0 1px 2px #000; }
.chat-log .who { color: var(--gold); font-weight: 700; }
.chat-log .sys { color: #9fdcff; }
.chat-log .loot { color: #b9f6ca; }
.chat-log .warn { color: var(--warn); }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-height: 38px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.5); color: var(--ink); user-select: text; -webkit-user-select: text; }

.toasts { position: absolute; top: calc(78px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none; z-index: 5; }
.toast { padding: 9px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; background: var(--glass-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: toastin 0.25s ease; max-width: min(520px, 92vw); text-align: center; }
.toast.good { border-color: rgba(74, 222, 128, 0.5); }
.toast.bad { border-color: rgba(248, 113, 113, 0.6); }
.toast.gold { border-color: var(--gold); color: var(--gold); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all 0.3s ease; }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

.banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; animation: banner 4s ease forwards; }
.banner .b1 { font-family: var(--display); font-size: clamp(30px, 6vw, 58px); font-weight: 700; letter-spacing: 0.06em; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), 0 0 30px rgba(243, 201, 105, 0.45); }
.banner .b2 { font-size: clamp(12px, 2.4vw, 16px); letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 10px #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }

.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 18px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 2px #000; white-space: nowrap; will-change: transform, opacity; }
.floater.crit { font-size: 26px; color: #ffd166; }
.floater.dmg { color: #fff; }
.floater.hurt { color: #ff6b81; }
.floater.heal { color: #6bff9e; }
.floater.xp { color: #ffd166; font-size: 15px; }
.floater.miss { color: #c0c0c0; font-size: 14px; font-style: italic; }
.floater.info { color: #9fdcff; font-size: 14px; }
.nameplates { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.plate { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: grid; justify-items: center; gap: 2px; will-change: transform; }
.plate .pn { font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px #000, 0 0 2px #000; white-space: nowrap; }
.plate .pt { font-size: 10px; color: var(--ink-2); text-shadow: 0 1px 3px #000; white-space: nowrap; }
.plate .ph { width: 54px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.6); overflow: hidden; }
.plate .ph i { display: block; height: 100%; width: var(--v, 100%); background: linear-gradient(90deg, #ff4d6d, #ff8fa3); }
.plate.npc .pn { color: #ffe08a; }
.plate.legend .pn { color: var(--c, #ffd700); font-size: 14px; letter-spacing: 0.05em; }
.plate.player .pn { color: #9fdcff; }
.plate.enemy .pn { color: #ffb3b3; }
.plate.boss .pn { color: #ff8a65; font-size: 14px; }
.plate.pet .pn { color: #b9f6ca; }
.plate .bubble { max-width: 220px; padding: 6px 10px; border-radius: 12px; font-size: 12px; background: rgba(255, 255, 255, 0.92); color: #111; white-space: normal; text-align: center; margin-bottom: 4px; }

.ghost-veil { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 40%, rgba(80, 140, 255, 0.28) 100%); mix-blend-mode: screen; }
.ghost-msg { position: absolute; left: 50%; top: calc(150px + var(--safe-t)); transform: translateX(-50%); padding: 10px 16px; max-width: min(520px, 92vw); text-align: center; font-size: 14px; border-color: rgba(140, 200, 255, 0.5); }
.water-veil { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(40, 140, 220, 0.0) 40%, rgba(20, 90, 180, 0.25)); }
.peace-veil { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(255, 245, 200, 0.45); }

/* Controles táctiles */
.touch { position: absolute; inset: 0; pointer-events: none; }
.touch > * { pointer-events: auto; }
.joy { position: absolute; left: calc(18px + env(safe-area-inset-left, 0px)); bottom: calc(26px + var(--safe-b)); width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)); border: 1px solid rgba(255, 255, 255, 0.14); touch-action: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.15)); border: 1px solid rgba(255, 255, 255, 0.4); }
.tbtns { position: absolute; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(18px + var(--safe-b)); width: 200px; height: 290px; pointer-events: none; }
.tbtns > * { pointer-events: auto; }
.tbtn { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(20, 16, 44, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 24px; touch-action: none; }
.tbtn.big { width: 84px; height: 84px; right: 0; bottom: 0; font-size: 34px; background: radial-gradient(circle at 40% 30%, rgba(255, 210, 120, 0.5), rgba(120, 60, 0, 0.55)); border-color: var(--line); }
.tbtn.on { border-color: var(--gold); box-shadow: 0 0 16px rgba(243, 201, 105, 0.55); background: rgba(120, 80, 10, 0.55); }
.tbtn .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(0, 0, 0, 0.7) var(--p, 0%), transparent 0); }
.tbtn small { position: absolute; bottom: -14px; font-size: 9px; color: var(--ink-2); white-space: nowrap; }

/* ───────── Paneles ───────── */
.panel-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); background: rgba(5, 3, 15, 0.45); z-index: 8; animation: fadein 0.18s ease; }
@keyframes fadein { from { opacity: 0; } }
.panel { width: min(760px, 100%); max-height: min(86vh, 900px); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; animation: panelin 0.22s ease; }
.panel.wide { width: min(1040px, 100%); }
.panel.narrow { width: min(460px, 100%); }
@keyframes panelin { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin: 0; font-family: var(--display); font-size: 22px; display: flex; gap: 10px; align-items: center; }
.panel-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 14px 18px; overflow: auto; display: grid; gap: 14px; align-content: start; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.close-x { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.05); font-size: 20px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { min-height: 36px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.tab[aria-pressed='true'],
.tab[aria-selected='true'] { background: rgba(243, 201, 105, 0.14); border-color: var(--line); color: var(--gold); }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.item { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.35)); display: grid; place-items: center; font-size: 28px; padding: 4px; }
.item:hover, .item[aria-pressed='true'] { border-color: var(--gold); }
.item .q { position: absolute; bottom: 3px; right: 6px; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.item .eq { position: absolute; top: 3px; left: 5px; font-size: 10px; font-weight: 800; color: var(--gold); }
.item.r-crafted { box-shadow: inset 0 0 0 1px rgba(120, 200, 255, 0.35); }
.item.r-epic { box-shadow: inset 0 0 0 1px rgba(200, 120, 255, 0.55), 0 0 12px rgba(200, 120, 255, 0.25); }
.item-detail { padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line-2); display: grid; gap: 8px; }
.item-detail h3 { margin: 0; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.equip-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.equip-slot { padding: 8px; border-radius: 12px; border: 1px dashed var(--line-2); background: rgba(255, 255, 255, 0.03); text-align: center; font-size: 12px; color: var(--ink-3); min-height: 70px; display: grid; place-items: center; gap: 2px; }
.equip-slot:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.06); }
.equip-slot b { color: var(--ink); font-size: 12px; }
.equip-slot .i { font-size: 22px; }

.list { display: grid; gap: 8px; }
.li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); }
.li .ico { font-size: 26px; text-align: center; }
.li .t { font-weight: 700; }
.li .d { font-size: 12px; color: var(--ink-3); }
.li.bad .d { color: var(--bad); }
.li.disabled { opacity: 0.55; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.skill-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-size: 13px; }
.skill-row .val { font-weight: 800; color: var(--gold); min-width: 30px; text-align: right; }
.planet-map { display: grid; gap: 6px; justify-content: center; }
.pm-cell { width: 128px; min-height: 88px; padding: 8px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); font-size: 12px; display: grid; align-content: space-between; gap: 4px; }
.pm-cell.city { border-color: var(--line); background: rgba(243, 201, 105, 0.1); }
.pm-cell.here { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(243, 201, 105, 0.5); }
.pm-cell b { font-size: 13px; }
.pm-cell.empty { visibility: hidden; }
.dialog-face { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; }
.dialog-face .av { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.4)); border: 2px solid var(--line); }
.dialog-face p { margin: 0; line-height: 1.55; }
.quote { font-family: var(--display); font-size: 17px; font-style: italic; color: var(--ink); }
.progress { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress i { display: block; height: 100%; width: var(--v, 0%); background: linear-gradient(90deg, var(--gold-2), var(--gold)); }

/* Maniquí, restricciones, peluquería y mercado */
.inv-top { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.doll-box { display: grid; place-items: center; border-radius: 16px; background: radial-gradient(circle at 50% 35%, rgba(243, 201, 105, 0.16), rgba(0, 0, 0, 0.35)); border: 1px solid var(--line-2); }
.doll-canvas { display: block; cursor: grab; touch-action: none; }
.hint-naked { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: rgba(255, 210, 120, 0.1); border: 1px solid var(--line); }
.restr { font-size: 12px; margin-top: 2px; }
.restr.ok { color: #86efac; }
.restr.no { color: #fca5a5; }
.item.unusable { opacity: 0.55; }
.item.unusable::after { content: '✗'; position: absolute; top: 2px; right: 5px; font-size: 11px; color: #fca5a5; }
.salon { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.salon-controls { max-height: 56vh; overflow: auto; padding-right: 4px; }
.salon-controls .tab { min-height: 32px; padding: 4px 10px; }
.market-tools { gap: 8px; }
.market-search { flex: 1; min-width: 180px; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: var(--ink); user-select: text; -webkit-user-select: text; }
.market-sort { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: var(--ink); }
.market-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.market-cats .tab { white-space: nowrap; }
.market-body { display: grid; gap: 12px; }
.qty { width: 64px; min-height: 34px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: inherit; user-select: text; -webkit-user-select: text; }
.qty.wide { width: 90px; }
.small { font-size: 12px; }
@media (max-width: 760px) {
  .inv-top, .salon { grid-template-columns: 1fr; justify-items: center; }
}

/* Publicidad (demo) */
.ad-overlay { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(4, 2, 12, 0.82); padding: 16px; }
.ad-card { width: min(520px, 100%); padding: 18px; display: grid; gap: 14px; text-align: center; }
.ad-screen { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 30% 30%, #4b2a9a, #120a2e); display: grid; place-items: center; }
.ad-screen .ad-planet { width: 38%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b0, #f0a830 45%, #7a3b0c); box-shadow: 0 0 60px rgba(243, 201, 105, 0.6); animation: adspin 6s linear infinite; }
.ad-screen .ad-copy { position: absolute; left: 0; right: 0; bottom: 12px; font-family: var(--display); font-size: 20px; text-shadow: 0 2px 8px #000; }
@keyframes adspin { to { transform: rotate(360deg); } }
.ad-ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; font-weight: 800; font-size: 20px; background: conic-gradient(var(--gold) var(--p, 0%), rgba(255, 255, 255, 0.1) 0); position: relative; }
.ad-ring::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #120a2e; }
.ad-ring span { position: relative; z-index: 1; }

.loading { position: absolute; inset: 0; z-index: 30; display: grid; place-content: center; gap: 16px; text-align: center; background: radial-gradient(ellipse at center, rgba(30, 20, 70, 0.9), #05030d); }
.loading .ld-name { font-family: var(--display); font-size: clamp(30px, 6vw, 52px); }
.loading .ld-tip { color: var(--ink-2); max-width: 520px; margin: 0 auto; line-height: 1.5; font-size: 14px; }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .create { grid-template-columns: 1fr; grid-template-rows: 1fr auto; overflow: auto; }
  .create-stage { min-height: 46vh; order: -1; }
  .create-col { overflow: visible; }
}
@media (max-width: 760px) {
  .hud-top-left { width: min(250px, 58vw); }
  .hud-top-left .where { display: none; }
  .portrait { grid-template-columns: 42px 1fr; padding: 8px 10px; }
  .portrait .lv { width: 42px; height: 42px; font-size: 18px; }
  .minimap { width: 112px; height: 112px; }
  .top-buttons { max-width: 200px; }
  .icon-btn { width: 40px; height: 40px; font-size: 18px; }
  .hotbar { display: none; }
  .chat { width: calc(100vw - 236px); min-width: 130px; bottom: calc(184px + var(--safe-b)); }
  .chat-log { max-height: 84px; font-size: 11px; padding: 6px 8px; }
  .chat.compact .chat-input { display: none; }
  .chat.compact.open { left: 8px; right: 8px; width: auto; bottom: calc(50vh - 40px); z-index: 9; }
  .chat.compact.open .chat-input { display: flex; }
  .chat.compact.open .chat-log { max-height: 30vh; }
  .target-frame { top: auto; bottom: calc(240px + var(--safe-b)); width: 60vw; }
  .interact-hint { bottom: calc(196px + var(--safe-b)); }
  .work-bar { bottom: calc(236px + var(--safe-b)); }
  .panel { max-height: 92vh; }
  .panel-wrap { place-items: end center; padding-bottom: 0; }
  .panel { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .equip-slots { grid-template-columns: repeat(2, 1fr); }
  .pm-cell { width: 96px; min-height: 76px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
