@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Noto+Sans+SC:wght@400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

:root {
    --bg-dark: #1e1b2e;
    --bg-card: #2a2640;
    --bg-card-hover: #352f4d;
    --neon-blue: #7c8cf8;
    --neon-pink: #ff6b9d;
    --neon-purple: #a78bfa;
    --neon-green: #6ee7b7;
    --neon-yellow: #fbbf24;
    --neon-orange: #fb923c;
    --neon-red: #f87171;
    --warm-coral: #ff8a80;
    --warm-peach: #ffab91;
    --warm-gold: #ffd54f;
    --warm-mint: #80cbc4;
    --warm-lavender: #b39ddb;
    --text-primary: #f8f0ff;
    --text-secondary: #b0a3c7;
    --text-dim: #7a6f94;
}

body {
    font-family: 'Noto Sans SC', 'Orbitron', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(251, 146, 60, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(167, 139, 250, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.neon-text {
    font-family: 'Orbitron', sans-serif;
    text-shadow: 0 0 10px var(--neon-orange), 0 0 20px var(--neon-orange);
}

.neon-border {
    border: 2px solid var(--neon-orange);
    box-shadow: 0 0 10px rgba(251, 146, 60, 0.3), inset 0 0 10px rgba(251, 146, 60, 0.1);
}

.neon-btn {
    background: linear-gradient(135deg, var(--neon-orange), var(--neon-pink));
    border: none;
    color: white;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.neon-btn:hover::before {
    left: 100%;
}

.neon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(251, 146, 60, 0.4), 0 0 40px rgba(255, 107, 157, 0.3);
}

.neon-btn:active {
    transform: translateY(0) scale(0.97);
}

.neon-btn-secondary {
    background: transparent;
    border: 2px solid var(--neon-orange);
    color: var(--neon-orange);
    padding: 10px 28px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.neon-btn-secondary:hover {
    background: var(--neon-orange);
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(251, 146, 60, 0.4);
}

.game-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-orange), var(--neon-pink));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: rgba(251, 146, 60, 0.3);
}

.game-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.category-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--neon-orange);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title::before,
.category-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon-orange), transparent);
}

.game-stats {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: var(--neon-green);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.game-area {
    background: var(--bg-card);
    border-radius: 24px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-hint {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    color: var(--neon-orange);
    text-align: center;
    max-width: 90%;
}

.countdown {
    font-family: 'Orbitron', sans-serif;
    font-size: 120px;
    font-weight: 900;
    color: var(--neon-orange);
    text-shadow: 0 0 30px rgba(251, 146, 60, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.score-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-orange), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.target {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--neon-pink), var(--neon-purple));
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 20px;
    transition: transform 0.1s ease;
    user-select: none;
}

.target:active {
    transform: scale(0.9);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 46, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.result-content {
    background: linear-gradient(145deg, var(--bg-card), #221e35);
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    border: 2px solid var(--neon-orange);
    box-shadow: 0 0 40px rgba(251, 146, 60, 0.2), 0 0 80px rgba(167, 139, 250, 0.1);
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.result-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(251, 146, 60, 0.04), transparent, rgba(255, 107, 157, 0.04), transparent);
    animation: rotateBg 10s linear infinite;
    pointer-events: none;
}

@keyframes rotateBg {
    100% { transform: rotate(360deg); }
}

@keyframes slideUp {
    from { transform: translateY(50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.rank-badge {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 900;
    margin: 0 auto 20px;
    position: relative;
    z-index: 1;
    animation: rankPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes rankPop {
    from { transform: scale(0) rotate(-180deg); }
    to { transform: scale(1) rotate(0deg); }
}

.rank-s {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    animation: rankPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both, rankSGlow 2s ease-in-out infinite;
}

@keyframes rankSGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 50px rgba(255, 215, 0, 0.6); }
}

.rank-a { background: linear-gradient(135deg, var(--neon-orange), var(--neon-pink)); box-shadow: 0 0 30px rgba(251, 146, 60, 0.4); }
.rank-b { background: linear-gradient(135deg, var(--neon-green), #34d399); box-shadow: 0 0 30px rgba(110, 231, 183, 0.3); }
.rank-c { background: linear-gradient(135deg, var(--text-secondary), #8b7fad); box-shadow: 0 0 20px rgba(176, 163, 199, 0.2); }
.rank-d { background: linear-gradient(135deg, var(--neon-red), #dc2626); box-shadow: 0 0 20px rgba(248, 113, 113, 0.3); }

.app-promotion {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.1), rgba(255, 107, 157, 0.1));
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 16px;
    padding: 15px;
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-orange), var(--neon-green));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.hidden { display: none !important; }

@media (max-width: 768px) {
    .countdown { font-size: 80px; }
    .score-display { font-size: 48px; }
    .game-card { padding: 15px; }
    .game-icon { width: 50px; height: 50px; font-size: 20px; }
    .result-content { padding: 25px; }
}

.click-effect {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(251, 146, 60, 0.5);
    pointer-events: none;
    animation: clickRipple 0.4s ease-out forwards;
}

@keyframes clickRipple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 80px;
    font-weight: 900;
    pointer-events: none;
    z-index: 500;
    animation: comboPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 0 0 20px currentColor;
}

@keyframes comboPop {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -60%) scale(0.8); opacity: 0; }
}

.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: particleFly 0.8s ease-out forwards;
}

@keyframes particleFly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.screen-shake {
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px) rotate(-0.5deg); }
    40% { transform: translateX(5px) rotate(0.5deg); }
    60% { transform: translateX(-3px) rotate(-0.3deg); }
    80% { transform: translateX(3px) rotate(0.3deg); }
}

.score-pop {
    position: absolute;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    animation: scorePop 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 100;
}

@keyframes scorePop {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-10px) scale(1.2); opacity: 1; }
    40% { transform: translateY(-20px) scale(1); opacity: 1; }
    100% { transform: translateY(-60px) scale(0.8); opacity: 0; }
}

