:root {
  --sys-bg: rgba(8, 16, 32, 0.88);
  --sys-bg-solid: #081020;
  --sys-border: #4fc3ff;
  --sys-glow: rgba(79, 195, 255, 0.45);
  --sys-text: #d9f1ff;
  --sys-dim: #8fb4cc;
  --hp: #e3343f;
  --mp: #3b82ff;
  --xp: #ffd24a;
  --danger: #ff4a4a;
  --monarch: #b56cff;
  --gold: #ffcf5a;
  --ok: #6affb0;
  --font: 'Rajdhani', 'Segoe UI', 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #05070c; color: var(--sys-text); font-family: var(--font); }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; user-select: none; z-index: 10; }
#ui button, #ui input, #ui label, .sys-window { pointer-events: auto; }
.hidden { display: none !important; }
kbd {
  font-family: var(--font); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px; border: 1px solid var(--sys-border); border-radius: 3px;
  background: rgba(79, 195, 255, 0.12); color: #fff; box-shadow: 0 0 6px var(--sys-glow); letter-spacing: 0.04em; vertical-align: middle;
}
.monarch { color: var(--monarch) !important; text-shadow: 0 0 8px rgba(181, 108, 255, 0.7); }
.danger-text { color: #ffb0b0; }

/* ------------------------------------------------ System panel look (holographic window) */
.sys-panel, .sys-window, .notif {
  position: absolute; background: var(--sys-bg); border: 1px solid var(--sys-border);
  box-shadow: 0 0 14px var(--sys-glow), inset 0 0 22px rgba(79, 195, 255, 0.14);
}
/* thin inner border */
.sys-panel::before, .sys-window::before, .notif::before {
  content: ''; position: absolute; inset: 3px; border: 1px solid rgba(79, 195, 255, 0.28); pointer-events: none;
}
/* scanlines (flickering) + a slow bright sweep; transform/opacity only so they stay on the compositor */
.sys-window::after, .notif::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(120, 200, 255, 0.05) 0 1px, transparent 1px 3px);
  animation: scanFlicker 5s steps(1) infinite;
}
.sweep { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sweep i {
  position: absolute; left: 0; right: 0; top: 0; height: 40%; will-change: transform; animation: sweepY 3.8s linear infinite;
  background: linear-gradient(180deg, transparent 0%, rgba(140, 220, 255, 0.07) 46%, rgba(140, 220, 255, 0.14) 50%, rgba(140, 220, 255, 0.07) 54%, transparent 100%);
}
@keyframes sweepY { from { transform: translateY(-100%); } to { transform: translateY(260%); } }
@keyframes scanFlicker { 0%, 100% { opacity: 0.7; } 41% { opacity: 0.35; } 42% { opacity: 0.8; } 76% { opacity: 0.5; } 77% { opacity: 0.75; } }
/* glowing corner brackets */
.cn { position: absolute; width: 14px; height: 14px; border: 0 solid #9fe4ff; filter: drop-shadow(0 0 4px var(--sys-border)); pointer-events: none; }
.cn.tl { top: -2px; left: -2px; border-top-width: 2px; border-left-width: 2px; }
.cn.tr { top: -2px; right: -2px; border-top-width: 2px; border-right-width: 2px; }
.cn.bl { bottom: -2px; left: -2px; border-bottom-width: 2px; border-left-width: 2px; }
.cn.br { bottom: -2px; right: -2px; border-bottom-width: 2px; border-right-width: 2px; }

.sys-btn {
  font-family: var(--font); font-weight: 700; font-size: 18px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sys-text);
  background: rgba(10, 30, 60, 0.75); border: 1px solid var(--sys-border); padding: 10px 26px; cursor: pointer; position: relative;
  box-shadow: 0 0 10px rgba(79, 195, 255, 0.3), inset 0 0 12px rgba(79, 195, 255, 0.12); transition: background 0.12s, box-shadow 0.12s, transform 0.08s;
}
.sys-btn:hover, .sys-btn:focus-visible { background: rgba(40, 110, 180, 0.55); box-shadow: 0 0 18px rgba(79, 195, 255, 0.7), inset 0 0 16px rgba(79, 195, 255, 0.3); color: #fff; outline: none; }
.sys-btn:active { transform: scale(0.97); }
.sys-btn.primary { border-color: #8fe0ff; color: #fff; background: rgba(20, 60, 110, 0.8); }
.sys-btn.danger { border-color: var(--danger); color: #ffd6d6; box-shadow: 0 0 10px rgba(255, 74, 74, 0.4), inset 0 0 12px rgba(255, 74, 74, 0.15); }
.sys-btn.danger:hover { background: rgba(140, 20, 20, 0.55); box-shadow: 0 0 18px rgba(255, 74, 74, 0.7); }
.sys-btn.elixir { border-color: #ffe27a; color: #fff6d0; background: rgba(90, 70, 10, 0.7); box-shadow: 0 0 14px rgba(255, 226, 122, 0.55), inset 0 0 12px rgba(255, 226, 122, 0.2); } /* Elixir of Life (death window) */
.sys-btn.elixir:hover { background: rgba(140, 110, 20, 0.75); box-shadow: 0 0 20px rgba(255, 226, 122, 0.85); }
.sys-btn small { font-size: 13px; letter-spacing: 0.06em; color: var(--sys-dim); margin-left: 8px; text-transform: none; }

/* ------------------------------------------------ title */
#title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.title-shade {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(10, 14, 40, 0.1) 0%, rgba(5, 6, 20, 0.65) 60%, rgba(2, 2, 10, 0.95) 100%),
    linear-gradient(180deg, rgba(20, 0, 50, 0.35), rgba(0, 0, 0, 0.6));
}
.title-scan {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.5; overflow: hidden;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 4px);
}
.title-scan::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 18%; will-change: transform; animation: titleScan 6s linear infinite;
  background: linear-gradient(180deg, transparent, rgba(79, 195, 255, 0.12) 50%, transparent);
}
@keyframes titleScan { from { transform: translateY(-100%); } to { transform: translateY(560%); } }
.title-corner { position: absolute; top: 18px; font-size: 13px; font-weight: 700; letter-spacing: 0.3em; color: rgba(143, 216, 255, 0.65); }
.title-corner.tl { left: 22px; }
.title-corner.tr { right: 22px; }
.title-corner b { color: #bfe9ff; }
.title-inner { position: relative; text-align: center; animation: titleIn 1.4s cubic-bezier(.2, .9, .3, 1) both; }
.kicker { font-size: 15px; letter-spacing: 0.5em; color: #8fd8ff; text-shadow: 0 0 10px #2a9cff; margin-bottom: 10px; animation: flicker 3.5s infinite; }
.logo { margin: 0; line-height: 0.9; }
.logo-top {
  display: block; font-size: clamp(48px, 8.5vw, 112px); font-weight: 700; letter-spacing: 0.08em; color: #f2fbff;
  text-shadow: 0 0 18px #3aa8ff, 0 0 42px #1a5aff, 0 4px 0 #0a2a6a;
}
.logo-craft {
  display: inline-block; margin-top: 8px; font-size: clamp(40px, 6.5vw, 86px); font-weight: 700; letter-spacing: 0.32em; padding-left: 0.32em;
  color: #b56cff; text-shadow: 4px 4px 0 #2a0a50, 0 0 26px #8a2be2, 0 0 60px rgba(138, 43, 226, 0.45); font-family: Silkscreen, 'Courier New', monospace;
}
.tagline { margin-top: 14px; font-size: 18px; letter-spacing: 0.18em; color: var(--sys-dim); text-transform: uppercase; }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 40px; }
.menu .sys-btn { width: 340px; animation: menuIn 0.5s cubic-bezier(.2, .9, .3, 1) both; }
.menu .sys-btn small { display: block; margin: 1px 0 0; font-size: 12px; }
.menu .sys-btn:nth-child(1) { animation-delay: 0.7s; }
.menu .sys-btn:nth-child(2) { animation-delay: 0.82s; }
.menu .sys-btn:nth-child(3) { animation-delay: 0.94s; }
.title-foot { position: absolute; bottom: 18px; width: 100%; text-align: center; font-size: 13px; letter-spacing: 0.2em; color: rgba(160, 200, 230, 0.5); text-transform: uppercase; }
@keyframes titleIn { from { opacity: 0; transform: scale(1.08); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(10px) scaleX(0.8); } to { opacity: 1; transform: none; } }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.3; } 95% { opacity: 1; } 97% { opacity: 0.5; } }

/* ------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; }
#hud-stats { top: 16px; left: 16px; width: 320px; padding: 12px 14px 10px; }
.hs-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.lv { display: flex; align-items: baseline; gap: 2px; padding-right: 12px; border-right: 1px solid rgba(79, 195, 255, 0.35); }
.lv small { font-size: 14px; color: var(--sys-dim); font-weight: 700; }
.lv b { font-size: 38px; line-height: 1; color: #fff; text-shadow: 0 0 10px var(--sys-border); }
.who .name { font-weight: 700; letter-spacing: 0.16em; font-size: 16px; color: #fff; }
.who .job { font-size: 14px; color: var(--sys-dim); letter-spacing: 0.06em; }
.pts { margin-left: auto; align-self: flex-start; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--gold); text-shadow: 0 0 8px rgba(255, 207, 90, 0.6); animation: flicker 2s infinite; }
.bar { position: relative; height: 16px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); margin-top: 5px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.bar i.fill { transition: width 0.12s; }
.bar i.chip { background: rgba(255, 245, 230, 0.85); }
.bar span { position: absolute; right: 6px; top: -1px; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.bar em { position: absolute; left: 6px; top: -1px; font-size: 12px; font-style: normal; font-weight: 700; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px #000; }
.bar.hp i.fill { background: linear-gradient(180deg, #ff6a70, var(--hp) 55%, #a01820); box-shadow: 0 0 8px rgba(227, 52, 63, 0.7); }
.bar.hp.low i.fill { animation: lowhp 0.6s infinite alternate; }
.bar.mp i.fill { background: linear-gradient(180deg, #7ab0ff, var(--mp) 55%, #1a4ab0); box-shadow: 0 0 8px rgba(59, 130, 255, 0.7); }
.bar.mp i.chip { background: rgba(190, 215, 255, 0.55); }
.xp-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bar.xp { flex: 1; height: 5px; margin-top: 0; }
.bar.xp i.fill { background: linear-gradient(90deg, #ffb020, var(--xp)); box-shadow: 0 0 6px rgba(255, 210, 74, 0.8); transition: width 0.35s; }
#h-xp { font-size: 11px; font-weight: 700; color: rgba(255, 220, 140, 0.85); letter-spacing: 0.04em; white-space: nowrap; }
#xp-pop { position: absolute; right: 14px; bottom: -6px; height: 0; }
.xpp { position: absolute; right: 0; bottom: 0; white-space: nowrap; font-size: 16px; font-weight: 700; color: var(--xp); text-shadow: 0 0 8px rgba(255, 180, 40, 0.9), 0 1px 2px #000; opacity: 0; }
.xpp.go { animation: xpUp 1.4s ease-out forwards; }
@keyframes xpUp { 0% { opacity: 0; transform: translateY(10px) scale(1.3); } 12% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes lowhp { from { filter: brightness(1); } to { filter: brightness(1.7); } }

#quest { top: 16px; right: 16px; width: 300px; padding: 10px 14px 12px; font-size: 15px; }
.qsec + .qsec { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(79, 195, 255, 0.22); }
.qh { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.03em; color: #fff; margin-bottom: 4px; font-size: 13.5px; white-space: nowrap; }
.qh small { margin-left: auto; font-size: 11px; letter-spacing: 0.16em; color: var(--sys-dim); text-transform: uppercase; }
.qtag { font-size: 10px; letter-spacing: 0.18em; padding: 1px 5px; border: 1px solid var(--sys-border); color: #bfe9ff; box-shadow: 0 0 6px var(--sys-glow); }
.qtag.red { border-color: var(--danger); color: #ffc0c0; box-shadow: 0 0 6px rgba(255, 74, 74, 0.6); }
.qtag.purple { border-color: var(--monarch); color: #e6d0ff; box-shadow: 0 0 6px rgba(181, 108, 255, 0.6); }
.ql { display: flex; align-items: center; gap: 7px; color: var(--sys-text); line-height: 1.5; }
.ql span { flex: 1; }
.ql b { font-weight: 700; color: #fff; }
.ql kbd { height: 16px; font-size: 10px; min-width: 16px; }
.ck { flex: none; width: 9px; height: 9px; border: 1px solid rgba(143, 180, 204, 0.8); transform: rotate(45deg); }
.ql.done .ck { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 6px var(--ok); }
.ql.done span, .ql.done b { color: var(--ok); }
.ql.now .ck { border-color: var(--gold); box-shadow: 0 0 6px var(--gold); animation: flicker 1.6s infinite; }
.ql.now span { color: #fff; }
.qsec.locked { opacity: 0.6; }
.qsec.job .qh { color: #ffd6d6; }
.qsec.army .qh { color: #ead8ff; }
.qsec.army .ql b { color: #e0c0ff; }
.qo { margin-top: 9px; padding-top: 7px; border-top: 1px solid rgba(79, 195, 255, 0.3); color: var(--gold); font-weight: 700; letter-spacing: 0.02em; }
.qo::before { content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 1px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 6px var(--gold); }

#controls-hint { left: 16px; bottom: 16px; padding: 8px 12px 10px; font-size: 13px; width: 222px; opacity: 0.88; }
#controls-hint .ph { font-weight: 700; letter-spacing: 0.16em; margin-bottom: 4px; color: #fff; }
#controls-hint .ph small { color: var(--sys-dim); }
#controls-hint .row { display: flex; gap: 8px; align-items: center; line-height: 1.55; }
#controls-hint kbd { min-width: 46px; height: 17px; font-size: 11px; }

#skillbar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 10px; padding-bottom: 14px; }
.slot {
  position: relative; width: 64px; height: 64px; background: var(--sys-bg); border: 1px solid var(--sys-border);
  box-shadow: 0 0 10px var(--sys-glow), inset 0 0 14px rgba(79, 195, 255, 0.15); display: flex; align-items: center; justify-content: center;
}
.slot .ico { width: 34px; height: 34px; color: #bfe9ff; filter: drop-shadow(0 0 4px #4fc3ff); }
.slot .ico svg, .slot .lock svg { width: 100%; height: 100%; }
.slot .cd { position: absolute; inset: 0; }
.slot .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; text-shadow: 0 0 6px #000, 0 1px 2px #000; }
.slot kbd { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); height: 17px; font-size: 11px; background: var(--sys-bg-solid); }
.slot .sname { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: #e6f6ff; white-space: nowrap; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 8px rgba(0, 0, 0, 0.85); }
.slot .mpc { position: absolute; left: 4px; bottom: 1px; font-style: normal; font-size: 11px; font-weight: 700; color: #a8c8ff; text-shadow: 0 0 3px #000, 0 1px 2px #000; }
.slot .cnt { position: absolute; right: 4px; bottom: 1px; font-size: 14px; color: var(--monarch); text-shadow: 0 0 6px var(--monarch); }
.slot .lock { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; color: rgba(200, 220, 240, 0.7); background: rgba(0, 0, 0, 0.6); }
.slot.locked .lock { display: flex; }
.slot.locked { border-color: rgba(79, 195, 255, 0.35); box-shadow: none; }
.slot.locked .ico { opacity: 0.25; }
.slot.locked .mpc { display: none; }
.slot.dim .ico { opacity: 0.45; filter: grayscale(1); }
.slot.dim .mpc { color: var(--danger); }
.slot.fire { animation: slotFire 0.22s ease-out; }
.slot.ready { animation: slotReady 0.45s ease-out; }
@keyframes slotFire { 0% { transform: scale(0.9); background: rgba(79, 195, 255, 0.45); } 100% { transform: none; } }
@keyframes slotReady { 0% { box-shadow: 0 0 26px #bff0ff, inset 0 0 26px rgba(191, 240, 255, 0.7); } 100% { box-shadow: 0 0 10px var(--sys-glow), inset 0 0 14px rgba(79, 195, 255, 0.15); } }
.slot[data-skill="arise"]:not(.locked) .ico, .slot[data-i="5"]:not(.locked) .ico { color: #e0c0ff; filter: drop-shadow(0 0 5px var(--monarch)); }
.slot[data-skill="domain"] .ico { color: #e0c0ff; filter: drop-shadow(0 0 5px var(--monarch)); }
.slot[data-skill="domain"].active { border-color: #d0a0ff; box-shadow: 0 0 18px #9a40ff, inset 0 0 18px rgba(154, 64, 255, 0.45); }
.slot .slv { position: absolute; right: 3px; top: 2px; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--gold); text-shadow: 0 0 3px #000, 0 1px 2px #000; }
.slot .lock { flex-direction: column; gap: 1px; padding: 14px 18px 8px; }
.slot .lock svg { height: auto; flex: 1; min-height: 0; }
.slot .lock small { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: #cfe6f6; }
.slot.active { border-color: #9fe4ff; box-shadow: 0 0 18px #7fd0ff, inset 0 0 18px rgba(127, 208, 255, 0.45); }
.slot.active .ico { color: #fff; animation: flicker 1.2s infinite; }
.slot.active .cd { background: none !important; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
#crosshair i { position: absolute; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 3px #000; }
#crosshair i:first-child { left: 8px; top: 0; width: 2px; height: 18px; }
#crosshair i:last-child { top: 8px; left: 0; height: 2px; width: 18px; }

#bossbar { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: min(560px, 46vw); text-align: center; padding: 6px 12px 4px; background: rgba(10, 4, 8, 0.55); }
#bossbar.intro { animation: bossIn 0.8s cubic-bezier(.2, .9, .3, 1) both; }
#bossbar.dead { opacity: 0.4; transition: opacity 1.2s; }
.boss-name { font-size: 20px; font-weight: 700; letter-spacing: 0.12em; color: #fff; text-shadow: 0 0 10px #ff2a2a, 0 2px 2px #000; margin-bottom: 4px; text-transform: uppercase; }
.boss-name small { font-size: 14px; color: #ffb0b0; letter-spacing: 0.1em; }
.boss-track { position: relative; height: 14px; background: rgba(0, 0, 0, 0.7); border: 1px solid #ff5050; box-shadow: 0 0 12px rgba(255, 60, 60, 0.6); }
.boss-track i { position: absolute; left: 0; top: 0; bottom: 0; }
.boss-track .lag { background: #ffe0a0; }
.boss-track .fill { background: linear-gradient(180deg, #ff6060, #c01818 60%, #800808); }
.boss-track .tick { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: rgba(255, 255, 255, 0.7); box-shadow: 0 0 4px #000; }
.boss-hp { margin-top: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: #ffc8c8; text-shadow: 0 1px 2px #000; }
#bossbar.enraged .boss-track { animation: enrage 0.9s ease-in-out infinite alternate; }
#bossbar.enraged .boss-name { color: #ffe0e0; text-shadow: 0 0 16px #ff0000, 0 2px 2px #000; }
@keyframes enrage { from { box-shadow: 0 0 10px rgba(255, 60, 60, 0.6); } to { box-shadow: 0 0 26px rgba(255, 30, 30, 1); } }
@keyframes bossIn { from { opacity: 0; transform: translateX(-50%) scaleX(0.2); } to { opacity: 1; transform: translateX(-50%); } }

#prompts { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.prompt {
  display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: var(--sys-bg); border: 1px solid var(--sys-border);
  box-shadow: 0 0 12px var(--sys-glow); font-size: 18px; font-weight: 700; letter-spacing: 0.04em; animation: promptIn 0.18s ease-out; white-space: nowrap;
}
.prompt kbd { font-size: 14px; height: 24px; min-width: 26px; }
.prompt.danger { border-color: var(--danger); box-shadow: 0 0 14px rgba(255, 74, 74, 0.6); color: #ffd0d0; }
.prompt.danger kbd { border-color: var(--danger); box-shadow: 0 0 6px var(--danger); }
.prompt.arise { border-color: var(--monarch); box-shadow: 0 0 16px rgba(181, 108, 255, 0.8); color: #f0e0ff; letter-spacing: 0.16em; animation: promptIn 0.18s ease-out, arisePulse 1.1s ease-in-out infinite alternate; }
.prompt.arise kbd { border-color: var(--monarch); box-shadow: 0 0 8px var(--monarch); }
.prompt.capture { font-size: 15px; opacity: 0.92; }
.prompt.capture kbd { font-size: 12px; height: 20px; }
@keyframes promptIn { from { opacity: 0; transform: translateY(6px); } }
/* debug panel (?debug=1): collapsed to one button, touch-sized when open */
#debug-panel { position: absolute; right: 16px; top: 46%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 4; }
#debug-panel button { font-family: var(--font); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; color: #ffd6a0; background: rgba(40, 20, 0, 0.82); border: 1px solid #ffb040; min-height: 40px; padding: 0 12px; cursor: pointer; }
#debug-panel button:active { transform: scale(0.95); }
#debug-panel .dbg-btns { display: none; grid-template-columns: 1fr 1fr; gap: 6px; }
#debug-panel.open .dbg-btns { display: grid; }
#debug-panel .dbg-btns button { min-width: 104px; min-height: 44px; }
@keyframes arisePulse { from { box-shadow: 0 0 10px rgba(181, 108, 255, 0.6); } to { box-shadow: 0 0 24px rgba(181, 108, 255, 1); } }

#markers { position: absolute; inset: 0; }
.mk { position: absolute; left: 0; top: 0; display: none; text-align: center; color: #fff; font-weight: 700; font-size: 13px; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.mk i { display: block; width: 14px; height: 14px; margin: 0 auto 2px; border: 2px solid var(--mc); background: rgba(0, 0, 0, 0.35); transform: rotate(45deg); box-shadow: 0 0 8px var(--mc); }
.mk span { display: block; color: var(--mc); }
.mk em { font-style: normal; font-size: 12px; opacity: 0.85; }
.mk.crowd span, .mk.crowd em { display: none; }

/* ------------------------------------------------ damage numbers */
#dmg { position: absolute; inset: 0; overflow: hidden; }
.dn { position: absolute; left: 0; top: 0; display: none; font-weight: 700; font-size: 22px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8); white-space: nowrap; will-change: transform; }
.dn.crit { color: #ffe14a; font-size: 32px; text-shadow: 0 2px 0 #6a3a00, 0 0 12px #ff9a1a; }
.dn.shadow { color: #6ab8ff; text-shadow: 0 2px 0 #001a3a, 0 0 10px #2f7bff; }
.dn.shadow.crit-s { font-size: 28px; color: #cfeaff; }
.dn.shadow.dom { color: #c98cff; text-shadow: 0 2px 0 #1a0030, 0 0 10px #8a2be2; } /* Monarch's Domain */
.dn.shadow.dom.crit-s { color: #e2c0ff; }
.dn.poison { color: #6aff8a; font-size: 17px; }
.dn.player { color: #ff4a4a; font-size: 20px; }
.dn.ally-hurt { color: #a090b0; font-size: 15px; }
.dn.blocked { color: #8fd8ff; font-size: 18px; letter-spacing: 0.12em; text-shadow: 0 2px 0 #00203a, 0 0 8px #4fc3ff; }
.dn.dodge { color: #bfefff; font-size: 17px; letter-spacing: 0.12em; text-shadow: 0 2px 0 #00203a, 0 0 10px #4fc3ff; }
.dn.ambush { color: #9fe4ff; font-size: 24px; letter-spacing: 0.2em; text-shadow: 0 2px 0 #00203a, 0 0 14px #4fc3ff, 0 0 26px #1a6aff; }

/* ------------------------------------------------ notifications (queued, top centre) */
#notifs.veiled { visibility: hidden; }
#notifs { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(460px, 42vw); z-index: 5; }
.notif { position: relative; min-width: 280px; max-width: 100%; padding: 7px 18px 9px; text-align: center; animation: sysIn 0.36s cubic-bezier(.2, .9, .3, 1.2) both; }
.notif.out { animation: sysOut 0.35s ease-in forwards; }
.notif .nh { font-weight: 700; letter-spacing: 0.22em; font-size: 15px; color: #fff; text-shadow: 0 0 8px var(--sys-border); display: flex; align-items: center; justify-content: center; gap: 8px; }
.notif .nl { font-size: 16px; font-weight: 600; color: var(--sys-text); margin-top: 2px; }
.notif.quest { border-color: #ffe08a; box-shadow: 0 0 16px rgba(255, 207, 90, 0.45), inset 0 0 20px rgba(255, 207, 90, 0.1); }
.notif.quest .nh { color: #fff3c0; text-shadow: 0 0 10px var(--gold); }
.notif.level { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 207, 90, 0.6), inset 0 0 20px rgba(255, 207, 90, 0.15); }
.notif.level .nh { color: var(--gold); }
.notif.danger { border-color: var(--danger); box-shadow: 0 0 14px rgba(255, 74, 74, 0.55), inset 0 0 20px rgba(255, 74, 74, 0.12); }
.notif.danger .nh { color: #ffb0b0; text-shadow: 0 0 8px var(--danger); }
.notif.monarch { border-color: var(--monarch); box-shadow: 0 0 20px rgba(181, 108, 255, 0.75), inset 0 0 24px rgba(181, 108, 255, 0.2); background: rgba(18, 8, 34, 0.92); }
.notif.monarch .nh, .notif.monarch .nl { color: #f0e0ff; text-shadow: 0 0 10px var(--monarch); }
.notif.monarch .nh { font-size: 18px; }
.notif.item { border-color: #8affd0; }
.notif.item .nh { color: #c0ffe0; }
.notif.danger .cn, .sys-window.danger .cn { border-color: #ff9a9a; filter: drop-shadow(0 0 4px var(--danger)); }
.notif.monarch .cn { border-color: #e0c0ff; filter: drop-shadow(0 0 4px var(--monarch)); }
.notif.quest .cn, .notif.level .cn { border-color: #ffe9a8; filter: drop-shadow(0 0 4px var(--gold)); }
.sw-icon {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 3px; border: 1px solid currentColor;
  border-radius: 50%; font-size: 12px; font-weight: 700; flex: none; letter-spacing: 0;
}
@keyframes sysIn { 0% { opacity: 0; transform: scaleY(0.04) scaleX(1.12); } 40% { opacity: 1; transform: scaleY(1.06); } 55% { opacity: 0.55; } 64% { opacity: 1; } 72% { opacity: 0.8; transform: none; } 100% { opacity: 1; transform: none; } }
@keyframes sysOut { to { opacity: 0; transform: scaleY(0.08) scaleX(1.06); } }

.code-box { width: 100%; min-height: 96px; max-height: 30vh; padding: 8px; font: 12px/1.35 ui-monospace, monospace; color: #d8ecff; word-break: break-all;
  background: rgba(0, 10, 25, 0.85); border: 1px solid var(--sys-border); resize: vertical; -webkit-user-select: text; user-select: text; }
.code-msg { min-height: 1.4em; color: #9fe0ff; }
#update-bar { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 20;
  min-height: 44px; padding: 10px 22px; pointer-events: auto; cursor: pointer; font: 700 15px/1.2 inherit; letter-spacing: 0.08em; color: #fff;
  background: rgba(10, 40, 80, 0.92); border: 1px solid var(--sys-border); box-shadow: 0 0 18px rgba(79, 195, 255, 0.55); animation: flicker 2.5s infinite; }
#banner { position: absolute; top: 46%; left: 0; right: 0; text-align: center; opacity: 0; z-index: 6; }
#banner.on { animation: banner 2.4s ease-out forwards; }
#banner .bt { font-size: 64px; font-weight: 700; letter-spacing: 0.3em; color: #fff; text-shadow: 0 0 20px #ff3030, 0 0 50px #a00000, 0 4px 0 #300; }
#banner .bl { font-size: 20px; letter-spacing: 0.1em; color: #ffd0d0; }
#banner.domain .bt { color: #f5ecff; text-shadow: 0 0 20px #b56cff, 0 0 50px #6a00d0, 0 4px 0 #22003c; }
#banner.domain .bl { color: #e6d0ff; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.6); letter-spacing: 0.6em; } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* big LEVEL UP! flash */
#levelup { position: absolute; top: 40%; left: 0; right: 0; height: 0; text-align: center; opacity: 0; z-index: 6; }
#levelup::before { content: ''; position: absolute; left: 50%; top: -30px; width: min(1000px, 96vw); height: 190px; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(24, 12, 0, 0.72), rgba(24, 12, 0, 0.3) 45%, transparent 70%); }
#levelup > * { position: relative; }
#levelup .lu-line {
  position: absolute; left: 50%; top: 46px; width: min(900px, 90vw); height: 3px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #fff3c0 30%, #fff 50%, #fff3c0 70%, transparent); box-shadow: 0 0 24px #ffcf5a, 0 0 60px #ff9a1a;
}
#levelup .lu-t {
  display: block; width: max-content; margin: 0 auto; font-size: 88px; line-height: 1; font-weight: 700; letter-spacing: 0.2em; padding-left: 0.2em;
  color: transparent; background: linear-gradient(180deg, #fffbe6 0%, #ffe27a 45%, #ff9a1a 100%); -webkit-background-clip: text; background-clip: text;
  -webkit-text-stroke: 1.5px rgba(80, 36, 0, 0.95); filter: drop-shadow(0 4px 0 #3a1a00) drop-shadow(0 0 16px rgba(255, 160, 30, 0.95));
}
#levelup .lu-s { display: block; margin-top: 10px; font-size: 28px; font-weight: 700; letter-spacing: 0.4em; padding-left: 0.4em; color: #fff1c4; -webkit-text-stroke: 0.6px #4a2a00; text-shadow: 0 0 12px #ff9a1a, 0 2px 0 #3a1a00; }
#levelup.on { animation: levelup 2.2s ease-out forwards; }
#levelup.on .lu-line { animation: luLine 2.2s ease-out forwards; }
#levelup.on .lu-t { animation: luText 2.2s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes levelup { 0% { opacity: 0; } 8% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
@keyframes luLine { 0% { transform: translateX(-50%) scaleX(0); } 18% { transform: translateX(-50%) scaleX(1); } 100% { transform: translateX(-50%) scaleX(1.1); opacity: 0.4; } }
@keyframes luText { 0% { transform: scale(1.8); letter-spacing: 0.6em; opacity: 0; } 16% { transform: none; letter-spacing: 0.2em; opacity: 1; } 22% { transform: scale(1.06); } 30% { transform: none; } 100% { transform: none; } }

#vignette, #lowhp, #deathfx, #flash { position: absolute; inset: 0; opacity: 0; }
#vignette.hurt { animation: vig 0.5s ease-out; background: radial-gradient(ellipse at center, transparent 50%, rgba(200, 0, 0, 0.55) 100%); }
#vignette.blood { animation: vig 1.2s ease-out; background: radial-gradient(ellipse at center, transparent 30%, rgba(160, 0, 20, 0.7) 100%); }
#lowhp { background: radial-gradient(ellipse at center, transparent 55%, rgba(170, 0, 0, 0.5) 100%); transition: opacity 0.4s; }
#lowhp.on { animation: heartbeat 1.1s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { opacity: 0.35; } 12% { opacity: 0.85; } 24% { opacity: 0.45; } 36% { opacity: 0.8; } }
#deathfx { background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.35) 0%, rgba(20, 0, 0, 0.85) 100%); transition: opacity 1.2s; }
#deathfx.on { opacity: 1; backdrop-filter: grayscale(0.85); }
@keyframes vig { 0% { opacity: 1; } 100% { opacity: 0; } }
#flash.gate { background: #d8f0ff; animation: vig 0.9s ease-out; }
#flash.fadein { background: #000; animation: vig 0.7s ease-out; }
#flash.heart { background: radial-gradient(ellipse at center, rgba(255, 0, 0, 0.1), rgba(160, 0, 0, 0.75)); animation: vig 1s ease-out; }

/* ------------------------------------------------ modal windows */
#modal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 7; }
#modal.open { display: flex; background: rgba(0, 4, 12, 0.4); pointer-events: auto; }
/* a window taller than the screen scrolls instead of losing its top (Close) off-screen: auto margins centre it
   but never push it past the top edge; the notch never covers it */
#modal.open, #econ, #party { overflow-y: auto; overscroll-behavior: contain;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#modal > .sys-window, #econ > .sys-window, #party > .sys-window { margin: auto; flex-shrink: 0; }
:root { --vh: 1vh; } /* ui.js sets the real visible height */
.sys-window { position: relative; display: flex; flex-direction: column; width: min(540px, 92vw); max-height: calc(var(--vh) * 94); padding: 0 0 22px; animation: sysIn 0.42s cubic-bezier(.2, .9, .3, 1.2) both; }
.sys-window.wide { width: min(760px, 94vw); }
.sys-window.shake { animation: shake 0.45s; }
.sw-head {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 20px 12px; margin: 0 18px;
  font-weight: 700; font-size: 22px; letter-spacing: 0.32em; color: #fff; text-shadow: 0 0 10px var(--sys-border);
  border-bottom: 1px solid rgba(79, 195, 255, 0.45);
}
.sw-body { padding: 18px 30px 6px; text-align: center; font-size: 18px; line-height: 1.5; flex: 1 1 auto; min-height: 0; overflow-y: auto; } /* short screens scroll */
.tab-body { min-height: min(500px, calc(var(--vh) * 94 - 170px)); } /* Status and Shadows tabs keep one frame size */
.sw-body p { margin: 8px 0; }
.sw-body .big { font-size: 22px; font-weight: 600; }
.sw-body .big b { color: #fff; text-shadow: 0 0 8px var(--sys-border); }
.sw-body .huge { font-size: 52px; font-weight: 700; letter-spacing: 0.16em; color: #ff6a6a; text-shadow: 0 0 18px #ff0000; margin: 4px 0 10px; animation: flicker 2.5s infinite; }
.sw-body .cause { font-size: 17px; color: #ffc8c8; letter-spacing: 0.06em; }
.sw-body .cause b { color: #fff; }
.sw-body .sec { color: #fff; font-size: 28px; text-shadow: 0 0 12px var(--danger); }
.sw-buttons { display: flex; gap: 14px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.sys-window.danger { border-color: var(--danger); box-shadow: 0 0 24px rgba(255, 50, 50, 0.65), inset 0 0 26px rgba(255, 50, 50, 0.16); background: rgba(28, 8, 14, 0.9); }
.sys-window.danger::before { border-color: rgba(255, 74, 74, 0.35); }
.sys-window.danger .sw-head { color: #ffd0d0; text-shadow: 0 0 10px var(--danger); border-color: rgba(255, 74, 74, 0.5); }
.hint { font-size: 15px; color: var(--sys-dim); }
@keyframes shake { 15% { transform: translateX(-12px); } 30% { transform: translateX(10px); } 45% { transform: translateX(-8px); } 60% { transform: translateX(6px); } 80% { transform: translateX(-3px); } }

.ctrl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; text-align: left; }
.ctrl-grid div { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.ctrl-grid kbd { min-width: 60px; }
/* pause */
.pause-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; text-align: left; }
.sec-h { font-size: 13px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: var(--sys-border); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(79, 195, 255, 0.25); }
.set { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; margin: 9px 0; font-size: 16px; cursor: pointer; }
.set.chk { grid-template-columns: 150px 1fr; }
.set b { text-align: right; color: #fff; }
.set input[type=range] { accent-color: var(--sys-border); width: 100%; }
.set input[type=checkbox] { accent-color: var(--sys-border); width: 18px; height: 18px; justify-self: start; }
.pause-info { margin-top: 14px; padding-top: 10px; border-top: 1px dashed rgba(79, 195, 255, 0.25); font-size: 15px; color: var(--sys-dim); }
.pause-info b { color: #fff; }
.ctrl-list div { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.75; }
.ctrl-list kbd { min-width: 50px; height: 18px; font-size: 11px; }

/* status window */
.tabs { display: flex; gap: 6px; align-items: center; margin: -4px 0 14px; }
.tab { font-family: var(--font); font-weight: 700; font-size: 16px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sys-dim); background: transparent; border: 1px solid rgba(79, 195, 255, 0.35); padding: 6px 16px; cursor: pointer; }
.tab:hover { color: #fff; }
.tab.on { color: #fff; background: rgba(79, 195, 255, 0.18); border-color: var(--sys-border); box-shadow: 0 0 10px var(--sys-glow); }
.tab small { color: var(--monarch); }
.tab-close { margin-left: auto; font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--sys-dim); letter-spacing: 0.1em; background: none; border: 0; padding: 6px 4px; cursor: pointer; text-transform: uppercase; }
.tab-close:hover { color: #fff; }
.st-preview { margin-top: 10px; padding: 6px 10px; border: 1px dashed rgba(79, 195, 255, 0.3); color: var(--sys-dim); font-size: 14px; text-align: left; min-height: 34px; }
.st-preview.on { border-style: solid; border-color: var(--gold); color: #ffe6a0; font-weight: 700; letter-spacing: 0.02em; }
.st-preview kbd { height: 16px; min-width: 16px; font-size: 11px; padding: 0 4px; }
/* skills tab */
.sk-list { display: grid; gap: 8px; text-align: left; }
.sk { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 8px 12px; border: 1px solid rgba(79, 195, 255, 0.4); background: rgba(10, 30, 60, 0.35); box-shadow: inset 0 0 14px rgba(79, 195, 255, 0.1); }
.sk-ico { width: 52px; height: 52px; padding: 9px; color: #bfe9ff; border: 1px solid var(--sys-border); box-shadow: 0 0 8px var(--sys-glow), inset 0 0 12px rgba(79, 195, 255, 0.2); filter: drop-shadow(0 0 4px #4fc3ff); }
.sk-ico svg { width: 100%; height: 100%; }
.sk-top { display: flex; align-items: center; gap: 10px; }
.sk-top > b { font-size: 19px; letter-spacing: 0.1em; text-transform: uppercase; color: #fff; }
.sk-top kbd { min-width: 30px; }
.sk-lv { margin-left: auto; font-size: 14px; color: var(--sys-dim); letter-spacing: 0.08em; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sk-lv b { font-size: 20px; color: var(--gold); text-shadow: 0 0 8px rgba(255, 207, 90, 0.6); }
.sk-lv svg { width: 14px; height: 14px; }
.sk-desc { font-size: 14px; line-height: 1.25; color: var(--sys-text); margin: 2px 0 1px; }
.sk-cost { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; font-weight: 700; color: #9ac0ff; }
.sk-cost .sk-train { font-weight: 500; }
.sk-prof { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin: 4px 0 2px; }
.sk-prof .track { position: relative; height: 7px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); }
.sk-prof .track i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb020, var(--xp)); box-shadow: 0 0 6px rgba(255, 210, 74, 0.7); }
.sk-prof span { font-size: 12.5px; color: #ffe0a0; font-weight: 700; letter-spacing: 0.04em; }
.sk-next, .sk-train { font-size: 13px; color: var(--sys-dim); }
.sk-next label, .sk-train label { display: inline-block; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 11.5px; color: var(--sys-border); margin-right: 6px; }
.sk-next { color: #c8ffe0; }
.sk.locked { opacity: 0.55; border-color: rgba(79, 195, 255, 0.2); }
.sk.locked .sk-ico { filter: grayscale(1); box-shadow: none; }
.st-head { display: flex; gap: 22px; align-items: stretch; text-align: left; }
.st-lv { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 110px; padding: 4px 14px; border: 1px solid rgba(79, 195, 255, 0.4); box-shadow: inset 0 0 16px rgba(79, 195, 255, 0.15); }
.st-lv label { font-size: 13px; letter-spacing: 0.3em; color: var(--sys-dim); text-transform: uppercase; }
.st-lv b { font-size: 58px; line-height: 1; color: #fff; text-shadow: 0 0 16px var(--sys-border); }
.st-id { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; align-content: center; }
.st-id div, .st-derived div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1px dashed rgba(79, 195, 255, 0.2); padding: 2px 0; }
.st-id label, .st-derived label, .sh-head label { color: var(--sys-dim); text-transform: uppercase; letter-spacing: 0.12em; font-size: 14px; }
.st-id b { color: #fff; font-size: 17px; }
.st-bars { margin-top: 12px; display: grid; gap: 5px; }
.st-bar { display: grid; grid-template-columns: 34px 1fr 110px; gap: 10px; align-items: center; text-align: left; }
.st-bar label { font-weight: 700; color: var(--sys-dim); letter-spacing: 0.1em; font-size: 14px; }
.st-bar .track { position: relative; height: 10px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.15); }
.st-bar .track i { position: absolute; left: 0; top: 0; bottom: 0; }
.st-bar b { text-align: right; font-size: 15px; }
.st-bar.hp i { background: linear-gradient(180deg, #ff6a70, var(--hp)); } .st-bar.hp b { color: #ff9a9a; }
.st-bar.mp i { background: linear-gradient(180deg, #7ab0ff, var(--mp)); } .st-bar.mp b { color: #9ac0ff; }
.st-bar.xp i { background: linear-gradient(90deg, #ffb020, var(--xp)); } .st-bar.xp b { color: #ffe0a0; }
.st-sep { height: 1px; background: linear-gradient(90deg, transparent, var(--sys-border), transparent); margin: 14px 0; }
.st-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; }
.stat { display: grid; grid-template-columns: 44px 1fr 48px 32px; align-items: center; text-align: left; }
.stat .sk { font-weight: 700; color: #fff; letter-spacing: 0.08em; font-size: 18px; }
.stat .sn { color: var(--sys-dim); font-size: 15px; line-height: 1.15; }
.stat .sn small { display: block; font-size: 11.5px; color: rgba(143, 180, 204, 0.7); letter-spacing: 0.02em; }
.stat b { font-size: 24px; color: #fff; text-align: right; padding-right: 8px; }
.stat.bump b { animation: bump 0.4s ease-out; }
@keyframes bump { 0% { transform: scale(1.5); color: var(--gold); text-shadow: 0 0 12px var(--gold); } 100% { transform: none; } }
.plus {
  width: 28px; height: 28px; font-family: var(--font); font-weight: 700; font-size: 20px; line-height: 1; color: #fff; cursor: pointer;
  background: rgba(79, 195, 255, 0.2); border: 1px solid var(--sys-border); box-shadow: 0 0 8px var(--sys-glow);
}
.plus:hover:not(:disabled) { background: rgba(79, 195, 255, 0.5); box-shadow: 0 0 14px var(--sys-border); }
.plus:active:not(:disabled) { transform: scale(0.9); }
.plus:disabled { opacity: 0.25; cursor: default; box-shadow: none; }
.st-points { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; text-align: left; padding: 4px 10px; border: 1px solid rgba(79, 195, 255, 0.25); color: var(--sys-dim); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.15; }
.st-points b { font-size: 30px; color: #fff; grid-row: span 2; }
.st-points small { font-size: 11px; text-transform: none; letter-spacing: 0.02em; }
.st-points small kbd { height: 14px; min-width: 14px; font-size: 10px; padding: 0 3px; }
.st-points.has { border-color: var(--gold); color: #ffe6a0; box-shadow: 0 0 10px rgba(255, 207, 90, 0.35), inset 0 0 12px rgba(255, 207, 90, 0.12); }
.st-points.has b { color: var(--gold); text-shadow: 0 0 10px rgba(255, 207, 90, 0.7); animation: flicker 2.2s infinite; }
.st-derived { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 22px; text-align: left; }
.st-derived label { font-size: 13px; }
.st-derived b { color: #fff; font-size: 16px; }
.st-derived .wpn { grid-column: 1 / -1; justify-content: flex-start; }
.st-derived .wpn b { color: #c0ffe0; }
.st-derived .wpn small { color: var(--sys-dim); font-size: 13px; margin-left: auto; }
/* shadows tab */
.sh-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 22px; text-align: left; }
.sh-head div { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px dashed rgba(181, 108, 255, 0.3); padding: 2px 0; }
.sh-head b { color: #e6d0ff; font-size: 17px; text-shadow: 0 0 8px rgba(181, 108, 255, 0.6); }
.sh-head kbd { height: 15px; font-size: 10px; min-width: 15px; }
.sh-hint { text-align: left; color: var(--sys-dim); font-size: 13px; margin: 6px 0 10px; }
.sh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 300px; overflow-y: auto; padding: 2px; }
.sh-card {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: 'sil name ren' 'sil grade lv' 'xp xp xp' 'state state kills';
  align-items: center; column-gap: 9px; row-gap: 1px; padding: 9px 11px; cursor: pointer; text-align: left;
  font-family: var(--font); color: var(--sys-dim); background: rgba(20, 10, 40, 0.7); border: 1px solid rgba(181, 108, 255, 0.35); transition: box-shadow 0.15s, border-color 0.15s;
}
.sh-card:hover { border-color: var(--monarch); }
.sh-card.on { color: #fff; border-color: var(--monarch); box-shadow: 0 0 12px rgba(181, 108, 255, 0.6), inset 0 0 14px rgba(181, 108, 255, 0.2); }
.sh-card.capped { opacity: 0.6; }
.sh-card.deny { opacity: 1; border-color: var(--danger); animation: shake 0.4s; }
.sh-card.deny .sh-state { color: #ff9a9a; }
.sh-sil { grid-area: sil; position: relative; width: 34px; height: 34px; background: #07030e; border: 1px solid rgba(181, 108, 255, 0.5); box-shadow: inset 0 0 10px rgba(120, 40, 220, 0.6); display: inline-block; }
.sh-sil i { position: absolute; top: 42%; width: 7px; height: 3px; background: #d6a8ff; box-shadow: 0 0 6px #b56cff, 0 0 12px #8a2be2; }
.sh-sil i:first-child { left: 7px; }
.sh-sil i:last-child { right: 7px; }
.sh-card:not(.on) .sh-sil i { opacity: 0.35; box-shadow: none; }
.sh-sil.big { display: block; width: 56px; height: 56px; margin: 0 auto 12px; }
.sh-sil.big i { width: 11px; height: 4px; }
.sh-sil.big i:first-child { left: 12px; }
.sh-sil.big i:last-child { right: 12px; }
.sh-name { grid-area: name; font-size: 18px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.sh-grade { grid-area: grade; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #c9a8ff; }
.sh-grade.g-knight, .sh-grade.g-elite-knight, .sh-grade.g-commander { color: #ff9a9a; }
.sh-grade.g-marshal { color: var(--gold); text-shadow: 0 0 6px rgba(255, 207, 90, 0.6); }
.sh-lv { grid-area: lv; font-size: 12px; color: var(--sys-dim); white-space: nowrap; }
.sh-lv b { font-size: 16px; color: #e6d0ff; }
.sh-ren { grid-area: ren; justify-self: end; display: grid; place-items: center; width: 26px; height: 26px; color: var(--sys-dim); border: 1px solid transparent; }
.sh-ren svg { width: 15px; height: 15px; }
.sh-ren:hover { color: #fff; border-color: var(--monarch); }
body.touch .sh-ren { width: var(--t); height: var(--t); }
body.touch .sh-ren svg { width: 24px; height: 24px; }
.sh-kills { grid-area: kills; margin-top: 4px; font-size: 11px; color: var(--sys-dim); white-space: nowrap; }
.sh-xp { grid-area: xp; height: 4px; margin-top: 5px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(181, 108, 255, 0.3); }
.sh-xp i { display: block; height: 100%; background: linear-gradient(90deg, #6a2cc0, #c890ff); box-shadow: 0 0 6px rgba(181, 108, 255, 0.7); }
.sh-state { grid-area: state; margin-top: 4px; font-size: 11px; letter-spacing: 0.16em; }
.sh-card.on .sh-state { color: #8affc0; }
.sh-empty { padding: 22px 10px; color: var(--sys-dim); font-size: 17px; line-height: 1.6; }

@media (max-height: 700px) {
  .sw-head { padding: 9px 16px 8px; font-size: 18px; }
  .sw-body { padding: 10px 22px 4px; font-size: 16px; }
  .sw-buttons { margin-top: 10px; }
}
@media (max-width: 900px) {
  #quest { width: 240px; font-size: 13px; }
  #controls-hint { display: none; }
  .pause-grid, .st-stats, .st-id { grid-template-columns: 1fr; }
  .st-derived, .sh-head { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------ hunter name, gold, job choice, weapon effects */
.slot.gone { display: none; }
.gold-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; }
.gold-row b, .st-id b.gold { color: var(--gold); text-shadow: 0 0 8px rgba(255, 207, 90, 0.55); letter-spacing: 0.04em; }
#h-gold { display: inline-block; }
#h-gold.bump { animation: goldBump 0.6s ease-out; }
@keyframes goldBump { 0% { transform: scale(1.5); text-shadow: 0 0 14px var(--gold); } 100% { transform: none; } }
.gold-row small { font-size: 10px; font-weight: 700; letter-spacing: 0.16em; color: rgba(255, 220, 140, 0.7); }
.coin { width: 11px; height: 11px; background: radial-gradient(circle at 35% 35%, #fff3c0, var(--gold) 45%, #b07a10); border: 1px solid #ffe9a8; transform: rotate(45deg); box-shadow: 0 0 6px rgba(255, 207, 90, 0.8); }
/* a long name shrinks (ellipsis) before the "+N pts [Tab]" label is pushed past the panel edge */
.who { min-width: 0; flex: 1 1 auto; }
.who .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { flex-shrink: 0; }
.name-input {
  display: block; width: min(320px, 100%); margin: 14px auto 4px; padding: 10px 14px; font-family: var(--font); font-size: 24px; font-weight: 700;
  letter-spacing: 0.08em; text-align: center; color: #fff; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--sys-border);
  box-shadow: 0 0 12px var(--sys-glow), inset 0 0 12px rgba(79, 195, 255, 0.15); outline: none; user-select: text; -webkit-user-select: text;
}
.name-input::placeholder { color: rgba(143, 180, 204, 0.6); font-weight: 600; }
.name-input:focus { border-color: #bff0ff; box-shadow: 0 0 18px #7fd0ff, inset 0 0 14px rgba(127, 208, 255, 0.25); }
.name-err { min-height: 1.2em; font-size: 15px; color: #ffb0b0; }
.job-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 6px; text-align: left; }
.job-opt { padding: 10px 14px; border: 1px solid rgba(79, 195, 255, 0.35); background: rgba(0, 0, 0, 0.25); font-size: 15px; line-height: 1.4; }
.job-opt h4 { margin: 0 0 6px; font-size: 17px; letter-spacing: 0.1em; text-transform: uppercase; color: #fff; }
.job-opt ul { margin: 0; padding-left: 18px; }
.job-opt li { margin: 3px 0; }
.job-opt.necro { border-color: var(--monarch); box-shadow: 0 0 12px rgba(181, 108, 255, 0.35), inset 0 0 14px rgba(181, 108, 255, 0.12); }
.job-opt.necro h4 { color: #e6d0ff; text-shadow: 0 0 8px var(--monarch); }
.job-opt.free h4 { color: #fff3c0; text-shadow: 0 0 8px rgba(255, 207, 90, 0.6); }
.dn.effect { font-size: 14px; letter-spacing: 0.16em; }
.dn.effect.poison { color: #6aff8a; text-shadow: 0 2px 0 #003a10, 0 0 8px #2aff6a; }
.dn.effect.paralyze { color: #fff070; text-shadow: 0 2px 0 #3a3000, 0 0 8px #ffd020; }
.dn.effect.chill { color: #a8e4ff; text-shadow: 0 2px 0 #00203a, 0 0 8px #4fc3ff; }
.dn.effect.burn, .dn.effect.shatter { color: #ffb050; text-shadow: 0 2px 0 #3a1000, 0 0 8px #ff6a20; }
@media (max-width: 700px) { .job-opts { grid-template-columns: 1fr; } }
@media (max-height: 500px) { /* phones in landscape: both answers fit without scrolling */
  .job-opts { gap: 8px; margin: 6px 0 2px; }
  .job-opt { padding: 6px 10px; font-size: 13px; line-height: 1.3; }
  .job-opt h4 { font-size: 14px; margin-bottom: 3px; }
  .name-input { margin-top: 8px; padding: 6px 12px; font-size: 20px; }
}
/* fighting styles: shield guard feedback */
.dn.parry { color: #ffe680; font-size: 26px; letter-spacing: 0.2em; text-shadow: 0 2px 0 #3a2a00, 0 0 14px #ffc020, 0 0 26px #ff9a1a; }
.dn.gbreak { color: #ff9a80; font-size: 18px; letter-spacing: 0.14em; text-shadow: 0 2px 0 #3a0a00, 0 0 10px #ff5a3a; }
/* Fatal Strike [X]: red; its slot (data-i 8) sits after Stealth; combo Technique / execute damage labels */
#skillbar .slot[data-i="5"], #skillbar .slot[data-i="6"], #skillbar .slot[data-i="7"] { order: 1; }
.slot[data-skill="fatal"]:not(.locked) .ico { color: #ffc0c6; filter: drop-shadow(0 0 5px #ff2a3a); }
.dn.effect.execute { color: #ff3a48; font-size: 24px; letter-spacing: 0.22em; text-shadow: 0 2px 0 #3a0006, 0 0 12px #ff1a2a, 0 0 26px #a00010; }
.dn.effect.backstab { color: #e2c4ff; font-size: 17px; text-shadow: 0 2px 0 #1a0030, 0 0 10px #a060ff; }
