@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

:root {
    --app-vh: 1vh;
    --cyan: #00f2ff;
    --cyan-dim: rgba(0,242,255,0.35);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--cyan-dim) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 999px; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Orbitron', sans-serif;
    background: radial-gradient(circle at 50% 40%, #0d1b2a 0%, #000 100%);
    color: #fff;
    overflow: hidden;
    min-height: calc(var(--app-vh) * 100);
}

.game-shell {
    position: relative;
    padding: 14px 0 10px;
}

/* ── NEON BORDER ── */
.neon-border {
    box-shadow: 0 0 18px rgba(0,242,255,0.5), 0 0 5px rgba(0,242,255,0.3) inset;
    border: 1px solid rgba(0,242,255,0.6);
}

/* ── GAME CONTAINER ── */
.game-container {
    position: relative;
    width: 320px;
    max-width: calc(100vw - 20px);
    padding: 3px;
    background: #000;
    border-radius: 6px;
}

#canvas-wrapper { transform-origin: top center; }

canvas {
    display: block;
    width: 320px;
    height: 480px;
    max-width: 100%;
    background: #000;
}

/* ── LOGO ── */
.logo-wrapper {
    width: min(320px, calc(100vw - 20px));
    height: 62px;
    overflow: hidden;
    margin: 12px 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-logo {
    width: 150%;
    height: 140px;
    object-fit: cover;
    object-position: center 50%;
    filter: drop-shadow(0 0 12px rgba(0,242,255,0.6));
}

/* ── HUD STRIP ── */
.status-strip {
    width: min(320px, calc(100vw - 20px));
}

.hud-stat { padding: 2px 4px; }

.hud-label {
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 1px;
}

.hud-value {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
}

/* ── POWER-UP BUTTONS ── */
.powerup-row {
    width: min(320px, calc(100vw - 20px));
}

.hud-btn {
    position: relative;
    overflow: hidden;
    padding: 7px 5px 5px;
    border-radius: 8px;
    border: 1px solid rgba(0,242,255,0.4);
    background: rgba(0,15,30,0.85);
    color: var(--cyan);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.hud-btn:hover:not(:disabled) {
    background: rgba(0,50,80,0.75);
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0,242,255,0.3);
    transform: translateY(-1px);
}

.hud-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.25);
}

.hud-btn-drop {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.55);
}

.hud-btn-label {
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hud-btn-count {
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

/* ── CONTROLS INFO ── */
.controls-info {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 8px;
}

.keycap {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid #444;
    border-radius: 3px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.65rem;
    margin-right: 3px;
}

/* ── MODAL SCREENS ── */
.modal-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(0,5,15,0.92);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-screen.hidden { display: none; }

.modal-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    width: 100%;
    max-width: 280px;
    text-align: center;
}

.settings-box {
    max-width: 300px;
    text-align: left;
    align-items: stretch;
}

.modal-eyebrow {
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
}

.modal-title {
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    margin: 0 0 10px;
}

.modal-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.modal-best {
    font-size: 10px;
    color: rgba(255,215,0,0.7);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
    min-height: 16px;
}

.modal-score-block {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 6px 0 14px;
    background: rgba(255,255,255,0.03);
}

.modal-score-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
}

.modal-score-label {
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}

.modal-score-value {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.modal-btn {
    width: 100%;
    padding: 10px 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn-primary {
    background: var(--cyan);
    color: #000;
    box-shadow: 0 0 20px rgba(0,242,255,0.4);
}

.modal-btn-primary:hover {
    background: #fff;
    box-shadow: 0 0 30px rgba(0,242,255,0.6);
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.12);
}

.modal-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.modal-hint {
    font-size: 9px;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.25);
    margin-top: 8px;
    text-transform: uppercase;
}

/* ── SETTINGS ── */
.settings-group {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.setting-row:last-child { border-bottom: none; }

.setting-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.8);
}

.setting-desc {
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.06em;
    margin-top: 1px;
}

.setting-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--cyan);
    min-width: 22px;
    text-align: right;
}

.setting-slider {
    width: 90px;
    accent-color: var(--cyan);
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.15);
}

.slider:before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider { background: var(--cyan); border-color: var(--cyan); }
input:checked + .slider:before {
    transform: translateX(18px);
    background: #000;
}

/* ── FOOTER ── */
.footer {
    margin-top: 12px;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.05em;
}

.gemini-logo {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

@keyframes spin-forward {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.gemini-logo.spin-active {
    animation: spin-forward 0.5s ease-out forwards;
}

/* ── SETTINGS BUTTON ── */
.settings-btn {
    position: absolute;
    top: 18px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(0,242,255,0.6);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.25s;
    z-index: 100;
    line-height: 1;
}

.settings-btn:hover {
    color: var(--cyan);
    transform: rotate(90deg);
}

/* ── MOBILE CONTROLS ── */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    padding: 0 10px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 200;
    gap: 8px;
}

.control-group {
    display: flex;
    gap: 8px;
    pointer-events: auto;
    align-items: flex-end;
}

.control-group-center {
    align-items: center;
    flex-direction: column;
    gap: 6px;
}

.touch-btn {
    width: 56px;
    height: 56px;
    background: rgba(0,242,255,0.1);
    border: 1px solid rgba(0,242,255,0.35);
    border-radius: 16px;
    color: var(--cyan);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    transition: all 0.08s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

.touch-btn.is-active, .touch-btn:active {
    background: rgba(0,242,255,0.3);
    transform: scale(0.93);
    border-color: var(--cyan);
}

.touch-btn-shoot {
    width: 68px;
    height: 68px;
    font-size: 28px;
    border-color: rgba(200,0,255,0.55);
    color: #cc00ff;
    background: rgba(200,0,255,0.1);
}

.touch-btn-shoot.is-active, .touch-btn-shoot:active {
    background: rgba(200,0,255,0.3);
    border-color: #cc00ff;
}

.touch-btn-action {
    width: 46px;
    height: 46px;
    font-size: 18px;
    border-color: rgba(255,165,0,0.45);
    color: #ffa500;
    background: rgba(255,165,0,0.08);
}

.touch-btn-action.is-active, .touch-btn-action:active {
    background: rgba(255,165,0,0.25);
}

.touch-btn-pause {
    width: 46px;
    height: 46px;
    font-size: 14px;
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.05);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    body {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .game-shell {
        width: 100%;
        justify-content: flex-start;
        padding-top: max(6px, env(safe-area-inset-top));
        padding-bottom: 120px;
    }

    .settings-btn {
        top: max(6px, env(safe-area-inset-top));
        right: 10px;
    }

    #mobile-controls { display: flex; }
    .controls-info { display: none; }

    .logo-wrapper { height: 48px; margin: 8px 0 6px; }
    .game-logo { height: 110px; }

    .hud-btn-label { font-size: 0.52rem; }

    .footer {
        margin-top: 8px;
        margin-bottom: max(4px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    .touch-btn { width: 50px; height: 50px; font-size: 20px; }
    .touch-btn-shoot { width: 62px; height: 62px; font-size: 24px; }
    .touch-btn-action { width: 42px; height: 42px; font-size: 16px; }
    .touch-btn-pause { width: 42px; height: 42px; }
}
