/* Hill Rally: a dark forest room around a bright hill road, amber for what matters. */
:root {
    --bg: #14231b; --card: #1d3327; --text: #f4f1e8; --dim: #b4c9b9; --line: rgba(244,241,232,.18); --amber: #ffb02e; --ink: #13221a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--text); min-height: 100vh;
    background-color: var(--bg);
    background-image: radial-gradient(1000px 520px at 50% -10%, #2f6b4a 0%, transparent 70%);
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.site-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px; min-height: 46px; background: #003a7a; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.site-bar a { text-decoration: none; color: #dbe7fb; font-weight: 700; font-size: 14px; }
.site-bar a:hover { color: #fff; }
.site-bar .brand { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .2px; white-space: nowrap; }
.site-bar nav { display: flex; gap: 4px 18px; flex-wrap: wrap; justify-content: flex-end; }
.site-bar nav a.on { color: #fff; box-shadow: 0 3px 0 var(--amber); }

.shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 960px) minmax(0, 1fr); gap: 18px; max-width: 1700px; margin: 0 auto; padding: 14px 12px 0; align-items: start; }
.rail { max-width: 300px; width: 100%; justify-self: center; margin-top: 8px; }
.stage { grid-column: 2; min-width: 0; display: grid; gap: 12px; }

.btn { border: 0; border-radius: 12px; background: var(--text); color: var(--ink); font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: 17px; padding: 10px 18px; box-shadow: 0 4px 0 rgba(0,0,0,.5); transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-block; text-align: center; line-height: 1.25; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.5); }
.btn.go { background: #5ad17a; font-size: 22px; padding: 12px 34px; }
.btn.sun { background: var(--amber); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { font-size: 14px; padding: 8px 14px; font-family: 'Nunito', sans-serif; font-weight: 800; }
.btn.wa { background: #25d366; color: #05361a; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.wa svg { width: 22px; height: 22px; flex: 0 0 auto; }

.head { text-align: center; padding: 6px 0 0; }
.logo { margin: 0; font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; font-weight: 700; font-size: clamp(40px, 8vw, 68px); line-height: 1.05; letter-spacing: .5px; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
.logo span { color: var(--amber); }
.tag { margin: 4px auto 0; max-width: 620px; color: var(--dim); font-size: 16px; line-height: 1.5; }

/* the game */
.wrap { position: relative; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 0 rgba(0,0,0,.4), 0 18px 40px rgba(0,0,0,.45); background: #5fb8f0; }
#cv { display: block; width: 100%; aspect-ratio: 960 / 600; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.fsbox { display: block; }
.fsbtn { position: absolute; right: 10px; bottom: 10px; z-index: 5; width: 42px; height: 42px; border-radius: 12px; border: 2px solid rgba(255,255,255,.55); background: rgba(15,30,22,.55); color: #fff; padding: 8px; display: grid; place-items: center; backdrop-filter: blur(2px); }
.fsbtn:hover { background: rgba(15,30,22,.8); }
.fsbtn svg { width: 100%; height: 100%; display: block; }
.fsbtn .i-close { display: none; }
.fs .fsbtn .i-open { display: none; } .fs .fsbtn .i-close { display: block; }
.fsbox.fs { position: fixed; inset: 0; z-index: 500; width: 100vw; height: 100vh; height: 100dvh; display: grid; place-items: center; background: #0b1a12; }
.fsbox.fs .wrap { width: min(100vw, 160vh); width: min(100vw, 160dvh); border-radius: 0; box-shadow: none; }
.fsbox.fs .fsbtn { right: 14px; bottom: 14px; }
body.fs-lock { overflow: hidden; }
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 14px; pointer-events: none; }
.score { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: clamp(30px, 6vw, 52px); line-height: 1; color: #fff; text-shadow: 0 3px 0 rgba(16,26,51,.55), 0 0 12px rgba(16,26,51,.4); font-variant-numeric: tabular-nums; }
.best { font-weight: 800; font-size: clamp(12px, 2vw, 15px); color: #fff; text-shadow: 0 2px 0 rgba(16,26,51,.6); margin-top: 2px; }
.lvl { margin-top: 2px; font-weight: 800; font-size: clamp(12px, 2vw, 15px); color: #ffe08a; text-shadow: 0 2px 0 rgba(16,26,51,.7); white-space: pre; }
.bonus { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: clamp(24px, 5vw, 34px); color: #fff; margin: 10px 0 4px; }
.card .small { font-size: 13px; opacity: .85; }
.lives { display: flex; gap: 4px; }
.lives i { width: clamp(20px, 4vw, 30px); aspect-ratio: 24 / 22; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 20.500C4 15 1 11 1 7.500A5.500 5.500 0 0 1 12 5A5.500 5.500 0 0 1 23 7.500C23 11 20 15 12 20.500Z' fill='%23ff4d5e' stroke='%23ffffff' stroke-width='1.600'/%3E%3C/svg%3E") center / contain no-repeat; filter: drop-shadow(0 2px 0 rgba(16,26,51,.55)); }
.lives i.off { opacity: .28; filter: grayscale(1) drop-shadow(0 2px 0 rgba(16,26,51,.4)); }
.over, .overlay { z-index: 8; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,30,22,.62); padding: 14px; text-align: center; }
.card { width: min(100%, 470px); background: rgba(15,30,22,.94); border: 3px solid var(--amber); border-radius: 20px; padding: 18px 20px 20px; box-shadow: 0 10px 30px rgba(0,0,0,.55); }
.card h2 { margin: 0 0 6px; font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: clamp(26px, 5vw, 36px); color: var(--amber); }
.card p { margin: 6px 0; color: var(--dim); font-weight: 700; line-height: 1.45; }
.howto { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 8px; text-align: left; }
.howto li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: center; background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.howto b { font-family: 'Fredoka', sans-serif; font-size: 22px; color: var(--amber); text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.howto b.long { font-size: 16px; }
.bigscore { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: 64px; line-height: 1; color: #fff; margin: 4px 0; }
.card .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.pausemsg { z-index: 8; cursor: pointer; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,30,22,.55); font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 40px; color: #fff; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.tip { margin: 0; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.5; }

/* ads and the footer */
.adbox { background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px 8px 8px; overflow: hidden; min-width: 0; }
.adbox small { display: block; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.adbox ins { min-height: 90px; }
.rail .adbox ins { min-height: 250px; }
.adbottom { width: calc(100% - 24px); max-width: 980px; margin: 18px auto 0; }
.site-foot { background: #0b1a12; color: #b4c9b9; text-align: center; padding: 22px 16px 26px; font-size: 14px; line-height: 1.6; }
.site-foot p { margin: 4px 0; }
.site-foot a { color: #fff; text-decoration: none; font-weight: 700; }
.site-foot a:hover { text-decoration: underline; }
.site-foot .copy { font-size: 12px; opacity: .7; }

/* the text under the game */
.about { background: #f1f4ee; color: #1d2c22; margin-top: 30px; padding: 30px 16px 40px; }
.abwrap { max-width: 760px; margin: 0 auto; }
.about h2 { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: 26px; margin: 26px 0 10px; }
.about h2:first-child { margin-top: 0; }
.about p, .rules { line-height: 1.65; }
.rules { padding-left: 22px; } .rules li { margin: 6px 0; }
details { border: 2px solid #d6dfd4; background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; color: #4b5c50; }
.note { margin-top: 24px; color: #5d6e62; font-size: 14px; }

@media (max-width: 1500px) {
    .shell { grid-template-columns: minmax(0, 960px); justify-content: center; }
    .rail { display: none; }
    .stage { grid-column: 1; }
}
@media (max-width: 480px) {
    .site-bar { padding: 0 12px; }
    .site-bar nav a:first-child { display: none; }
    .site-bar nav { gap: 4px 12px; flex-wrap: nowrap; } .site-bar nav a { font-size: 13px; } .site-bar .brand { font-size: 17px; }
    .howto li { grid-template-columns: 46px 1fr; font-size: 13.5px; padding: 6px 8px; }
    .card { padding: 12px 14px 14px; } .howto { margin: 6px 0 10px; gap: 5px; } .bigscore { font-size: 48px; }
    .btn.go { font-size: 19px; padding: 10px 26px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
/* a small screen: the canvas is only about 230 px high, so the cards over it are compact (and the rules are one line) */
.howto-short { display: none; }
@media (max-width: 600px), (max-height: 480px) {
    .over, .overlay { padding: 8px; }
    .card { padding: 8px 12px 10px; border-width: 2px; border-radius: 16px; }
    .card h2 { font-size: 21px; margin: 0 0 2px; }
    .card p { font-size: 12.5px; margin: 2px 0; line-height: 1.35; }
    .howto { display: none; }
    .howto-short { display: block; }
    .bigscore { font-size: 34px; margin: 0; }
    .bonus { font-size: 20px; margin: 4px 0 0; }
    .card .row { margin-top: 6px; gap: 8px; }
    .btn.go { font-size: 17px; padding: 8px 22px; }
    .card .btn.small { font-size: 12.5px; padding: 8px 10px; }
    .card .small { font-size: 11px; }
    .card h2 { font-size: 19px; }
    .bigscore { font-size: 30px; }
    #overStats { display: none; }
    .card .row .btn.go { font-size: 16px; padding: 7px 18px; }
}
@media (max-width: 380px) { .over { padding: 5px; } #over .card h2 { display: none; } #over .card { padding-top: 6px; } .card p { font-size: 11.5px; margin: 1px 0; } .bigscore { font-size: 28px; } }


/* the hill game: the pedals, the fuel, the coins */
#cv { cursor: default; }
.score { display: flex; align-items: baseline; gap: 8px; }
.coinrow { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: clamp(16px, 3vw, 22px); color: #fff; text-shadow: 0 2px 0 rgba(15,30,22,.6); }
.coinrow i { width: clamp(16px, 3vw, 22px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #ffc01f 60%, #d98a06); box-shadow: inset 0 0 0 2px #a0600a; }
.fuel { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.fuel .can { width: clamp(18px, 3vw, 24px); aspect-ratio: 34 / 44; background: #e0372d; border: 2px solid #7d1710; border-radius: 4px; position: relative; }
.fuel .can::before { content: ''; position: absolute; left: 2px; top: -6px; width: 40%; height: 5px; background: #e0372d; border: 2px solid #7d1710; border-bottom: 0; border-radius: 2px 2px 0 0; }
.fuel .track { width: clamp(90px, 22vw, 170px); height: clamp(12px, 2vw, 16px); background: rgba(15,30,22,.55); border: 2px solid rgba(255,255,255,.75); border-radius: 10px; overflow: hidden; }
.fuel .track i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #8df06a, #3fb53a); transition: width .15s linear; }
.fuel .track i.low { background: linear-gradient(180deg, #ff9a8a, #e0372d); }
.hud .right { display: grid; justify-items: end; }
.pedal { position: absolute; bottom: 14px; z-index: 4; width: clamp(64px, 14vw, 104px); height: clamp(64px, 14vw, 104px); border-radius: 22px; border: 3px solid rgba(255,255,255,.7); background: rgba(15,30,22,.5); color: #fff; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: clamp(12px, 2.4vw, 16px); display: grid; place-items: center; align-content: center; gap: 2px; touch-action: none; user-select: none; -webkit-user-select: none; padding: 0; }
.pedal svg { width: 46%; }
.pedal.on { background: rgba(255,176,46,.85); border-color: #fff; color: #13221a; transform: scale(.96); }
#pedBrake { left: 14px; } #pedGas { right: 14px; }
.fsbox.fs .pedal { bottom: 22px; }
.fsbtn { bottom: auto; top: 10px; right: 10px; }
.fsbox.fs .fsbtn { top: 14px; right: 14px; bottom: auto; }
.hud { padding-right: 62px; }
.howto b { min-width: 0; font-size: 18px; }
@media (max-width: 480px) { .pedal { border-radius: 16px; } .hud { padding-right: 54px; } .fsbtn { width: 36px; height: 36px; padding: 6px; } }
