* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --dark-bg: #0a0e27;
    --light-text: #ffffff;
    --accent-blue: #00d4ff;
    --danger-red: #ff3838;
    --success-green: #4caf50;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--dark-bg);
    color: var(--light-text);
    overflow-x: hidden;
}

.site-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.site-header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.built-with {
    color: var(--light-text);
    text-decoration: none;
    font-weight: 700;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.built-with:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    max-width: 400px;
}

.roller-coaster-icon {
    font-size: 5rem;
    animation: bounce 1s infinite;
}

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

.loading-content h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    margin: 1rem 0;
    letter-spacing: 2px;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 2rem 0;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0;
}

.loading-text {
    color: var(--accent-blue);
    font-size: 1rem;
    margin-top: 1rem;
}

.main-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    overflow: hidden;
}

#coasterCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87ceeb 0%, #1a4d6d 50%, #0a0e27 100%);
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    z-index: 10;
}

.hud-item {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--accent-blue);
    border-radius: 10px;
    padding: 10px 15px;
    min-width: 120px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.hud-label {
    display: block;
    font-size: 0.7rem;
    color: var(--accent-blue);
    font-weight: 700;
    letter-spacing: 1px;
}

.hud-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Bebas Neue', sans-serif;
    color: var(--light-text);
    line-height: 1;
    margin: 5px 0;
}

.hud-unit {
    display: inline-block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 5px;
}

.safety-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 39, 0.95) 50%);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.safety-bar.visible {
    opacity: 1;
}

.safety-bar-content {
    text-align: center;
}

.bar-visual {
    width: 400px;
    height: 40px;
    background: linear-gradient(135deg, #333 0%, #666 50%, #333 100%);
    border-radius: 20px;
    border: 3px solid #888;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.8), inset 0 2px 5px rgba(255, 255, 255, 0.2);
    position: relative;
    margin: 0 auto 10px;
}

.bar-visual::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: #444;
    border-radius: 50%;
    border: 3px solid #666;
    top: -10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.safety-bar-content p {
    color: var(--success-green);
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 1rem;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.start-screen, .end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.start-screen.hidden, .end-screen.hidden {
    display: none;
}

.start-content, .end-content {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.start-content h2, .end-content h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    letter-spacing: 4px;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.warning-text {
    color: var(--danger-red);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

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

.ride-stats {
    list-style: none;
    text-align: left;
    display: inline-block;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem 2rem;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ride-stats li {
    font-size: 1.1rem;
    padding: 0.5rem 0;
    color: rgba(255, 255, 255, 0.8);
}

.ride-stats strong {
    color: var(--accent-blue);
    font-weight: 700;
}

.start-button, .restart-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 3px;
    padding: 1.5rem 3rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.5);
    position: relative;
    overflow: hidden;
}

.start-button::before, .restart-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.start-button:hover::before, .restart-button:hover::before {
    width: 300px;
    height: 300px;
}

.start-button:hover, .restart-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(255, 107, 53, 0.7);
}

.start-button:active, .restart-button:active {
    transform: translateY(-2px);
}

.button-text {
    position: relative;
    z-index: 1;
    display: block;
}

.button-subtext {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 0.8rem;
    font-family: 'Roboto', sans-serif;
    letter-spacing: 1px;
    margin-top: 0.3rem;
    opacity: 0.8;
}

.instruction-text {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 1px;
}

.wind-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    opacity: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(255, 255, 255, 0.1) 100%);
    transition: opacity 0.3s ease;
}

.wind-effect.active {
    opacity: 1;
}

.site-footer {
    background: rgba(10, 14, 39, 0.9);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .site-header h1 {
        font-size: 1.8rem;
    }

    .built-with {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .hud {
        flex-direction: column;
        gap: 10px;
        top: 10px;
        left: 10px;
    }

    .hud-item {
        min-width: 100px;
        padding: 8px 12px;
    }

    .hud-value {
        font-size: 1.5rem;
    }

    .start-content h2, .end-content h2 {
        font-size: 2rem;
    }

    .start-button, .restart-button {
        font-size: 1.2rem;
        padding: 1.2rem 2.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .bar-visual {
        width: 300px;
    }

    .safety-bar {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .ride-stats {
        padding: 1rem;
    }

    .ride-stats li {
        font-size: 0.95rem;
    }

    .bar-visual {
        width: 250px;
        height: 30px;
    }

    .bar-visual::before {
        width: 45px;
        height: 45px;
    }
}