/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ===== SPLASH SCREEN ===== */
#splash {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.splash-content {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.game-title {
    font-size: clamp(48px, 15vw, 72px);
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: pulse 2s ease-in-out infinite;
}

.tagline {
    font-size: clamp(14px, 4vw, 18px);
    opacity: 0.9;
    margin-bottom: 60px;
    font-weight: 300;
    letter-spacing: 2px;
}

.high-score-display {
    margin-top: 40px;
    font-size: 20px;
    opacity: 0.8;
}

.high-score-display .label {
    opacity: 0.7;
    font-size: 14px;
    margin-right: 10px;
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary {
    font-size: 18px;
    font-weight: 700;
    padding: 18px 48px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-primary {
    background: #fff;
    color: #667eea;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-secondary {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    margin-top: 15px;
}

.btn-secondary:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.1);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

/* ===== GAME SCREEN ===== */
#game {
    background: #000000;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(env(safe-area-inset-top), 20px) 20px 20px 20px;
    position: relative;
    z-index: 10;
}

.score-container, .best-container, .level-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.best-container {
    align-items: flex-end;
}

.level-text {
    font-size: 18px;
    font-weight: bold;
    color: #4ecca3;
    text-shadow: 0 0 10px rgba(78, 204, 163, 0.5);
}

.label {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 1px;
    font-weight: 600;
}

.score-value {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    color: #fff;
}

.combo-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.combo-text {
    font-size: 16px;
    font-weight: 700;
    color: #ffeb3b;
    text-shadow: 0 2px 10px rgba(255,235,59,0.5);
    animation: bounceIn 0.3s ease;
}

/* ===== GAME CANVAS ===== */
.game-canvas {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.center-zone {
    position: absolute;
    width: 200px; /* Much wider - lines further apart */
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.08); /* Slightly more visible */
    border-left: 2px dashed rgba(255,255,255,0.4); /* More visible dashed lines */
    border-right: 2px dashed rgba(255,255,255,0.4);
    pointer-events: none;
    z-index: 1;
}

.color-bar {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: transform 0.05s linear;
    pointer-events: none; /* Allow bars to pass through each other */
}

.left-bar {
    left: 0; /* Let translateX handle positioning */
    z-index: 2; /* Left bar on one layer */
}

.right-bar {
    left: 0; /* Let translateX handle positioning */
    z-index: 3; /* Right bar on different layer - can pass through */
}

.tap-area {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
}

/* ===== GAME FOOTER ===== */
.game-footer {
    width: 100%;
    padding: 20px 20px max(env(safe-area-inset-bottom), 20px) 20px;
    text-align: center;
}

.feedback {
    font-size: 24px;
    font-weight: 900;
    min-height: 30px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.feedback.perfect {
    color: #4caf50;
    animation: feedbackPop 0.5s ease;
}

.feedback.good {
    color: #ffeb3b;
    animation: feedbackPop 0.5s ease;
}

.feedback.okay {
    color: #ff9800;
    animation: feedbackPop 0.5s ease;
}

.feedback.miss {
    color: #f44336;
    animation: shake 0.5s ease;
}

.instruction {
    font-size: 14px;
    opacity: 0.5;
    letter-spacing: 1px;
    animation: pulse 2s ease-in-out infinite;
}

/* ===== GAME OVER SCREEN ===== */
#gameOver {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

.game-over-content {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.game-over-title {
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 30px;
    letter-spacing: 2px;
    color: #f44336;
}

.final-score {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.big-score {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -2px;
    color: #fff;
    text-shadow: 0 4px 20px rgba(255,255,255,0.2);
}

.new-record {
    font-size: 20px;
    font-weight: 700;
    color: #ffeb3b;
    margin: 20px 0;
    animation: bounceIn 0.6s ease;
}

.new-record.hidden {
    display: none;
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 32px;
    font-weight: 900;
    color: #fff;
}

.stat-label {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 5px;
}

/* ===== INFO BUTTON & MODAL ===== */
.info-btn {
    position: fixed;
    top: max(env(safe-area-inset-top), 20px);
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.info-btn:active {
    transform: scale(0.9);
}

.info-btn.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #667eea;
}

.modal-content h4 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #999;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    opacity: 0.9;
}

.modal-content ul {
    list-style: none;
    margin: 15px 0;
}

.modal-content li {
    margin: 10px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
}

.modal-content li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
}

.tip {
    background: rgba(102, 126, 234, 0.2);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    margin-top: 20px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes feedbackPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 375px) {
    .game-title {
        font-size: 48px;
    }
    
    .big-score {
        font-size: 48px;
    }
    
    .stats-grid {
        gap: 20px;
    }
}

/* ===== SAFE AREA FOR NOTCH ===== */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

