* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #050510;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

#score-display {
    display: flex;
    gap: 30px;
    background: rgba(10, 10, 20, 0.7);
    backdrop-filter: blur(8px);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: #00ff88;
    text-shadow: 0 0 8px #00ff8866;
}

#score-value, #tokens-value, #bulls-value {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px #ff00ff88;
    min-width: 40px;
    text-align: center;
}

#level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(10, 10, 20, 0.7);
    backdrop-filter: blur(8px);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 0, 255, 0.2);
}

#right-ui {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.restart-btn {
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 20, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    pointer-events: auto;
}

.restart-btn:hover {
    border-color: #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
    transform: rotate(180deg);
}

.level-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: #ff00ff;
    text-shadow: 0 0 8px #ff00ff66;
}

#level-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 15px #ffff0088;
}

.level-name {
    font-size: 8px;
    color: #9945FF;
    letter-spacing: 1px;
    text-shadow: 0 0 6px #9945FF66;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 16, 0.92);
    backdrop-filter: blur(12px);
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes glowPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 0, 255, 0.4)); }
    50% { filter: drop-shadow(0 0 40px rgba(255, 0, 255, 0.7)); }
}

.screen h1 {
    font-size: clamp(40px, 8vw, 80px);
    text-align: center;
    line-height: 1.05;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ff00ff 0%, #00ff88 50%, #ff00ff 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glowPulse 2s ease-in-out infinite, slideUp 0.5s ease;
}

.screen h2 {
    font-size: clamp(32px, 6vw, 56px);
    margin-bottom: 24px;
    color: #ff00ff;
    text-shadow: 0 0 30px #ff00ff88;
    animation: slideUp 0.4s ease;
}

.screen p {
    font-size: 15px;
    color: #888;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.6;
    animation: slideUp 0.5s ease;
}

.screen p.tagline {
    font-size: 13px;
    color: #9945FF;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow: 0 0 15px #9945FF66;
}

.neon-btn {
    padding: 14px 40px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: transparent;
    border: 2px solid #00ff88;
    color: #00ff88;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.2s ease;
    margin: 8px;
    position: relative;
    overflow: hidden;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.15), transparent);
    transition: left 0.4s ease;
}

.neon-btn:hover {
    background: #00ff88;
    color: #050510;
    box-shadow: 0 0 30px #00ff8866, inset 0 0 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.neon-btn:hover::before {
    left: 100%;
}

.neon-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 15px #00ff8844;
}

.neon-btn.secondary {
    border-color: #ff00ff;
    color: #ff00ff;
}

.neon-btn.secondary:hover {
    background: #ff00ff;
    color: #050510;
    box-shadow: 0 0 30px #ff00ff66;
}

.controls-hint {
    display: flex;
    gap: 20px;
    margin-top: 24px;
    font-size: 11px;
    color: #555;
    letter-spacing: 1px;
}

.mobile-hint {
    display: none;
    font-size: 10px;
    color: #444;
    margin-top: 12px;
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .mobile-hint {
        display: block;
    }
}

.controls-hint span {
    padding: 6px 12px;
    border: 1px solid #333;
    border-radius: 4px;
}

.game-legend {
    display: flex;
    gap: 24px;
    margin-bottom: 30px;
    animation: slideUp 0.55s ease;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(255,255,255,0.2);
}

.final-stats {
    margin: 24px 0 32px;
    display: flex;
    gap: 50px;
    animation: slideUp 0.5s ease;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-size: 11px;
    color: #00ff88;
    letter-spacing: 2px;
}

#final-score, #final-tokens, #level-score {
    font-size: 40px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 25px #ff00ff88;
}

.combo-text {
    position: absolute;
    font-size: 28px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 20px #ffff00aa, 0 0 40px #ff880066;
    pointer-events: none;
    z-index: 50;
    animation: comboFloat 1s ease-out forwards;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

@keyframes comboFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    30% {
        transform: translate(-50%, -80%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.8);
    }
}

.charge-text {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 15px #00ff8888, 0 0 30px #9945FF66;
    pointer-events: none;
    z-index: 50;
    animation: chargeFloat 1.2s ease-out forwards;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    letter-spacing: 2px;
}

