:root {
  --ink: #f5f3ee;
  --muted: #b9c0c8;
  --panel: rgba(16, 20, 26, 0.78);
  --accent: #f2b544;
  --danger: #e8412c;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1116; color: var(--ink); font-family: var(--font); }
#app canvas { display: block; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

#loading, #start {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #233042, #0d1116 70%); z-index: 20; text-align: center; padding: 16px;
}
#loading .brand { font-size: clamp(26px, 5vw, 46px); font-weight: 800; letter-spacing: 0.02em; }
#loading .sub { color: var(--muted); margin: 6px 0 28px; }
#loading-text { color: var(--muted); max-width: 640px; }
#loading.error #loading-text { color: #ffb4a8; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #2c3a4d; border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin-bottom: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* load progress: the fill is scaled (transform), so it moves smoothly between the percent updates */
.progress { position: relative; width: min(420px, 100%); height: 8px; border-radius: 4px; background: #2c3a4d; overflow: hidden; margin-top: 16px; }
.progress > i { position: absolute; inset: 0; background: var(--accent); transform-origin: left center; transform: scaleX(0); transition: transform 0.35s linear; }
.progress::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent); transform: translateX(-100%); animation: sweep 1.4s linear infinite; }
@keyframes sweep { to { transform: translateX(100%); } }
#loading-pct { color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 6px; font-size: 14px; }
#loading-slow { color: #ffd38a; max-width: 520px; margin-top: 12px; font-size: 14px; }
#loading.error .progress, #loading.error #loading-pct, #loading.error .spinner { display: none; }
#loading-retry { margin-top: 18px; background: var(--accent); color: #1a1407; border: 0; border-radius: 10px; padding: 10px 22px; font-size: 15px; font-weight: 700; cursor: pointer; }
#play.warming { position: relative; overflow: hidden; background: #3a4656; color: #e8edf3; cursor: progress; min-width: 280px; }
#play.warming > i { position: absolute; inset: 0; background: var(--accent); opacity: 0.45; transform-origin: left center; transform: scaleX(0); transition: transform 0.35s linear; }
#play.warming > span { position: relative; }
#mouse-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); font-size: 13px; color: #dfe3e8; background: rgba(13, 17, 22, 0.55); padding: 5px 12px; border-radius: 8px; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }

#start { background: rgba(8, 11, 15, 0.6); cursor: pointer; }
#start .panel { background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 26px 30px; max-width: 760px; width: 100%; backdrop-filter: blur(8px); }
#start h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 36px); }
#start .lead { color: var(--muted); line-height: 1.45; margin: 0 0 18px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; text-align: left; font-size: 14px; color: #dfe3e8; margin-bottom: 20px; }
.controls b { color: var(--accent); }
#play { background: var(--accent); color: #1a1407; border: 0; border-radius: 10px; padding: 12px 26px; font-size: 16px; font-weight: 700; cursor: pointer; }
@media (max-width: 600px) { .controls { grid-template-columns: 1fr; } }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
#topleft { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 2px; }
#topleft .title { font-weight: 800; font-size: 18px; letter-spacing: 0.02em; }
#mode { color: var(--muted); font-size: 13px; }
#topright { position: absolute; top: 14px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--muted); }
#clock { font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

