* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #100e15; color: #efe9dc; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; -webkit-user-select: none; user-select: none; }
.stage { position: fixed; inset: 0; }
canvas[data-role="canvas"] { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.ui { position: absolute; inset: 0; pointer-events: none; }
.ui button { pointer-events: auto; font: inherit; cursor: pointer; }

/* top */
.hud { position: absolute; left: 0; right: 0; top: 0; padding: max(8px, env(safe-area-inset-top)) 10px 6px; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; background: linear-gradient(rgba(16,14,21,0.92), rgba(16,14,21,0)); pointer-events: none; }
.gold { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: 6px; }
.gold-n { font-size: 26px; font-weight: 700; color: #ffd36e; letter-spacing: 0.5px; }
.gold-n::before { content: "◆ "; font-size: 16px; }
.gold-rate { font-size: 13px; color: #d9c58a; }
.meter { grid-column: 2; grid-row: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; align-self: center; }
.meter-fill { height: 100%; width: 0; border-radius: 3px; transition: width 200ms linear; }
.meter-fill.cold { background: #5d6b8a; } .meter-fill.warm { background: #d9b26a; } .meter-fill.hot { background: #ff8a4a; }
.status { grid-column: 1 / 3; grid-row: 2; font-size: 13px; color: #bdb4c8; }
.hud-buttons { grid-column: 3; grid-row: 1 / 3; display: flex; gap: 6px; justify-self: end; }
.hud-btn { pointer-events: auto; background: rgba(255,255,255,0.08); color: #efe9dc; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; min-width: 38px; height: 38px; font-size: 16px; }
.hud-btn:active { background: rgba(255,255,255,0.2); }

.toast { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); background: rgba(20,16,28,0.92); border: 1px solid rgba(255,211,110,0.35); color: #ffe9b5; padding: 8px 14px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity 150ms; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }

.start-wrap { position: absolute; left: 0; right: 0; bottom: 150px; display: flex; justify-content: center; }
.start-raid { background: #ffd36e; color: #1a1410; border: 0; border-radius: 12px; padding: 12px 22px; font-size: 16px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,0.4); }

/* bottom */
.palette { position: absolute; left: 50%; transform: translateX(-50%); width: min(100%, 760px); bottom: 0; padding: 6px 8px max(8px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(16,14,21,0), rgba(16,14,21,0.95) 30%); pointer-events: none; }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tab { flex: 1; background: rgba(255,255,255,0.06); color: #bdb4c8; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 7px 0; font-size: 13px; }
.tab.on { background: rgba(255,211,110,0.18); color: #ffd36e; border-color: rgba(255,211,110,0.5); }
.tools { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; pointer-events: auto; }
.tools::-webkit-scrollbar { display: none; }
.tool { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 78px; background: rgba(255,255,255,0.07); color: #efe9dc; border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 8px 8px; }
.tool.on { background: rgba(120,255,160,0.16); border-color: rgba(120,255,160,0.6); }
.tool.poor { opacity: 0.45; }
.tool.used { opacity: 0.3; text-decoration: line-through; }
.tool-name { font-size: 12px; white-space: nowrap; }
.tool-cost { font-size: 12px; color: #ffd36e; }
.hint { font-size: 12px; color: #9a92a6; min-height: 16px; padding: 4px 2px 0; }
.spectating .palette, .spectating .start-wrap { display: none; }

/* screens */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(10,8,14,0.82); pointer-events: auto; padding: 20px; }
.screen.show { display: flex; }
.card { max-width: 420px; width: 100%; background: #1a1622; border: 1px solid rgba(255,211,110,0.25); border-radius: 16px; padding: 24px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.card h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: 1px; color: #ffd36e; }
.card .tag { margin: 0 0 14px; color: #d9c58a; font-style: italic; }
.card p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; color: #cfc6d8; }
.card em { color: #ffd36e; font-style: normal; }
button.big { display: block; width: 100%; margin: 14px 0 8px; background: #ffd36e; color: #1a1410; border: 0; border-radius: 12px; padding: 14px; font-size: 17px; font-weight: 700; }
button.small { background: transparent; color: #bdb4c8; border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 9px 14px; font-size: 13px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.stats div { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.stats span { font-size: 12px; color: #9a92a6; } .stats b { font-size: 20px; color: #ffd36e; }

@media (min-width: 900px) { .tool { min-width: 96px; } .tab { font-size: 14px; } }