@keyframes chargeFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        transform: translate(-50%, -70%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120%) scale(0.6);
    }
}

.airdrop-text {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #9945FF;
    text-shadow: 0 0 20px #9945FF88, 0 0 40px #9945FF44;
    pointer-events: none;
    z-index: 60;
    animation: airdropPop 1.5s ease-out forwards;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    letter-spacing: 3px;
}

@keyframes airdropPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

.hidden {
    display: none !important;
}

#high-score-banner {
    background: linear-gradient(135deg, #ffcc00, #ff8800);
    color: #050510;
    padding: 10px 30px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
    border-radius: 4px;
    margin-bottom: 20px;
    animation: slideUp 0.4s ease, glowBanner 1s ease-in-out infinite;
}

@keyframes glowBanner {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 204, 0, 0.4); }
    50% { box-shadow: 0 0 40px rgba(255, 136, 0, 0.7); }
}

.game-over-btns {
    display: flex;
    gap: 12px;
    animation: slideUp 0.5s ease;
}

#share-card-modal {
    padding: 30px;
}

#share-card-modal h2 {
    margin-bottom: 20px;
    font-size: clamp(24px, 4vw, 36px);
}

#share-canvas {
    border: 2px solid #ff00ff;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.3);
}

.share-card-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.neon-btn.tertiary {
    border-color: #555;
    color: #888;
}

.neon-btn.tertiary:hover {
    background: #333;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.start-stats {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    padding: 16px 24px;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 8px;
    animation: slideUp 0.7s ease;
}

.start-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.start-stat-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: #555;
}

.start-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff8844;
}

@media (max-width: 600px) {
    #ui-layer {
        padding: 10px 12px;
    }

    #score-display {
        gap: 12px;
        padding: 8px 14px;
    }

    .score-label {
        font-size: 8px;
    }

    #score-value, #tokens-value, #bulls-value {
        font-size: 18px;
    }

    #level-display {
        padding: 8px 12px;
    }

    #level-value {
        font-size: 18px;
    }

    .level-name {
        font-size: 7px;
    }

    .restart-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .final-stats {
        gap: 30px;
    }

    #final-score, #final-tokens, #level-score {
        font-size: 28px;
    }

    .controls-hint {
        flex-direction: column;
        gap: 10px;
    }

    .game-legend {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .game-over-btns {
        flex-direction: column;
    }

    .share-card-btns {
        flex-direction: column;
    }

    .start-stats {
        flex-direction: column;
        gap: 16px;
    }

    #share-canvas {
        width: 100%;
    }

    .screen h1 {
        font-size: 36px;
        line-height: 1.1;
    }

    .screen h2 {
        font-size: 28px;
    }

    .screen p {
        font-size: 13px;
        padding: 0 10px;
    }

    .screen p.tagline {
        font-size: 11px;
        letter-spacing: 2px;
    }

    .neon-btn {
        padding: 14px 28px;
        font-size: 14px;
    }

    .combo-text {
        font-size: 22px;
    }

    .charge-text {
        font-size: 14px;
    }

    .airdrop-text {
        font-size: 18px;
    }

    .high-score-banner {
        font-size: 12px;
        padding: 6px 14px;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-value {
        font-size: 14px;
    }

    #share-card-modal {
        padding: 16px;
    }

    #share-card-modal h2 {
        font-size: 20px;
    }
}

@media (max-width: 380px) {
    #score-display {
        gap: 8px;
        padding: 6px 10px;
    }

    .score-label {
        font-size: 7px;
    }

    #score-value, #tokens-value, #bulls-value {
        font-size: 16px;
    }

    #level-display {
        padding: 6px 10px;
    }

    .restart-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .screen h1 {
        font-size: 30px;
    }

    .screen h2 {
        font-size: 24px;
    }

    .neon-btn {
        padding: 12px 24px;
        font-size: 13px;
    }

    .start-stats {
        padding: 12px 16px;
        gap: 12px;
    }

    .start-stat-value {
        font-size: 16px;
    }
}