:root {
    --hue: 240;
    --neon: hsl(var(--hue), 100%, 66%);
    --font: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #05060c;
    overflow: hidden;
    font-family: var(--font);
    color: #fff;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#hud {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    padding: 18px clamp(14px, 3vw, 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#hud-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.stat .label {
    font-size: 10px;
    letter-spacing: 3px;
    opacity: 0.55;
}

.stat .value {
    font-size: clamp(20px, 4vw, 30px);
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon);
    text-shadow: 0 0 14px var(--neon);
}

.stat.right { align-items: flex-end; text-align: right; }
.stat.center { align-items: center; text-align: center; }

#mult {
    font-size: clamp(16px, 3vw, 22px);
    color: #fff;
    opacity: 0.35;
    transition: opacity 120ms linear, transform 120ms ease-out;
}

#mult.hot {
    opacity: 1;
    color: hsl(calc(var(--hue) + 62), 100%, 74%);
    text-shadow: 0 0 16px currentColor;
    transform: scale(1.12);
}

#ink {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    width: min(360px, 62vw);
    height: 12px;
    border: 1px solid hsla(var(--hue), 100%, 70%, 0.45);
    border-radius: 8px;
    background: hsla(var(--hue), 60%, 20%, 0.35);
    overflow: hidden;
}

#ink-label {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    font-size: 9px;
    letter-spacing: 4px;
    opacity: 0.5;
}

#ability-tag {
    position: absolute;
    left: 50%;
    bottom: 46px;
    transform: translateX(-50%);
    display: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    color: hsl(48, 100%, 72%);
    border: 1px solid hsla(48, 100%, 65%, 0.55);
    background: hsla(48, 100%, 55%, 0.12);
    text-shadow: 0 0 12px hsla(48, 100%, 60%, 0.9);
}

#ability-tag.on { display: block; }

/* anchored off the ink bar's right edge, so it tracks the bar at every viewport width */
#shield {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(calc(min(180px, 31vw) + 14px));
    display: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    color: hsl(0, 100%, 74%);
    border: 1px solid hsla(0, 100%, 62%, 0.55);
    background: hsla(0, 100%, 55%, 0.12);
    text-shadow: 0 0 12px hsla(0, 100%, 60%, 0.9);
    transition: opacity 160ms linear;
}

#shield.on { display: block; }

#shield.spent {
    opacity: 0.26;
    text-shadow: none;
    background: transparent;
}

#zone-banner {
    position: absolute;
    left: 50%;
    top: 24%;
    transform: translateX(-50%);
    opacity: 0;
    white-space: nowrap;
    font-size: clamp(15px, 3.6vw, 28px);
    font-weight: 700;
    letter-spacing: 10px;
    text-indent: 10px;
    color: var(--neon);
    text-shadow: 0 0 26px var(--neon);
}

#zone-banner.on { animation: zone-sweep 2.2s ease-out forwards; }

@keyframes zone-sweep {
    0% { opacity: 0; letter-spacing: 2px; }
    16% { opacity: 1; letter-spacing: 10px; }
    68% { opacity: 1; letter-spacing: 10px; }
    100% { opacity: 0; letter-spacing: 18px; }
}

#ink-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, hsl(calc(var(--hue) + 280), 100%, 60%), hsl(calc(var(--hue) + 320), 100%, 74%));
    box-shadow: 0 0 14px hsl(calc(var(--hue) + 300), 100%, 65%);
    transition: width 60ms linear;
}

#ink.empty { animation: pulse 0.5s infinite alternate; }
#ink.empty #ink-fill { background: #ff2f4a; box-shadow: 0 0 14px #ff2f4a; }

@keyframes pulse {
    from { border-color: rgba(255, 47, 74, 0.4); }
    to { border-color: rgba(255, 47, 74, 1); }
}

#mute {
    pointer-events: auto;
    font-family: var(--font);
    font-size: 10px;
    letter-spacing: 2px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
}

