:root { --ink: #e8e4f0; --dim: #9a96a8; --bg: rgba(12, 10, 20, .86); --line: #3a3448; --light: #ffe680; --shadow: #a07aff; --hp: #d84a4a; --good: #8ad08a; --warn: #e8c060; --bad: #ff7a6a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07060c; color: var(--ink); font: 14px/1.4 ui-monospace, 'Cascadia Mono', Consolas, monospace; overflow: hidden; user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; cursor: crosshair; }
button { font: inherit; color: var(--ink); background: #2a2438; border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; }
button:hover { background: #3a3250; }
input { font: inherit; color: var(--ink); background: #14111e; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; min-width: 300px; max-width: min(560px, calc(100vw - 32px)); z-index: 10; }
.panel h1 { margin: 0; font-size: 34px; letter-spacing: 2px; }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel .sub { margin: 0 0 14px; color: var(--dim); }
.panel input { margin-bottom: 8px; }
.row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.row > button { flex: 1; }
.err { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; }
.small { color: var(--dim); font-size: 12px; margin-top: 10px; }
[hidden] { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#bars { position: absolute; left: 16px; bottom: 16px; width: min(340px, calc(100vw - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.bar { display: grid; grid-template-columns: 56px 1fr 64px; align-items: center; gap: 8px; margin: 3px 0; }
.lbl { color: var(--dim); font-size: 12px; }
.val { text-align: right; font-size: 12px; }
.track { position: relative; height: 12px; background: #1a1624; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.track i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .35); }
.fill { height: 100%; width: 0; transition: width .12s linear; }
.fill.hp { background: var(--hp); }
.fill.st { background: linear-gradient(90deg, #6a6a7a, #c8a050 50%, #ff5a3a); }
.fill.st.light { background: linear-gradient(90deg, #7a7660, #ffe680 60%, #ffffff); }
.fill.st.shadow { background: linear-gradient(90deg, #3a3050, #8a5aff 60%, #e0c8ff); }
#tier { font-size: 12px; text-align: right; margin-top: 2px; letter-spacing: 1px; }
#tier.charged { color: var(--warn); }
#tier.edge { color: #ff8a5a; animation: pulse .6s infinite alternate; }
@keyframes pulse { from { opacity: .6; } to { opacity: 1; } }
#abilities { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 8px; }
.ab { position: relative; width: 64px; height: 64px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; text-align: center; overflow: hidden; }
.ab b { font-size: 11px; font-weight: normal; padding: 0 3px; }
.ab kbd { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--dim); }
.ab .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .6); }
.ab.locked { opacity: .45; }
.ab.light { border-color: #6a6040; } .ab.shadow { border-color: #4a3a6a; }
#quest { position: absolute; left: 16px; top: 16px; max-width: min(380px, calc(100vw - 100px)); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
#quest:empty { display: none; }
#quest .act { color: var(--dim); font-size: 11px; letter-spacing: 1px; }
#where { position: absolute; right: 16px; top: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; margin-right: 44px; }
#menubtn { position: absolute; right: 16px; top: 14px; padding: 4px 9px; }
#allies { position: absolute; right: 16px; top: 56px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; min-width: 140px; }
#wakingnote { position: absolute; right: 16px; top: 100px; font-size: 12px; color: var(--warn); text-align: right; max-width: 260px; }
#toasts { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; animation: fade 4s forwards; max-width: calc(100vw - 32px); }
.toast.good { color: var(--good); } .toast.warn { color: var(--warn); } .toast.bad { color: var(--bad); }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#center { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); text-align: center; font-size: 20px; text-shadow: 0 2px 6px #000; pointer-events: none; }
#chatlog { position: absolute; left: 16px; bottom: 120px; width: min(380px, calc(100vw - 32px)); font-size: 12px; pointer-events: none; text-shadow: 0 1px 3px #000; }
#chatlog div { animation: fade 14s forwards; }
#chatin { position: absolute; left: 16px; bottom: 96px; width: min(380px, calc(100vw - 32px)); }
#talk { top: auto; bottom: 110px; transform: translateX(-50%); min-width: min(520px, calc(100vw - 32px)); cursor: pointer; }
#talkwho { color: var(--warn); margin-bottom: 4px; }
#talkline { font-size: 15px; min-height: 2.8em; }
.pw { display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.pw b { font-size: 18px; } .pw span { color: var(--dim); font-size: 12px; }
.pw.light { border-color: #8a8050; } .pw.light b { color: var(--light); }
.pw.shadow { border-color: #5a4a8a; } .pw.shadow b { color: var(--shadow); }
#lookcv { width: 144px; height: 144px; image-rendering: pixelated; display: block; margin: 0 auto 8px; background: #1a1624; border-radius: 8px; }
.opt { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; margin: 4px 0; font-size: 12px; }
.sw { display: flex; flex-wrap: wrap; gap: 4px; }
.sw button { padding: 3px 8px; font-size: 12px; }
.sw button.on { outline: 2px solid var(--warn); }
.sw button.chip { width: 22px; height: 22px; padding: 0; }
@media (max-width: 640px) { .ab { width: 52px; height: 52px; } #where { display: none; } #chatlog { bottom: 150px; } }
