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

:root {
    --bg-main: #050811;
    --neon-green: #22c55e;
    --neon-cyan: #06b6d4;
    --neon-magenta: #ec4899;
    --neon-red: #ef4444;
    --gold: #fbbf24;
    --text: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    background: radial-gradient(circle at 50% 20%, #082f49, var(--bg-main) 75%);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    padding-bottom: 75px; /* Space for bottom banner ad */
}

/* Header & HUD */
header {
    width: 100%;
    max-width: 500px;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 8, 17, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 50;
}

.title-group h1 {
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-stats {
    display: flex;
    gap: 8px;
}

.stat-chip {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 10px;
    text-align: center;
    min-width: 55px;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: #22c55e;
    font-variant-numeric: tabular-nums;
}

/* 3D Canvas Viewport */
#canvas-container {
    flex: 1;
    width: 100%;
    max-width: 500px;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#slope-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#slope-canvas:active {
    cursor: grabbing;
}

/* Mobile Touch Controls Overlay */
.touch-controls {
    position: absolute;
    bottom: 15px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    z-index: 20;
    pointer-events: none;
}

.touch-btn {
    width: 70px;
    height: 70px;
    background: rgba(15, 23, 42, 0.7);
    border: 2px solid rgba(56, 189, 248, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    color: #38bdf8;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    transition: transform 0.1s, background 0.1s, border-color 0.1s;
}

.touch-btn:active, .touch-btn.active {
    background: rgba(34, 197, 94, 0.4);
    border-color: #22c55e;
    transform: scale(0.92);
    color: #fff;
}

.touch-btn.jump-btn {
    width: 96px;
    height: 60px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.8px;
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

.touch-btn.jump-btn:active, .touch-btn.jump-btn.active {
    background: rgba(34, 197, 94, 0.6);
    border-color: #22c55e;
    color: #fff;
    transform: scale(0.92);
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.8);
}

/* Start Overlay */
.start-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 17, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 40;
    cursor: pointer;
    text-align: center;
    padding: 20px;
}

.start-overlay h2 {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.start-overlay p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 320px;
    line-height: 1.5;
}

.play-prompt {
    margin-top: 20px;
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    color: #fff;
    font-weight: 800;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    animation: pulsePrompt 1.5s infinite ease-in-out;
}

@keyframes pulsePrompt {
    0%, 100% { transform: scale(1); box-shadow: 0 0 15px rgba(34, 197, 94, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(34, 197, 94, 0.8); }
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.modal-box {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-box h2 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: #ef4444;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.results-grid {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    padding: 14px;
    margin: 16px 0 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.res-item span {
    display: block;
}

.res-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.res-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: #22c55e;
}

.action-btn {
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
}

.action-btn:active {
    transform: translateY(1px);
}