#mute.off { opacity: 0.45; }
#mute:hover { background: rgba(255, 255, 255, 0.14); }

.screen {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: radial-gradient(ellipse at center, rgba(5, 6, 12, 0.55), rgba(5, 6, 12, 0.92));
    pointer-events: none;
}

.screen.on { display: flex; }

.screen h1 {
    margin: 0 0 4px;
    font-size: clamp(30px, 8vw, 62px);
    letter-spacing: 4px;
    color: var(--neon);
    text-shadow: 0 0 26px var(--neon);
}

.screen h2 {
    margin: 0 0 18px;
    font-size: clamp(18px, 4vw, 26px);
    letter-spacing: 3px;
    color: #ff3d57;
    text-shadow: 0 0 18px rgba(255, 61, 87, 0.7);
}

.screen p {
    margin: 4px 0;
    font-size: clamp(11px, 2.4vw, 14px);
    letter-spacing: 2px;
    opacity: 0.72;
    max-width: 34ch;
    line-height: 1.7;
}

.screen .big {
    font-size: clamp(26px, 6vw, 44px);
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--neon);
    text-shadow: 0 0 20px var(--neon);
    opacity: 1;
    margin: 10px 0 2px;
}

.screen .hint {
    margin-top: 22px;
    opacity: 0.9;
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 60% { opacity: 0.9; }
    80%, 100% { opacity: 0.25; }
}

.keys {
    margin-top: 16px;
    font-size: 10px;
    letter-spacing: 2px;
    opacity: 0.4;
}

.screen .credits {
    margin-top: 14px;
    font-size: clamp(11px, 2.4vw, 13px);
    letter-spacing: 3px;
    opacity: 0.85;
}

.screen .credits span {
    color: hsl(48, 100%, 70%);
    text-shadow: 0 0 14px hsla(48, 100%, 60%, 0.8);
    font-weight: 700;
}

.screen .note {
    margin-top: 14px;
    font-size: 10px;
    letter-spacing: 2px;
    opacity: 0.4;
}

.btn {
    pointer-events: auto;
    font-family: var(--font);
    font-size: 11px;
    letter-spacing: 2px;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid hsla(var(--hue), 100%, 72%, 0.5);
    border-radius: 7px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background 120ms linear, opacity 120ms linear;
}

.btn:hover:not(:disabled) { background: hsla(var(--hue), 100%, 70%, 0.22); }
.btn:disabled { opacity: 0.3; cursor: default; border-color: rgba(255, 255, 255, 0.18); }

.btn.wide {
    margin-top: 16px;
    min-width: 150px;
    padding: 11px 18px;
}

/* the shop is the one screen that can outgrow a short viewport, so it scrolls itself
   and takes its own clicks instead of letting them fall through to the canvas */
#screen-shop {
    justify-content: flex-start;
    padding: 6vh 20px 26px;
    overflow-y: auto;
    pointer-events: auto;
}

#screen-shop h1 { font-size: clamp(24px, 5vw, 38px); }

#shop-list, #shop-abilities, #shop-skins { width: min(430px, 88vw); }

.shop-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
}

/* stand-in thumbnail for the built-in vector wheel, which has no image file */
.shop-icon.stock {
    border: 3px solid var(--neon);
    box-shadow: 0 0 10px var(--neon) inset;
}

.screen .shop-head {
    width: min(430px, 88vw);
    margin: 16px 0 4px;
    text-align: left;
    font-size: 9px;
    letter-spacing: 4px;
    opacity: 0.45;
    max-width: none;
}

.shop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: min(430px, 88vw);
    margin: 7px 0;
    padding: 11px 14px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
}

.shop-row.locked { opacity: 0.4; }

.shop-info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.2;
}

.shop-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--neon);
}

.shop-desc {
    font-size: 10px;
    letter-spacing: 1px;
    opacity: 0.7;
}

.shop-lv {
    font-size: 9px;
    letter-spacing: 2px;
    opacity: 0.45;
}

.btn.buy { min-width: 92px; text-align: center; }
