:root {
            color-scheme: dark;
            --panel: rgba(8, 10, 12, 0.78);
            --panel-strong: rgba(8, 10, 12, 0.92);
            --line: rgba(255,255,255,0.18);
            --accent: #f59e0b;
            --danger: #ef4444;
            --good: #22c55e;
            --water: #38bdf8;
            --rad: #a3e635;
        }
        * { box-sizing: border-box; }
        html, body { width: 100%; height: 100%; }
        body {
            margin: 0;
            overflow: hidden;
            background: #0b1020;
            color: #f8fafc;
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            user-select: none;
        }
        canvas { display: block; }
        #crosshair {
            position: fixed; top: 50%; left: 50%; width: 18px; height: 18px;
            transform: translate(-50%, -50%); pointer-events: none; z-index: 5;
        }
        #crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,.9); box-shadow: 0 0 4px #000; }
        #crosshair::before { width: 18px; height: 2px; top: 8px; left: 0; }
        #crosshair::after { height: 18px; width: 2px; left: 8px; top: 0; }
        #startScreen, #gameOver, #photoOverlay {
            position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
            background: radial-gradient(circle at center, rgba(120,53,15,.35), rgba(0,0,0,.92)); z-index: 20;
            padding: 24px; text-align: center;
        }
        #gameOver, #photoOverlay { display: none; }
        .menu-card {
            max-width: 980px; width: min(96vw, 980px); background: rgba(15, 23, 42, .92);
            border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: 0 24px 80px rgba(0,0,0,.55);
        }
        h1 { margin: 0 0 8px; font-size: clamp(36px, 7vw, 72px); letter-spacing: -0.06em; }
        h2 { margin: 0 0 10px; color: #fde68a; }
        .subtitle { color: #cbd5e1; font-size: 18px; max-width: 760px; margin: 0 auto 18px; line-height: 1.5; }
        .pill-row, .button-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
        .pill { border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #e2e8f0; border-radius: 999px; padding: 7px 12px; font-size: 13px; }
        button {
            appearance: none; border: 1px solid rgba(255,255,255,.18); color: white; cursor: pointer;
            background: linear-gradient(180deg, #f97316, #b45309); border-radius: 12px; padding: 12px 18px;
            font-weight: 800; letter-spacing: .02em; box-shadow: 0 8px 0 rgba(69,26,3,.9);
        }
        button.secondary { background: linear-gradient(180deg, #475569, #1e293b); box-shadow: 0 8px 0 rgba(2,6,23,.9); }
        button:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(2,6,23,.9); }
        #hud { position: fixed; inset: 14px auto auto 14px; width: 330px; z-index: 8; pointer-events: none; }
        .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
        .stat { display: grid; grid-template-columns: 78px 1fr 42px; gap: 8px; align-items: center; font-size: 12px; margin: 5px 0; }
        .bar { height: 10px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.16); }
        .fill { height: 100%; transition: width .2s linear; }
        #hpFill { background: var(--danger); } #hungerFill { background: var(--accent); } #thirstFill { background: var(--water); }
        #staminaFill { background: var(--good); } #radFill { background: var(--rad); } #tempFill { background: #fb7185; }
        #topbar { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 8; display: flex; gap: 8px; align-items: stretch; pointer-events: none; }
        .badge { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
        #rightPanel { position: fixed; right: 14px; top: 14px; width: 360px; z-index: 8; display: grid; gap: 10px; pointer-events: none; }
        #bottomPanel { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 8; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
        #hotbar { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 7px; }
        .slot { width: 70px; height: 58px; border: 2px solid rgba(255,255,255,.18); background: rgba(15,23,42,.78); border-radius: 10px; display: grid; place-items: center; text-align: center; font-size: 10px; padding: 4px; }
        .slot.active { border-color: #fbbf24; box-shadow: 0 0 18px rgba(251,191,36,.35); }
        #messageLog { max-height: 112px; overflow: hidden; color: #e2e8f0; font-size: 12px; line-height: 1.4; }
        #codex { position: fixed; inset: 8vh 8vw; z-index: 18; display: none; grid-template-columns: 260px 1fr; gap: 12px; background: var(--panel-strong); border: 1px solid var(--line); border-radius: 20px; padding: 16px; backdrop-filter: blur(12px); }
        #codex nav { display: grid; align-content: start; gap: 6px; overflow: auto; }
        #codex nav button { width: 100%; text-align: left; box-shadow: none; padding: 9px 10px; border-radius: 9px; background: rgba(255,255,255,.08); }
        #codex article { overflow: auto; padding-right: 8px; }
        .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
        .feature-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.06); }
        .feature-card b { color: #fde68a; display: block; margin-bottom: 4px; }
        #toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 9; background: rgba(0,0,0,.78); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; opacity: 0; transition: opacity .2s; pointer-events: none; }
        .tiny { font-size: 12px; color: #94a3b8; line-height: 1.35; }
