:root {
  --gold: #f5c542;
  --gold-dark: #a8781a;
  --navy: #0b0b1a;
  --panel: #1a1838;
  --panel-edge: #4b3f8f;
  --text: #f4f1ff;
  --muted: #a49cc9;
  --red: #e5484d;
  --green: #3ccf6e;
  --cursed: #b14cff;
  --pixel: 3px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--navy); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
body { font-family: "Courier New", ui-monospace, monospace; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 1px; }
#screen { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
canvas.pix { image-rendering: pixelated; image-rendering: crisp-edges; }

.panel { background: var(--panel); border: var(--pixel) solid var(--panel-edge); box-shadow: 0 0 0 var(--pixel) #000, inset 0 0 0 var(--pixel) #2a2560; padding: 16px; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(5, 4, 16, 0.72); }
.title { font-size: clamp(28px, 7vw, 72px); color: var(--gold); text-shadow: 4px 4px 0 var(--gold-dark), 8px 8px 0 #000; text-align: center; line-height: 1; }
.subtitle { color: var(--muted); font-size: clamp(12px, 2vw, 18px); text-align: center; }
.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

button.btn { font: inherit; color: var(--navy); background: var(--gold); border: 0; padding: 10px 18px; box-shadow: 0 var(--pixel) 0 var(--gold-dark), 0 0 0 var(--pixel) #000; cursor: pointer; text-transform: uppercase; font-size: 16px; }
button.btn:hover, button.btn:focus-visible { background: #fff1a8; outline: none; }
button.btn.secondary { background: var(--panel-edge); color: var(--text); box-shadow: 0 var(--pixel) 0 #2a2560, 0 0 0 var(--pixel) #000; }

.cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 96vw; }
.card { width: 210px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; text-align: center; }
.card:hover, .card.selected, .card:focus-visible { border-color: var(--gold); outline: none; transform: translateY(-3px); }
.card .name { color: var(--gold); font-size: 18px; }
.card .role { color: var(--muted); font-size: 12px; }
.card .desc { font-size: 11px; text-transform: none; color: var(--text); line-height: 1.35; }

.hud { position: absolute; inset: 0; pointer-events: none; }
.hud .xpbar { position: absolute; top: 0; left: 0; right: 0; height: 14px; background: #120f2a; border-bottom: var(--pixel) solid #000; }
.hud .xpfill { height: 100%; background: linear-gradient(#5be0ff, #2a7fff); width: 0; }
.hud .lvl { position: absolute; top: 0; right: 8px; font-size: 12px; line-height: 14px; text-shadow: 2px 2px 0 #000; }
.hud .timer { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 26px; text-shadow: 3px 3px 0 #000; }
.hud .timer.danger { color: var(--red); }
.hud .stats { position: absolute; top: 22px; right: 10px; font-size: 13px; text-align: right; text-shadow: 2px 2px 0 #000; line-height: 1.5; }
.hud .slots { position: absolute; top: 22px; left: 8px; display: flex; flex-direction: column; gap: 4px; }
.hud .slotrow { display: flex; gap: 3px; }
.hud .slot { width: 36px; height: 36px; background: rgba(10, 8, 30, 0.75); border: 2px solid #3a3470; position: relative; }
.hud .slot canvas { width: 32px; height: 32px; }
.hud .slot .lv { position: absolute; right: 1px; bottom: -1px; font-size: 10px; text-shadow: 1px 1px 0 #000; }
.hud .slot.enchanted { border-color: #5be0ff; }
.hud .slot.cursed { border-color: var(--cursed); }
.hud .hpbar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); width: min(320px, 60vw); height: 14px; background: #2a0c14; border: var(--pixel) solid #000; }
.hud .hpfill { height: 100%; background: linear-gradient(#ff7a7f, #c8202a); width: 100%; }
.hud .hptext { position: absolute; inset: 0; font-size: 10px; text-align: center; line-height: 9px; text-shadow: 1px 1px 0 #000; }
.hud .boss { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: min(520px, 80vw); text-align: center; font-size: 13px; text-shadow: 2px 2px 0 #000; }
.hud .boss .bar { height: 10px; background: #2a0c14; border: 2px solid #000; margin-top: 3px; }
.hud .boss .fill { height: 100%; background: linear-gradient(#ffe27a, #e09a1a); }
.hud .pausebtn { position: absolute; bottom: 10px; right: 10px; pointer-events: auto; font-size: 12px; padding: 6px 10px; }

.choices { display: flex; flex-direction: column; gap: 10px; width: min(560px, 94vw); }
.choice { display: flex; gap: 12px; align-items: center; cursor: pointer; padding: 10px 12px; text-align: left; }
.choice:hover, .choice.selected { border-color: var(--gold); }
button.btn:disabled { opacity: 0.4; cursor: default; }
.choice canvas { width: 48px; height: 48px; flex: none; }
.choice .ctitle { color: var(--gold); font-size: 15px; }
.choice .ctag { font-size: 10px; color: var(--navy); background: var(--green); padding: 1px 5px; margin-left: 6px; }
.choice .ctag.evo { background: var(--gold); }
.choice .ctag.ult { background: #ff5ec4; }
.choice .cdesc { font-size: 11px; text-transform: none; line-height: 1.3; margin-top: 3px; }
.ench { font-size: 11px; text-transform: none; margin-top: 3px; color: #5be0ff; }
.ench.cursed { color: var(--cursed); }
.ench .bane { color: var(--red); }

.summary { font-size: 14px; line-height: 1.8; text-align: center; }
.summary b { color: var(--gold); }
.debug { position: absolute; bottom: 4px; left: 6px; font-size: 11px; text-shadow: 1px 1px 0 #000; white-space: pre; text-transform: none; pointer-events: none; color: #9effa8; }
.toast { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-size: clamp(18px, 4vw, 36px); color: var(--gold); text-shadow: 3px 3px 0 #000; animation: toast 2.6s ease-out forwards; pointer-events: none; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
.stick { position: absolute; width: 110px; height: 110px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); pointer-events: none; transform: translate(-50%, -50%); }
.stick .nub { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; border-radius: 50%; background: rgba(245, 197, 66, 0.55); transform: translate(-50%, -50%); }
.hint { font-size: 11px; color: var(--muted); text-align: center; text-transform: none; }
