:root {
  --bg: #0b1020;
  --panel: rgba(14, 20, 38, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --dim: #9aa6c7;
  --accent: #a855f7;
  --shield: #3b9cff;
  --health: #5ee27a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.overlay2d { pointer-events: none; z-index: 2; }
[hidden] { display: none !important; }

.back { position: fixed; top: 10px; left: 12px; z-index: 6; color: #fff; text-decoration: none; font-size: 13px; opacity: 0.7; text-shadow: 0 1px 3px #000; }
.back:hover { opacity: 1; }

.hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.top { position: absolute; top: 10px; right: 190px; display: flex; gap: 8px; }
.pill { background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.pill b { font-size: 16px; }
.storm-pill { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(70, 20, 120, 0.65); border: 1px solid rgba(190, 130, 255, 0.5); border-radius: 999px; padding: 6px 16px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.storm-pill.shrinking { background: rgba(150, 30, 120, 0.75); }
.feed { position: absolute; top: 40px; left: 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; max-width: 40vw; }
.feed div { background: rgba(0, 0, 0, 0.5); border-radius: 6px; padding: 4px 9px; animation: fade 6s forwards; }
.feed .mine { border-left: 3px solid #ffd447; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.msg { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-size: 26px; font-weight: 800; text-shadow: 0 2px 8px #000; opacity: 0; transition: opacity 0.25s; }
.msg.on { opacity: 1; }
.prompt { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.65); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-size: 15px; }

.bottom { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding: 0 12px; }
.bars { position: absolute; left: 16px; bottom: 0; width: min(280px, 30vw); display: flex; flex-direction: column; gap: 5px; }
.bar { position: relative; height: 20px; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; transition: width 0.12s; }
.bar.shield i { background: linear-gradient(#5fb2ff, var(--shield)); }
.bar.health i { background: linear-gradient(#8bf0a0, var(--health)); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.hotbar { display: flex; gap: 6px; }
.slot { width: 74px; height: 62px; background: rgba(0, 0, 0, 0.55); border: 2px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 11px; position: relative; display: flex; flex-direction: column; justify-content: flex-end; }
.slot.sel { border-color: #fff; background: rgba(255, 255, 255, 0.16); }
.slot .n { position: absolute; top: 3px; left: 6px; font-size: 10px; color: var(--dim); }
.slot .nm { font-weight: 700; font-size: 12px; }
.slot .ammo { color: var(--dim); }
.slot.empty { opacity: 0.45; }
.side { position: absolute; right: 16px; bottom: 0; text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mats { background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 15px; }
.heals { font-size: 12px; background: rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 4px 10px; line-height: 1.5; }

.screen { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(60, 30, 110, 0.55), rgba(5, 8, 20, 0.88)); padding: 16px; overflow: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px; width: min(560px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.panel h1 { margin: 0; font-size: 40px; letter-spacing: 0.02em; background: linear-gradient(90deg, #c084fc, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel h2 { margin: 0 0 6px; }
.tag { color: var(--dim); margin: 6px 0 16px; }
.stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.stats div { background: rgba(255, 255, 255, 0.07); border-radius: 10px; padding: 6px 12px; min-width: 80px; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 11px; color: var(--dim); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; color: #fff; }
button.big { background: linear-gradient(180deg, #b366ff, #7c3aed); padding: 12px 36px; font-size: 20px; font-weight: 800; box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45); }
button.big:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border: 1px solid var(--line); padding: 8px 18px; margin: 10px 0 0 6px; color: var(--dim); }
.how { text-align: left; margin: 18px 0 6px; font-size: 14px; }
.how summary { cursor: pointer; color: var(--dim); }
.how ul { padding-left: 18px; margin: 8px 0; display: grid; gap: 5px; }
kbd { background: rgba(255, 255, 255, 0.14); border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: inherit; border: 1px solid var(--line); }
.note { color: var(--dim); font-size: 12px; margin: 10px 0 0; }

@media (max-width: 760px) {
  .slot { width: 56px; height: 52px; font-size: 10px; }
  .top { right: 12px; top: 36px; }
  .bars { width: 36vw; }
}
