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

:root {
    --bg-main: #0b0f19;
    --dino-green: #22c55e;
    --accent: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #22c55e, #38bdf8);
    --gold: #fbbf24;
    --text: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    background: radial-gradient(circle at 50% 15%, #1e293b, var(--bg-main) 75%);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace, 'Segoe UI', system-ui;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 75px; /* Space for bottom banner ad */
}

/* Header & HUD */
header {
    width: 100%;
    max-width: 540px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 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: 900;
    background: var(--accent-gradient);
    -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(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px 10px;
    text-align: center;
    min-width: 60px;
}

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

.stat-value {
    font-size: 0.95rem;
    font-weight: 900;
    color: #22c55e;
    letter-spacing: 1px;
}

/* Toolbar & Themes */
.toolbar {
    width: 100%;
    max-width: 540px;
    padding: 6px 14px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pill-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn:hover {
    color: #fff;
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

.pill-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

/* Game Canvas Container */
.game-viewport {
    flex: 1;
    width: 100%;
    max-width: 540px;
    height: 320px;
    margin: 8px auto;
    position: relative;
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
}

#dino-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Mobile Touch Controls */
.touch-bar {
    width: 100%;
    max-width: 540px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.touch-btn {
    flex: 1;
    height: 60px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(56, 189, 248, 0.4);
    border-radius: 14px;
    color: #38bdf8;
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s, background 0.1s, border-color 0.1s;
}

.touch-btn.duck {
    border-color: rgba(251, 191, 36, 0.6);
    color: #fbbf24;
    background: rgba(15, 23, 42, 0.85);
}

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

/* Start Overlay */
.start-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(6px);
    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: 1.8rem;
    font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

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

.tap-prompt {
    font-size: 1.2rem;
    font-weight: 900;
    color: #22c55e;
    margin-top: 14px;
    animation: pulsePrompt 1.4s infinite ease-in-out;
}

@keyframes pulsePrompt {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.7; }
}

/* 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.3rem;
    font-weight: 900;
    color: #22c55e;
}

.action-btn {
    background: var(--accent-gradient);
    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);
}
