/* Dark only, same look as oferta.lotka24.pl (Pages/marketing): Bebas headlines, Barlow text, blue
   brand line on dark cards, red main button. White and red are the Independence Day accents on top. */
:root {
  --bg: #0A0F16;
  --bg-hi: #14233A;
  --land: #123A66;
  --land-line: #76CDFF;
  --text: #F0F5FA;
  --dim: rgba(240, 245, 250, 0.72);
  --sheet: #111923;
  --sheet-line: rgba(118, 205, 255, 0.18);
  --row-hover: rgba(118, 205, 255, 0.08);
  --blue: #76CDFF;
  --red: #E24B4A;
  --red-deep: #A32D2D;
  --flag-white: #FFFFFF;
  --flag-red: #DC143C;
  --accent-text: #FF9C9B;
  --pin: #0A0F16;
  --pin-ring: #FFFFFF;
  --past: rgba(240, 245, 250, 0.35);
  --past-pin: #8A95A3;
  --sheet-max: 40dvh;
  --hero-h: 66px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: radial-gradient(120% 60vh at 50% 0, var(--bg-hi) 0, var(--bg) 100%) no-repeat, var(--bg);
  background-color: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 "Barlow", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- White and red ribbon along the top edge: unrolls once, transform only ---- */
.ribbon {
  position: fixed; z-index: 4; left: 0; right: 0; top: 0; height: 6px; pointer-events: none;
  background: linear-gradient(to bottom, var(--flag-white) 50%, var(--flag-red) 50%);
  transform-origin: left center;
  animation: ribbon-in 0.7s ease-out both;
}
@keyframes ribbon-in { from { transform: scaleX(0); } to { transform: none; } }

/* ---- Header ---- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
}
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.brand img { width: 34px; height: 34px; margin-right: 8px; object-fit: contain; }
.brand span { font: 400 24px/1 "Bebas Neue", sans-serif; letter-spacing: .03em; }
.brand b { font-weight: 400; color: var(--blue); }
.brand em { font: 500 13px/1 "Barlow", sans-serif; letter-spacing: 0; color: var(--accent-text); margin-left: 4px; }
.count-chip {
  font: 700 13px/1 "Barlow", sans-serif;
  background: var(--sheet); color: var(--blue); border: 1px solid var(--sheet-line);
  padding: 8px 11px; border-radius: 8px; white-space: nowrap;
}

/* ---- Headline ---- */
.hero { position: relative; z-index: 2; height: var(--hero-h); padding: 2px 16px 0; animation: sheet-in 0.5s ease both; }
.hero h1 { font: 400 clamp(26px, 8.6vw, 38px)/1 "Bebas Neue", sans-serif; white-space: nowrap; letter-spacing: .01em; margin: 0; color: var(--flag-white); }
.hero p { margin: 2px 0 0; color: var(--dim); font-size: 15px; line-height: 1.3; }
/* An open ZLOTka needs the room: the headline gives way to the map and the sheet. */
body.sheet-tall { --hero-h: 0px; }
body.sheet-tall .hero { display: none; }

/* ---- Map ---- */
.map-wrap {
  position: relative; z-index: 1;
  /* The sheet takes at most the bottom 40% (--sheet-max), the map the rest under the header. */
  height: calc(100dvh - var(--sheet-max) - var(--hero-h) - 64px - env(safe-area-inset-top));
  min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
  isolation: isolate;
}
.map-wrap::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%;
  width: min(100%, 720px); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(77, 168, 224, 0.26), transparent);
  pointer-events: none;
}
.map { width: 100%; height: 100%; max-width: 720px; overflow: visible; }
/* The land is the flag: fill="url(#flag)" in index.html, because a url() here would resolve against this file. */
.land { stroke: var(--flag-white); stroke-width: 3; stroke-linejoin: round; }