#minimap { position: absolute; left: 16px; bottom: 34px; width: 210px; height: 210px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55), 0 4px 18px rgba(0, 0, 0, 0.5); }
#street { position: absolute; right: 22px; bottom: 74px; text-align: right; }
#street-name { font-size: 24px; font-weight: 800; }
#street-old { font-size: 14px; color: var(--accent); }
#street.flash { animation: flash 0.6s ease-out; }
@keyframes flash { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#speed { position: absolute; right: 24px; bottom: 132px; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
#speed small { font-size: 15px; margin-left: 6px; color: var(--muted); }
#prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--panel); padding: 8px 16px; border-radius: 8px; font-size: 15px; }
#info { position: absolute; top: 80px; right: 16px; width: min(380px, calc(100vw - 32px)); background: var(--panel); border-radius: 12px; padding: 14px 18px; text-shadow: none; }
#info-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
#info-body { margin: 0; padding-left: 18px; color: #dfe3e8; font-size: 14px; line-height: 1.5; }
#toast { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 10px 18px; border-radius: 10px; font-size: 15px; }
#help { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: min(820px, calc(100vw - 32px)); background: var(--panel); padding: 12px 16px; border-radius: 10px; font-size: 14px; line-height: 1.5; text-align: center; }
#stats { position: absolute; top: 64px; left: 16px; font: 12px ui-monospace, monospace; background: rgba(0, 0, 0, 0.55); padding: 4px 8px; border-radius: 6px; }
#attribution { position: absolute; bottom: 6px; right: 10px; font-size: 11px; color: rgba(255, 255, 255, 0.75); }
#fullmap { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 10; cursor: crosshair; }

/* Settings block on the start / pause panel (ui/settingsPanel.js) */
#start { overflow-y: auto; justify-content: flex-start; }
#start .panel { margin: auto 0; }
.settings { text-align: left; margin: 0 0 16px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 8px 12px; cursor: default; }
.settings summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 4px 0; }
.set-row { display: grid; grid-template-columns: 9.5em 1fr 4.2em; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.set-row input[type=range] { width: 100%; min-width: 0; accent-color: var(--accent); height: 28px; }
.set-row output { text-align: right; font-variant-numeric: tabular-nums; color: #dfe3e8; }
.set-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; font-size: 14px; }
.set-caption { width: 9.5em; }
.set-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; }
.set-chip { background: #2a3442; color: #e7ebf0; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; min-height: 34px; }
.set-chip.on { background: var(--accent); color: #1a1407; border-color: transparent; font-weight: 700; }
.settings :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) { .set-row { grid-template-columns: 1fr 3.6em; } .set-row label { grid-column: 1 / -1; } .set-caption { width: 100%; } }

/* YouTube playlist station (ytAudio.js): YouTube's player must stay visible, so it is a small card while the station plays */
.yt-radio { position: fixed; left: 12px; top: 68px; z-index: 30; width: 200px; background: var(--panel); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); }
.yt-radio-caption { padding: 6px 10px; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-radio iframe { display: block; }
@media (pointer: coarse) { .yt-radio { left: auto; right: 12px; top: 64px; } }
.set-row input[type='url'] { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.35); color: inherit; font: inherit; }

/* «Неон» (neonMode.js): cinema bars */
body.look-neon::before, body.look-neon::after { content: ''; position: fixed; left: 0; right: 0; height: 7vh; background: #000; z-index: 3; pointer-events: none; }
body.look-neon::before { top: 0; }
body.look-neon::after { bottom: 0; }
@media (pointer: coarse) { body.look-neon::before, body.look-neon::after { height: 5vh; } }

/* the loading music card (src/ui/loadingMusic.js): above the loading and start screens */
.yt-radio.loading-music { z-index: 1000; top: auto; bottom: 12px; } /* bottom-left: clear of the start panel's title */
.loading-music-off { position: absolute; top: 4px; right: 4px; z-index: 2; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; line-height: 22px; padding: 0; }
#enter-gate { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(8, 9, 12, 0.88); cursor: pointer; }
#enter-gate .eg-title { font-size: clamp(22px, 5vw, 44px); font-weight: 900; letter-spacing: 0.08em; color: #fff; text-align: center; }
#enter-gate .eg-btn { font-size: 22px; font-weight: 800; padding: 16px 40px; border: 0; border-radius: 14px; background: var(--accent, #f5c518); color: var(--accent-ink, #111); cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em; }
#enter-gate .eg-note { font-size: 13px; color: rgba(255, 255, 255, 0.7); }

/* the loading music's mute button (src/ui/loadingMusic.js) */
.loading-music-toggle { position: fixed; left: 12px; bottom: 12px; z-index: 2300; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 18px; cursor: pointer; }