.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    animation: flashFade 0.3s ease-out forwards;
}

@keyframes flashFade {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

.streak-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.streak-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.new-record {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    animation: newRecordPulse 1s ease-in-out infinite;
    margin-top: 10px;
}

@keyframes newRecordPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.6); }
}

.difficulty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.difficulty-easy { background: rgba(110, 231, 183, 0.2); color: var(--neon-green); border: 1px solid var(--neon-green); }
.difficulty-medium { background: rgba(251, 146, 60, 0.2); color: var(--neon-orange); border: 1px solid var(--neon-orange); }
.difficulty-hard { background: rgba(248, 113, 113, 0.2); color: var(--neon-red); border: 1px solid var(--neon-red); }

.timer-warning {
    animation: timerWarn 0.5s ease-in-out infinite;
}

@keyframes timerWarn {
    0%, 100% { color: var(--neon-red); text-shadow: none; }
    50% { color: #ff0000; text-shadow: 0 0 10px rgba(255, 0, 0, 0.5); }
}

.game-bg-pulse {
    animation: bgPulse 2s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { box-shadow: inset 0 0 30px rgba(251, 146, 60, 0.04); }
    50% { box-shadow: inset 0 0 60px rgba(251, 146, 60, 0.08); }
}

.level-up-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(110, 231, 183, 0.3), transparent 70%);
    pointer-events: none;
    z-index: 998;
    animation: levelFlash 0.6s ease-out forwards;
}

@keyframes levelFlash {
    0% { opacity: 1; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(2); }
}

.nav-home-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(42, 38, 64, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 146, 60, 0.3);
    color: var(--neon-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-home-btn:hover {
    background: rgba(251, 146, 60, 0.2);
    border-color: var(--neon-orange);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(251, 146, 60, 0.3);
}

/* Bottom app download bar */
.app-download-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: linear-gradient(135deg, rgba(42, 38, 64, 0.95), rgba(30, 27, 46, 0.98));
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(251, 146, 60, 0.25);
    padding: 0;
    display: block;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.3);
}

.app-download-bar .bar-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.app-download-bar .bar-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.app-download-bar .bar-text {
    flex: 1;
    min-width: 0;
}

.app-download-bar .bar-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.app-download-bar .bar-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.app-download-bar .bar-action {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--neon-orange), var(--neon-pink));
    color: white;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 20px;
    white-space: nowrap;
}

.app-download-bar .bar-close {
    position: absolute;
    top: -10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 1;
}

.app-download-bar .bar-close:hover {
    background: var(--neon-red);
    color: white;
    border-color: var(--neon-red);
}

/* Ensure body has bottom padding when bar is visible */
body.has-download-bar {
    padding-bottom: 56px;
}
