/* Dark only, like oferta.lotka24.pl (Pages/marketing): same tokens, fonts, cards, road and glow. */
:root {
  --bg: #0A0F16;
  --bg-hi: #14233A;
  --text: #F0F5FA;
  --dim: rgba(240, 245, 250, 0.72);
  --sheet: #111923;
  --line: rgba(118, 205, 255, 0.18);
  --land: #123A66;
  --land-line: #76CDFF;
  --blue: #76CDFF;
  --red: #E24B4A;
  --gold: #FAC775;
  --brand: #4DA8E0;
  --brand-d: #3A8FC4;
  --done: #76CDFF;
  --off: rgba(240, 245, 250, 0.42);
  --bar: rgba(118, 205, 255, 0.22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: radial-gradient(120% 60vh at 50% 0, var(--bg-hi) 0, var(--bg) 100%) no-repeat, var(--bg);
  color: var(--text);
  font: 400 16px/1.45 "Barlow", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1 { font: 400 clamp(26px, 8vw, 60px)/1 "Bebas Neue", "Barlow", sans-serif; letter-spacing: .01em; margin: 0; }
p { margin: 0; }

/* ---- Top bar ---- */
.top {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 16px 6px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 400 22px "Bebas Neue", sans-serif; letter-spacing: .03em; }
.brand img { width: 34px; height: auto; }
.brand b { font-weight: 400; color: var(--blue); }
.top-cta {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px;
  background: var(--red); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none;
}
.top-cta:active, .play:active, .speed:active, .share:active, .cta:active { transform: scale(.98); }

/* ---- Layout: on a phone everything fits one view, the map takes what is left ---- */
.layout {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
}
.copy, .player { flex: none; }
.lead { margin-top: 4px; font-size: 15px; color: var(--dim); }

/* ---- Counters, which are also the map legend ---- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6px; margin-top: 8px; }
.stat { background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 7px; min-width: 0; }
.stat b { display: block; font: 400 26px/1 "Bebas Neue", sans-serif; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.done b { color: var(--done); }
.stat.rally b { color: var(--gold); }
.stat.off b { color: var(--off); }

/* ---- Stage: date, map, road and glow ---- */
.stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; isolation: isolate; margin: 0 -16px; padding: 0 16px; overflow: hidden; }
.glow {
  position: absolute; z-index: -2; left: 50%; top: 50%; width: 130%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(77, 168, 224, .38), transparent);
  opacity: .45; transition: opacity .6s ease; pointer-events: none;
}
.is-playing .glow { opacity: 1; }
.road { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.road path { fill: none; }
.road-bed { stroke: rgba(118, 205, 255, .08); stroke-width: 54; }
.road-mid { stroke: var(--blue); stroke-width: 3; stroke-dasharray: 22 20; opacity: .3; }
.date { flex: none; margin-top: 8px; font: 400 34px/1 "Bebas Neue", sans-serif; letter-spacing: .01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.map-box { position: relative; flex: 1 1 auto; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.error { position: absolute; left: 0; right: 0; top: 40%; text-align: center; }
.error button { display: block; margin: 12px auto 0; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--sheet); color: var(--text); font: 700 15px "Barlow", sans-serif; cursor: pointer; }

/* ---- Player card ---- */
.player { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; }
.timeline { position: relative; padding-bottom: 18px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 6px; }
.timeline:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#hist { display: block; width: 100%; height: 44px; }
.months { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--dim); }
.months span { position: absolute; top: 0; }

.controls { display: flex; align-items: stretch; margin-top: 6px; }
.controls > * + * { margin-left: 8px; }
.play {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 16px; border: 0; border-radius: 8px;
  background: linear-gradient(180deg, var(--brand), var(--brand-d)); color: #fff;
  font: 700 16px "Barlow", sans-serif; cursor: pointer;
}
.play:disabled { opacity: .5; cursor: default; }
.play svg { width: 22px; height: 22px; margin-right: 6px; fill: currentColor; }
.speed {
  flex: none; min-width: 56px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  font: 700 15px "Barlow", sans-serif; cursor: pointer;
}

/* ---- End of the season ---- */
.summary { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); animation: rise .4s ease-out; }
.summary[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.fact-row { display: flex; align-items: center; justify-content: space-between; }
.fact { font-size: 14px; font-weight: 600; line-height: 1.25; margin-right: 10px; }
.share {
  flex: none; min-height: 44px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  font: 700 14px "Barlow", sans-serif; cursor: pointer;
}
.cta {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; margin-top: 10px; border-radius: 8px;
  background: var(--red); color: #fff; font-weight: 700; text-decoration: none;
}
.note { margin-top: 8px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--dim); }

/* ---- Small phones (iPhone SE): the map keeps its room ---- */
@media (max-height: 640px) {
  .lead, .note, .cta { display: none; }
  .stat { padding: 4px 8px 5px; }
  .stat b { font-size: 22px; }
  .date { font-size: 28px; margin-top: 6px; }
  #hist { height: 32px; }
  .play { min-height: 44px; }
}

/* ---- Wide screens: copy and player on the left, the map on the right, like the offer page ---- */
@media (min-width: 900px) {
  .layout {
    display: grid; grid-template-columns: 420px minmax(0, 1fr); grid-template-rows: auto 1fr;
    grid-template-areas: "copy stage" "player stage"; column-gap: 32px;
  }
  .copy { grid-area: copy; padding-top: 20px; }
  .lead { font-size: 20px; margin-top: 10px; }
  .stats { margin-top: 18px; }
  .stage { grid-area: stage; margin: 0; }
  .player { grid-area: player; align-self: start; margin-top: 16px; }
  .date { font-size: 48px; margin-top: 20px; }
  #hist { height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .summary { animation: none; }
  .glow { transition: none; }
}