.pin { cursor: pointer; }
.pin .hit { fill: transparent; }
.pin .dot { fill: var(--pin); stroke: var(--pin-ring); stroke-width: 3; transition: transform 0.2s ease; transform-box: fill-box; transform-origin: center; }
.pin .halo { fill: none; stroke: var(--pin); stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; }
.pin.past .dot { fill: var(--past-pin); }
.pin.dim .dot { opacity: 0.45; }
.pin.selected .dot { transform: scale(1.35); }
.pin.selected .halo { opacity: 1; animation: halo 1.6s ease-out infinite; }
.pin:focus { outline: none; }
.pin:focus-visible .halo { opacity: 1; }
@keyframes halo { from { transform: scale(0.8); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

.pin-enter .dot { animation: pin-in 0.45s cubic-bezier(.2,.9,.3,1.3) var(--enter-delay, 0ms) both; }
@keyframes pin-in { from { transform: translateY(-14px) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* Lotki heading to the open ZLOTka: a dark dashed line, readable on both halves of the flag, plus a white dot. */
.route { stroke: var(--pin); opacity: 0.85; stroke-linecap: round; pointer-events: none; }
.lotka-dot { cursor: pointer; }
.lotka-dot .hit { fill: transparent; }
.lotka-dot .dot { fill: var(--flag-white); stroke: var(--pin); }
.lotka-dot:focus { outline: none; }
.lotka-dot:focus-visible .dot { stroke: var(--blue); }
.routes-enter { animation: routes-in 0.45s ease both; }
@keyframes routes-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Bottom sheet ---- */
.sheet {
  position: fixed; z-index: 3; left: 0; right: 0; bottom: 0;
  max-width: 720px; margin: 0 auto;
  background: var(--sheet);
  border: 1px solid var(--sheet-line); border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: var(--sheet-max); display: flex; flex-direction: column;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
  touch-action: pan-x;
}
/* The app's card line: a thin blue glow along the top edge. */
.sheet::before {
  content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, #00a3ff 50%, transparent);
  box-shadow: 0 0 8px rgba(0, 163, 255, 0.9), 0 0 22px rgba(0, 115, 183, 0.6);
}
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--dim); opacity: 0.5; margin: 0 auto 10px; flex: none; }
.sheet-body { overflow-y: auto; touch-action: pan-y; }
.sheet-title { font: 400 28px/1 "Bebas Neue", sans-serif; letter-spacing: .01em; margin: 0 0 6px; }
.sheet-sub { color: var(--dim); margin: 0 0 12px; font-size: 15px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--sheet-line); }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 8px 4px;
  background: none; border: 0; color: inherit; text-align: left; font: inherit; cursor: pointer;
  border-radius: 10px;
}
.row:active, .row:hover { background: var(--row-hover); }
.date-badge {
  flex: none; width: 46px; text-align: center; border-radius: 10px; padding: 4px 0 5px;
  background: var(--row-hover); border: 1px solid var(--sheet-line); color: var(--blue); line-height: 1.05;
}
.date-badge b { display: block; font: 400 22px/1 "Bebas Neue", sans-serif; }
.date-badge small { font: 700 11px/1 "Barlow", sans-serif; text-transform: uppercase; letter-spacing: 0.3px; color: var(--dim); }
.row.past .date-badge { color: var(--past); }
.row-text { min-width: 0; }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.close {
  flex: none; width: 44px; height: 44px; margin: -6px 0 0 0; border-radius: 50%;
  background: none; border: 0; color: var(--dim); font-size: 26px; line-height: 1; cursor: pointer;
}
.detail-line { display: flex; gap: 10px; align-items: baseline; color: var(--dim); margin: 0 0 6px; }
.detail-line span:first-child { width: 20px; text-align: center; flex: none; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; margin-top: 14px; border-radius: 8px;
  background: var(--red); color: #fff; text-decoration: none;
  font: 700 16px/1 "Barlow", sans-serif;
}
.cta:active { transform: scale(0.98); background: var(--red-deep); }
.past-note { color: var(--accent-text); font-size: 14px; margin: 8px 0 0; }

body.sheet-tall { --sheet-max: 50dvh; }
.row-count { color: var(--accent-text); font: 700 13px/1.3 "Barlow", sans-serif; }

.tiles { display: flex; margin: 10px 0 0; }
.tile { flex: 1 1 0; min-width: 0; background: var(--bg); border: 1px solid var(--sheet-line); border-radius: 12px; padding: 8px 12px; }
.tile + .tile { margin-left: 8px; }
.tile b { display: block; font: 400 32px/1 "Bebas Neue", sans-serif; color: var(--accent-text); }
.tile span { font-size: 13px; color: var(--dim); }

.section-title { font: 400 20px/1 "Bebas Neue", sans-serif; letter-spacing: .01em; margin: 14px 0 2px; }
.lotka-row { text-decoration: none; color: inherit; }
.time-badge { width: 52px; color: var(--accent-text); }
.time-badge b { font-size: 17px; padding-top: 2px; }
.row-riders { flex: none; margin-left: auto; color: var(--accent-text); font: 700 14px/1 "Barlow", sans-serif; white-space: nowrap; }
.more-note { color: var(--dim); font-size: 14px; margin: 6px 0 0; }
.row-flash { animation: row-flash 1.1s ease both; }
@keyframes row-flash { 0%, 45% { opacity: 0.45; } 100% { opacity: 1; } }

/* The main button stays above the keyboard-free scroll list on a small phone. */
.cta-sticky { position: sticky; bottom: 0; }

.empty { text-align: center; padding: 8px 0 4px; }
.empty .cta { margin-top: 12px; }

.sheet-enter { animation: sheet-in 0.35s ease both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (min-width: 900px) {
  .map-wrap { height: calc(100dvh - var(--hero-h) - 90px); padding-right: 400px; min-height: 0; }
  .sheet { left: auto; right: 24px; bottom: 24px; width: 360px; border-radius: 20px; border-bottom: 1px solid var(--sheet-line); max-height: calc(100dvh - 120px); }
  .grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ribbon, .hero, .pin.selected .halo, .pin-enter .dot, .sheet-enter, .routes-enter, .row-flash { animation: none; }
  .sheet { transition: none; }
}
