
* { margin:0; padding:0; box-sizing:border-box; }

body {
    background: #0a1a0a;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

canvas {
    display: block;
    position: fixed;
    top: 0; left: 0;
}

/* ── HUD ── */
#hud {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.hud-block { display: flex; flex-direction: column; gap: 2px; }
.hud-block-end { align-items: flex-end; }
.hud-label { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,0.4); }
.hud-value { font-size: 28px; font-weight: bold; color: #fff; text-shadow: 0 0 20px rgba(100,255,100,0.6); }
.hud-value.danger { color: #ff4444; text-shadow: 0 0 20px rgba(255,68,68,0.8); animation: dangerPulse 0.4s ease-in-out infinite; }

#threat-bar-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
#threat-label { font-size: 10px; letter-spacing: 2px; color: rgba(255,100,100,0.7); }
#threat-bar-bg {
    width: 120px; height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px; overflow: hidden;
    border: 1px solid rgba(255,80,80,0.3);
}
#threat-bar {
    height: 100%; width: 20%;
    background: linear-gradient(90deg, #ff6600, #ff0000);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(255,80,0,0.6);
}

/* ── SCREENS ── */
.screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 20;
    background: rgba(5, 15, 5, 0.95);
}
.screen.hidden { display: none; }

.game-title {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 8px;
    color: #fff;
    text-shadow: 0 0 40px rgba(100,255,100,0.4);
}
.emoji-title { font-size: clamp(3rem, 12vw, 7rem); margin-bottom: 16px; }
.game-sub {
    font-size: clamp(0.7rem, 2vw, 1rem);
    letter-spacing: 4px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 48px;
    text-transform: uppercase;
    text-align: center;
    padding: 0 20px;
}

.instructions {
    display: flex; gap: 32px; margin-bottom: 48px; flex-wrap: wrap; justify-content: center;
    padding: 0 20px;
}
.instr-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 16px 20px; min-width: 120px;
}
.instr-icon { font-size: 2rem; }
.instr-text { font-size: 11px; letter-spacing: 1px; color: rgba(255,255,255,0.5); text-align: center; }

.btn-start {
    padding: 18px 56px;
    font-size: 1.2rem;
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: transparent;
    color: #6dff6d;
    border: 2px solid #6dff6d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 0 20px rgba(109,255,109,0.2), inset 0 0 20px rgba(109,255,109,0.05);
}
.btn-start:hover, .btn-start:active {
    background: #6dff6d;
    color: #000;
    box-shadow: 0 0 40px rgba(109,255,109,0.5);
    transform: scale(1.04);
}

/* game over */
.go-title { font-size: clamp(2rem, 7vw, 4rem); margin-bottom: 4px; }
.go-emoji { font-size: clamp(4rem, 15vw, 8rem); margin-bottom: 16px; animation: goShake 0.5s ease-in-out; }
.go-score { font-size: clamp(2.5rem, 8vw, 5rem); color: #6dff6d; font-weight: 900; margin: 8px 0; text-shadow: 0 0 30px rgba(109,255,109,0.5); }
.go-time { font-size: clamp(1rem, 3vw, 1.5rem); color: rgba(255,255,255,0.5); margin-bottom: 8px; }
.go-best { font-size: 1rem; color: #ffd700; margin-bottom: 40px; letter-spacing: 2px; }

.btn-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.btn-secondary {
    padding: 14px 32px; font-size: 1rem; letter-spacing: 3px;
    font-family: 'Courier New', monospace; font-weight: bold;
    background: transparent; color: #aaa; border: 2px solid #444;
    border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { border-color: #aaa; color: #fff; }

/* ── FLOATING SCORE ── */
.float-score {
    position: fixed;
    font-size: 1.4rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 15;
    animation: floatUp 0.9s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

/* ── TOAST ── */
#toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff; font-family: 'Courier New', monospace;
    font-size: 13px; letter-spacing: 2px;
    padding: 10px 24px; border-radius: 40px;
    opacity: 0; transition: all 0.3s; z-index: 30; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* copyright */
.copy {
    position: fixed; bottom: 12px; left: 0; right: 0;
    text-align: center; font-size: 11px;
    color: rgba(255,255,255,0.2); letter-spacing: 1px; z-index: 5;
    pointer-events: none;
}

.start-footer {
    position: absolute; bottom: 12px; width: 100%;
    font-size: 11px; color: #ffffff; opacity: 0.9;
    letter-spacing: 1px; text-align: center;
}
.social-link { color: #ffffff; opacity: 0.9; }

@keyframes floatUp {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}
@keyframes dangerPulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
@keyframes goShake {
    0%,100% { transform: rotate(0); }
    20%      { transform: rotate(-15deg) scale(1.1); }
    40%      { transform: rotate(15deg) scale(1.15); }
    60%      { transform: rotate(-10deg); }
    80%      { transform: rotate(8deg); }
}

@media (max-width: 600px) {
    .instructions { gap: 12px; }
    .instr-item { min-width: 90px; padding: 12px 14px; }
    #threat-bar-wrap { display: none; }
}