:root {
    --ink: #1d2126;
    --cream: #f2e7d3;
    --orange: #ff6a1a;
    --canal: #28544c;
    --path: #a4493f;
    --white: #fffdf7;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: var(--ink);
    font-family: 'Nunito', sans-serif;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
#stage {
    position: relative;
    width: min(96vw, calc(92vh * 0.71));
}
#hud {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #14171b;
    border: 2px solid #000;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 8px 14px;
    font-weight: 800;
    font-size: clamp(12px, 1.8vh, 16px);
}
#hud .clock { font-family: 'Bungee'; color: var(--orange); min-width: 7ch; }
#hud .lives { color: #ff5252; font-size: 1.2em; letter-spacing: 2px; min-width: 4ch; }
#hud .speed { color: #9fd8c9; min-width: 8ch; text-align: right; }
#progress {
    flex: 1;
    height: 14px;
    background: #2a2f36;
    border-radius: 7px;
    position: relative;
    overflow: visible;
}
#progress .fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c8553d, var(--orange));
    border-radius: 7px;
    transition: width .2s linear;
}
#progress .rider {
    position: absolute;
    top: -7px;
    left: 0%;
    transform: translateX(-50%);
    font-size: 18px;
    transition: left .2s linear;
}
#mute {
    background: none;
    border: 2px solid #3a4048;
    color: var(--white);
    border-radius: 8px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
}
canvas {
    display: block;
    width: 100%;
    background: var(--canal);
    border: 2px solid #000;
    border-radius: 0 0 14px 14px;
    touch-action: none;
}
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 23, 27, .82);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    z-index: 5;
}
.card {
    background: var(--cream);
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: 18px;
    box-shadow: 8px 8px 0 var(--ink);
    padding: 26px 30px;
    width: min(86%, 440px);
    text-align: center;
}
.card h1 {
    font-family: 'Bungee';
    font-size: clamp(34px, 6vh, 52px);
    color: var(--path);
    letter-spacing: 2px;
    text-shadow: 3px 3px 0 var(--orange);
}
.card h2 { font-family: 'Bungee'; font-size: clamp(20px, 3.4vh, 30px); color: var(--path); }
.card .route { font-weight: 800; margin: 6px 0 14px; font-size: 15px; }
.card ul {
    text-align: left;
    list-style: none;
    font-size: clamp(13px, 1.9vh, 15px);
    font-weight: 600;
    margin: 0 0 16px;
}
.card ul li { margin: 5px 0; }
.card ul b { color: var(--path); }
.bigbtn {
    font-family: 'Bungee';
    font-size: 20px;
    background: var(--orange);
    color: var(--white);
    border: 3px solid var(--ink);
    border-radius: 12px;
    box-shadow: 4px 4px 0 var(--ink);
    padding: 10px 26px;
    cursor: pointer;
    transition: transform .08s;
}
.bigbtn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.stats { font-weight: 800; font-size: 16px; margin: 10px 0 16px; line-height: 1.7; }
.stats .time { font-family: 'Bungee'; font-size: 34px; color: var(--orange); display: block; }
.stars { font-size: 30px; letter-spacing: 6px; }
.quip { font-style: italic; font-weight: 600; margin-bottom: 14px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) {
    #progress .fill, #progress .rider { transition: none; }
}
#touch-controls {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 4;
    pointer-events: none;
}
.tc-group {
    display: flex;
    gap: 8px;
    pointer-events: none;
}
.tc-speed { flex-direction: column; align-items: center; }
.tc-btn {
    width: 58px;
    height: 58px;
    font-size: 22px;
    background: rgba(29, 33, 38, 0.65);
    border: 2px solid rgba(255, 253, 247, 0.35);
    border-radius: 14px;
    color: var(--white);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    pointer-events: all;
    -webkit-tap-highlight-color: transparent;
}
.tc-btn:active {
    background: rgba(255, 106, 26, 0.55);
    border-color: var(--orange);
}
.tc-bell { pointer-events: all; }