/* (C) Mateusz Kanik 2026 */
:root {
  --primary: #e74c3c;
  --accent: #f1c40f;
  --bg: #050505;
  --panel-bg: rgba(15, 10, 10, 0.95);
  --border: rgba(231, 76, 60, 0.3);
  --danger: #e74c3c;
  --success: #2ecc71;
  --drive: #e74c3c;
}
* { box-sizing: border-box; }
body, html {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background-color: #0a0a0a; font-family: 'Impact', sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
  display: flex; justify-content: center;
}
#game-wrap {
  position: relative; width: 100%; max-width: 480px; height: 100%;
  background-color: #050505; overflow: hidden;
  box-shadow: 0 0 50px rgba(0,0,0,0.9);
  border-left: 1px solid #222; border-right: 1px solid #222;
}
canvas {
  display: block; position: absolute; top: 0; left: 0; z-index: 1;
  width: 100%; height: 100%;
}
#loading-bar-bg {
  width: 100%; height: 20px; background: #111; border-radius: 10px;
  margin: 20px 0; overflow: hidden; border: 1px solid #333;
}
#loading-bar-fill {
  height: 100%; width: 0%; background: var(--primary); transition: width 0.1s;
}
#loading-text { font-size: 24px; color: #fff; }
#route-segments-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none;
}
.route-segment-visual { position: absolute; top: 0; height: 100%; opacity: 0.6; }
.route-segment-visual.works { background: #f1c40f; }
.route-segment-visual.opp { background: #3498db; }
.fullscreen-menu {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #050505; z-index: 400; display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 20px;
  transition: opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.5s;
  text-align: center; pointer-events: auto;
}
.menu-panel {
  background: var(--panel-bg);
  padding: 30px; border-radius: 20px; border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 15px rgba(231, 76, 60, 0.15);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: 100%; text-align: center; z-index: 401;
}
.siren-bg { animation: sirenFlash 0.6s infinite alternate; }
@keyframes sirenFlash {
  0%, 49% { background: radial-gradient(circle at center, rgba(200, 0, 0, 0.6) 0%, #050505 80%); }
  50%, 100% { background: radial-gradient(circle at center, rgba(0, 0, 200, 0.6) 0%, #050505 80%); }
}
.skull-icon {
  font-size: 80px; text-shadow: 0 0 20px #fff;
  animation: pulseSkull 1s infinite alternate cubic-bezier(0.25, 0.1, 0.25, 1);
  margin-bottom: 10px;
}
@keyframes pulseSkull {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 40px #e74c3c; }
}
.danger-text {
  color: #e74c3c; font-size: 36px; text-transform: uppercase;
  text-shadow: 0 5px 15px rgba(231, 76, 60, 0.6); letter-spacing: 2px; margin: 10px 0;
}
.warning-text {
  font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 400; line-height: 1.6;
  color: #e2e8f0; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--danger); padding: 20px; border-radius: 8px;
  margin: 15px 0; text-align: left; box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.blink-text {
  color: #f1c40f; font-size: 20px; text-transform: uppercase; margin-top: 20px;
  animation: splashTextAnim 1s infinite alternate;
}
.btn-container-row {
  display: flex; gap: 15px; margin-top: 20px; width: 100%; justify-content: center; flex-wrap: wrap;
}
.juicy-btn {
  padding: 15px 30px; font-size: 22px; font-family: 'Impact'; color: #fff;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 8px 0 #8e44ad, 0 15px 20px rgba(0,0,0,0.8);
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.1s;
  letter-spacing: 1px; text-transform: uppercase; width: 100%; text-align: center; display: inline-block;
}
.juicy-btn:active {
  transform: translateY(8px) scale(0.95);
  box-shadow: 0 0 0 transparent, 0 5px 10px rgba(0,0,0,0.8);
}
#btn-back-to-map {
  background: #3498db; box-shadow: 0 8px 0 #2980b9, 0 15px 20px rgba(0,0,0,0.8); margin-top: 20px;
}
#btn-back-to-map:active {
  box-shadow: 0 0 0 #2980b9, 0 5px 10px rgba(0,0,0,0.8);
}
.btn-support:active {
  box-shadow: 0 0 0 #d35400, 0 5px 10px rgba(0,0,0,0.8) !important;
}
#btn-about-wrapper {
  position: absolute; top: 15px; z-index: 500;
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
#btn-about-wrapper.corner { left: calc(100% - 15px); transform: translateX(-100%); }
#btn-about-wrapper.center { left: 50%; transform: translateX(-50%); }
#btn-about {
  background: var(--panel-bg); border: 1px solid var(--border); padding: 0 15px; height: 44px;
  border-radius: 8px; cursor: pointer; font-size: 18px; font-family: 'Impact', sans-serif;
  color: #fff; transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
  text-transform: uppercase; white-space: nowrap; display: flex; align-items: center; justify-content: center;
}
#btn-about:active { transform: scale(0.9); }
#btn-about:hover { box-shadow: 0 0 10px var(--accent); border-color: var(--accent); }
#splash-screen {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.4), rgba(0, 0, 0, 0.9)), url('gfx/splash/bg.png') center/cover no-repeat;
  background-blend-mode: overlay; z-index: 300; display: flex; flex-direction: column;
  justify-content: space-between; align-items: center; padding-top: 15%; padding-bottom: 25%;
  cursor: pointer; transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: splashBgFloat 12s ease-in-out infinite alternate;
}
#splash-screen::after {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle, transparent 30%, #050505 100%);
  pointer-events: none; z-index: 300;
}
#splash-logo {
  width: 512px; max-width: 80%; animation: splashLogoAnim 3s ease-in-out infinite;
  filter: drop-shadow(0 15px 35px rgba(231,76,60,0.5)); z-index: 301;
}
#splash-text {
  color: #f1c40f; font-size: min(6vw, 24px); text-transform: uppercase; text-align: center;
  text-shadow: 0 4px 10px rgba(0,0,0,1), 0 0 20px rgba(241, 196, 15, 0.5);
  animation: splashTextAnim 1.2s infinite alternate cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 301; padding: 0 20px; width: 100%; box-sizing: border-box;
  word-wrap: break-word; overflow-wrap: break-word; line-height: 1.2;
}
@keyframes splashBgFloat {
  0% { transform: scale(1.0) rotate(0deg); }
  100% { transform: scale(1.08) rotate(1.5deg); }
}
@keyframes splashLogoAnim {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 10px 25px rgba(231,76,60,0.5)); }
  50% { transform: translateY(-15px) scale(1.03); filter: drop-shadow(0 20px 40px rgba(231,76,60,0.8)); }
}
@keyframes splashTextAnim {
  0% { transform: scale(0.95); opacity: 0.6; }
  100% { transform: scale(1.05); opacity: 1; }
}
#top-ui-bar {
  position: absolute; top: 0; left: 0; width: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.95), rgba(0,0,0,0.5), transparent);
  display: flex; flex-direction: column; align-items: center; z-index: 15; padding-bottom: 20px; pointer-events: none;
}
#stats-row {
  width: 100%; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; padding: 15px 25px;
}
#left-panel { display: flex; flex-direction: column; align-items: flex-start; }
#score-label {
  color: #f1c40f; font-family: sans-serif; font-size: 13px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
}
#score-text {
  color: #fff; font-size: 46px; text-shadow: 0 4px 10px rgba(0,0,0,0.8), 0 0 20px rgba(255,0,0,0.5); transition: transform 0.1s; margin-top: -5px;
}
#combo-text {
  color: #fff; font-size: 26px; text-shadow: 0 2px 10px rgba(231,76,60,0.8); letter-spacing: 1px; transition: transform 0.1s, color 0.2s;
}
#combo-text.high { color: #e74c3c; animation: pulseCombo 0.3s infinite alternate; }
@keyframes pulseCombo {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}
#yanusik-box {
  padding: 6px 14px; background: rgba(15, 15, 20, 0.95); border-radius: 8px;
  border: 2px solid #3498db; color: #fff; font-family: sans-serif; font-weight: bold;
  font-size: 14px; box-shadow: 0 0 15px rgba(52, 152, 219, 0.5); text-transform: uppercase;
  transform: translateY(-100px); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#yanusik-box.visible { transform: translateY(0); }
