/* Color Bounce Switch — Neon Arcade Styling & Responsive Layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
    color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Container wrapper with bottom clearance for the fixed outer bottom ad */
.game-wrapper {
    width: 100%;
    max-width: 460px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 8px 10px 65px; /* 65px clearance so bottom ad never covers game */
}

/* Top HUD */
.game-hud {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.hud-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(3, 7, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 2px 10px;
    min-width: 60px;
}

.hud-card.best-card {
    border-color: rgba(245, 158, 11, 0.3);
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #94a3b8;
}

.hud-val {
    font-size: 1.15rem;
    font-weight: 900;
    color: #38bdf8;
    line-height: 1.2;
}

.best-card .hud-val {
    color: #fbbf24;
}

.active-color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 12px currentColor;
    transition: background 0.3s, border-color 0.3s;
}

.hud-controls {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(3, 7, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
}

/* Canvas Area */
.canvas-container {
    flex: 1;
    width: 100%;
    position: relative;
    border-radius: 16px;
    background: #030712;
    border: 2px solid rgba(56, 189, 248, 0.25);
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.7), 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    touch-action: none;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* Tap Hint */
.tap-hint {
    position: absolute;
    top: 68%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s;
    animation: bounce-pulse 1.4s infinite ease-in-out;
}

.tap-hand {
    font-size: 2.4rem;
    margin-bottom: 6px;
}

.tap-text {
    font-size: 0.85rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(3, 7, 18, 0.8);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    letter-spacing: 0.5px;
}

@keyframes bounce-pulse {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-10px); }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 16px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    width: 100%;
    max-width: 340px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.92);
    transition: transform 0.25s ease;
}

.modal.active .modal-box {
    transform: scale(1);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #f43f5e;
    margin-bottom: 16px;
}

.modal-text {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.modal-scores {
    background: #030712;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 18px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: #94a3b8;
    margin: 6px 0;
}

.score-row strong {
    color: #38bdf8;
    font-size: 1.15rem;
}

.new-record-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-weight: 900;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 16px;
    animation: bounce-pulse 1s infinite alternate;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    border: none;
    color: #0f172a;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
}