#yanusik-box.visible.counting {
  position: absolute; top: 150px; left: 50%; transform: translate(-50%, 0) scale(1.6);
  z-index: 500; box-shadow: 0 0 30px rgba(52, 152, 219, 0.8), inset 0 0 15px rgba(52, 152, 219, 0.5);
  background: rgba(10, 10, 15, 0.98); border-width: 3px;
}
#yanusik-box.visible.counting.danger {
  box-shadow: 0 0 40px rgba(231, 76, 60, 0.9), inset 0 0 20px rgba(231, 76, 60, 0.5); border-color: #e74c3c;
}
#yanusik-box.danger {
  border-color: #e74c3c; box-shadow: 0 0 20px rgba(231, 76, 60, 0.6); color: #e74c3c;
  animation: yanusikPulse 0.3s infinite alternate;
}
@keyframes yanusikPulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.8; transform: scale(1.08); }
}
#opp-panel {
  position: absolute; top: -150px; left: 50%; transform: translateX(-50%);
  width: 85%; max-width: 380px; background: linear-gradient(180deg, rgba(15,15,20,0.98), rgba(0,0,0,0.95));
  border: 2px solid #3498db; border-radius: 12px; padding: 12px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 20px rgba(52, 152, 219, 0.4), inset 0 0 15px rgba(52, 152, 219, 0.2);
  z-index: 20; transition: top 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s, box-shadow 0.3s;
  display: flex; flex-direction: column; gap: 8px;
}
#opp-panel.visible { top: 90px; }
#opp-title {
  color: #3498db; font-family: sans-serif; font-size: 11px; font-weight: 900;
  letter-spacing: 3px; text-transform: uppercase; text-align: center; margin-bottom: 4px;
  text-shadow: 0 0 10px rgba(52,152,219,0.5);
}
#opp-stats { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; margin-bottom: 6px; }
#opp-avg { color: #fff; font-family: 'Impact'; font-size: 32px; text-shadow: 0 4px 10px rgba(0,0,0,1); line-height: 1; }
#opp-limit-label { font-family: sans-serif; font-size: 12px; color: #7f8c8d; font-weight: bold; margin-bottom: 2px; }
#opp-bonus { color: #2ecc71; font-family: 'Impact'; font-size: 22px; text-shadow: 0 4px 10px rgba(0,0,0,1); text-align: right; }
#opp-progress-bg {
  width: 100%; height: 14px; background: #111; border-radius: 7px;
  border: 1px solid #333; overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
}
#opp-progress-fill {
  width: 0%; height: 100%; background: linear-gradient(90deg, #3498db, #2ecc71);
  transition: width 0.1s linear, background 0.3s;
}
#opp-panel.danger {
  border-color: #e74c3c; box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 40px rgba(231, 76, 60, 0.6), inset 0 0 20px rgba(231, 76, 60, 0.3);
  animation: oppDangerPulse 0.4s infinite alternate;
}
#opp-panel.danger #opp-title { color: #e74c3c; text-shadow: 0 0 10px rgba(231,76,60,0.5); }
#opp-panel.danger #opp-avg { color: #e74c3c; }
@keyframes oppDangerPulse {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.02); }
}
#speed-container { position: absolute; right: 15px; top: 40%; height: 30%; width: 60px; pointer-events: auto; z-index: 20; }
#speed-slider { position: absolute; right: 20px; top: 0; height: 100%; width: 32px; background: url('gfx/ui/pasek_pod_gaz.png') center/100% 100% no-repeat; }
#speed-track-fill { display: none; }
#speed-thumb { position: absolute; right: -16px; width: 64px; height: 64px; background: url('gfx/ui/gaz.png') center/100% 100% no-repeat; transition: bottom 0.1s; }
#speed-thumb.max { transform: scale(1.1); background: url('gfx/ui/gaz.png') center/100% 100% no-repeat; }
#speed-thumb.sweet-spot { transform: scale(1.1); background: url('gfx/ui/gaz.png') center/100% 100% no-repeat; }
#lang-selector { position: absolute; top: 15px; left: 15px; z-index: 500; display: flex; gap: 10px; }
.lang-btn { background: var(--panel-bg); border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 20px; transition: transform 0.1s; }
.lang-btn img { width: 32px; height: auto; display: block; }
.lang-btn:active { transform: scale(0.9); }
.lang-btn.active { box-shadow: 0 0 10px var(--accent); border-color: var(--accent); }
#scanlines {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: repeating-linear-gradient(to bottom, transparent, transparent 2px, rgba(0, 0, 0, 0.15) 2px, rgba(0, 0, 0, 0.15) 4px);
  pointer-events: none; z-index: 10;
}
#vignette {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle, transparent 30%, rgba(200,0,0,0.8) 100%);
  opacity: 0; pointer-events: none; z-index: 5;
}
#overlay h1 {
  color: #e74c3c; margin: 0 0 15px 0; font-size: 45px; text-align: center;
  text-transform: uppercase; text-shadow: 0 10px 30px rgba(231, 76, 60, 0.6); letter-spacing: 3px;
}
#end-desc {
  font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700; color: #cbd5e1; margin: 20px 0; line-height: 1.5;
}
.shake-hard { animation: shakeHard 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shakeHard {
  0%, 100% { transform: translate(0,0); }
  10%, 90% { transform: translate(-20px, 15px); }
  20%, 80% { transform: translate(20px, -15px); }
  30%, 50%, 70% { transform: translate(-35px, -25px); }
  40%, 60% { transform: translate(35px, 25px); }
}
#flash-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #fff; opacity: 0; pointer-events: none; z-index: 25; }
.trigger-flash { animation: cameraFlash 0.6s ease-out; }
@keyframes cameraFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
#popups-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.point-popup {
  position: absolute; color: #2ecc71; font-family: 'Impact'; font-size: 40px; text-align: center;
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.9), 3px 3px 0 #000;
  animation: floatUp 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.point-popup.camera { color: #f1c40f; text-shadow: 0 0 35px #f1c40f, 4px 4px 0 #000; font-size: 50px; }
.point-popup.fail { color: #e74c3c; text-shadow: 0 0 35px #e74c3c, 4px 4px 0 #000; font-size: 45px; }
@keyframes floatUp {
  0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -50px) scale(1.3); opacity: 1; }
  80% { transform: translate(-50%, -80px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -100px) scale(0.8); opacity: 0; }
}
#route-progress-container {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 36px; background: rgba(0,0,0,0.9);
  z-index: 100; border-top: 2px solid #333; display: flex; align-items: center; padding: 0 15px;
}
#route-progress-track { position: relative; flex-grow: 1; height: 8px; background: #111; border-radius: 4px; margin-right: 15px; }
#route-progress-fill { position: absolute; top: 0; left: 0; height: 100%; width: 0%; background: #3498db; transition: width 0.1s linear; border-radius: 4px; }
#route-markers { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.route-marker-img { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 24px; height: 24px; z-index: 101; }
#route-player-icon { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; z-index: 102; transition: left 0.1s linear; left: 0%; }
#route-distance-text { color: #fff; font-family: 'Impact'; font-size: 16px; white-space: nowrap; min-width: 65px; text-align: right; }
#map-wrap { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 200; overflow: hidden; background: var(--bg); font-family: 'Inter', sans-serif; color: #ffffff; }
#game-map {
  width: 100%; height: 100%; background-color: #020408;
  background-image: radial-gradient(circle at 50% 50%, #0a1428 0%, #020408 100%), linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px; cursor: grab;
}
#game-map:active { cursor: grabbing; }
#map-logo { position: absolute; pointer-events: none; z-index: 10; filter: drop-shadow(0px 4px 8px rgba(0,0,0,0.8)); transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.map-logo-center { top: 3vh; left: 50%; transform: translateX(-50%); width: min(40vw, 175px); }
.map-logo-corner { top: 15px; right: 15px; left: auto; transform: none; width: min(20vw, 87px); }
.country-outline { fill: #050a14; stroke: #1e293b; stroke-width: 1px; }
.road-segment { cursor: pointer; transition: opacity 0.4s ease; }
.map-active .road-segment:not(.active) { opacity: 0.35; }
.road-hitbox { fill: none; stroke: transparent; stroke-width: 20px; pointer-events: stroke; }
.road-visual { fill: none; stroke-width: 3.5px; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width 0.3s, filter 0.3s; }
.road-segment:hover .road-visual { filter: drop-shadow(0 0 12px currentColor); stroke-width: 4.5px; }
.road-segment.active .road-visual { stroke-width: 6px; filter: drop-shadow(0 0 20px currentColor); animation: mapPulse 2s infinite; }
.city-node { fill: var(--primary); stroke: #020408; stroke-width: 1.5px; filter: drop-shadow(0 0 5px var(--primary)); }
.city-label { fill: #94a3b8; font-size: 8px; font-weight: 700; pointer-events: none; text-transform: uppercase; text-shadow: 0px 2px 4px rgba(0,0,0,0.9); }
.ui-panel {
  position: absolute; bottom: 20px; left: 15px; right: 15px;
  background: var(--panel-bg);
  padding: 15px; border-radius: 20px; border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 15px rgba(231, 76, 60, 0.15);
  z-index: 201; pointer-events: all;
}
#road-id { font-size: 26px; font-weight: 900; margin: 0; transition: color 0.3s; letter-spacing: -1px; text-shadow: 0 0 20px rgba(0,0,0,0.5); color: #ffffff; }
#route-info { color: #94a3b8; font-size: 13px; margin-bottom: 15px; font-weight: 400; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item { background: rgba(255,255,255,0.03); padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); transition: background 0.3s; }
.stat-label { font-size: 9px; color: #94a3b8; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }
.stat-value { font-size: 16px; font-weight: 900; display: block; margin-top: 4px; color: #ffffff; }
.traffic-indicator { height: 6px; border-radius: 10px; margin: 15px 0; background: rgba(0,0,0,0.5); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.8); }
.traffic-fill { height: 100%; transition: width 1s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease; width: 0%; }
.btn-container { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; grid-column: span 2; }
.btn-drive { background-color: var(--danger); }
.btn-back { background: #333; }
#tutorial-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1000;
  display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(0,0,0,0.6); transition: opacity 0.5s;
}
#tutorial-hand { font-size: 80px; animation: slideHand 2s infinite ease-in-out; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.8)); }
#tutorial-hand::after { content: "👆"; }
#tutorial-text { font-family: 'Impact', sans-serif; font-size: 24px; color: #f1c40f; text-align: center; text-transform: uppercase; text-shadow: 0 4px 10px #000; margin-top: 20px; max-width: 80%; }
@keyframes slideHand {
  0% { transform: translateY(60px); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-60px); opacity: 0; }
}