:root {
  --ink: #0b0b0c;
  --panel: rgba(18, 18, 20, .72);
  --line: rgba(255, 255, 255, .08);
  --fg: #f3eee6;
  --mute: #8d877f;
  --dim: #5a554f;
  --go: #2dffa0;
  --go-dim: rgba(45, 255, 160, .16);
  --amber: #ffc43d;
  --red: #ff4a3d;
  --blue: #5aa8ff;
  --f-ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, Consolas, monospace;
  --f-dot: 'Doto', 'Geist Mono', monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--fg); font-family: var(--f-ui); overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* za posledními dlaždicemi u horizontu je plátno průhledné → podbarvit barvou mlhy (jinak černý pruh) */
#map { position: fixed; inset: 0; background: #2b3060; }
/* opar na lince horizontu: mapa končí ostrou hranou, mlha v barvě horizontu ji rozmaže do oblohy. Polohu nastavuje app.js. */
#haze { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: linear-gradient(to bottom, rgba(43,48,96,0) var(--h0, 18%), #2b3060 var(--hA, 22%), #2b3060 var(--h1, 45%), rgba(43,48,96,.4) var(--h2, 55%), rgba(43,48,96,0) var(--h3, 70%)); }
#haze.on { opacity: 1; }
.maplibregl-ctrl-attrib { background: rgba(0,0,0,.35) !important; font-size: 9px; opacity: .55; }
.maplibregl-ctrl-attrib a { color: var(--mute) !important; }
.vignette { position: fixed; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8,10,18,.55) 0%, rgba(8,10,18,.18) 12%, rgba(8,10,18,0) 24%),
    radial-gradient(120% 70% at 50% 75%, transparent 55%, rgba(0,0,0,.55) 100%);
}
/* zrnitost jako v ostatních appkách rodiny */
.vignette::after { content: ''; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }


/* ===== HUD =====
   Pravidla proti překryvům: rozměry odvozené z proměnných (--sp = tachometr, --gut = okraj),
   každý textový blok má min-width:0 + ořez (ellipsis), nic nemá pevnou šířku větší než obrazovka. */
:root { --gut: 12px; --sp: clamp(108px, 31vw, 132px); --card-bg: linear-gradient(180deg, rgba(30,30,34,.80), rgba(14,14,16,.86)); }
.glass { background: var(--card-bg); border: 1px solid rgba(255,255,255,.07); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 50px rgba(0,0,0,.55); }

#turn { position: fixed; left: var(--gut); top: calc(var(--sat) + var(--gut)); width: min(calc(100vw - var(--sp) - var(--gut) * 2 - 6px), 330px); border-radius: 24px; padding: 12px 14px 12px 12px; overflow: hidden; }
.turn-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ticon { flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(45,255,160,.22), rgba(45,255,160,.04)); border: 1px solid rgba(45,255,160,.22); }
#turnIcon { width: 38px; height: 38px; fill: none; stroke: var(--go); stroke-width: 4.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(45,255,160,.55)); }
#turnIcon .ghost { stroke: rgba(255,255,255,.22); }
.turn-dist { min-width: 0; display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.turn-dist b { font: 300 clamp(30px, 9.5vw, 40px)/1 var(--f-ui); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.turn-dist small { font: 500 13px var(--f-ui); color: var(--mute); }
#turnStreet { margin-top: 10px; font: 500 15px/1.25 var(--f-ui); color: #e8e3db; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
#turnStreet:empty { display: none; }
#turnStreet .ref { display: inline-block; padding: 2px 7px; margin-right: 6px; border-radius: 6px; background: #f3eee6; color: #111; font: 700 13px/1.2 var(--f-ui); vertical-align: 1px; }
#turnStreet .ref.d { background: #1f5fd1; color: #fff; }
#lanes { display: flex; gap: 4px; margin-top: 10px; min-width: 0; }
#lanes:empty { display: none; }
#lanes .lane { flex: 1 1 0; min-width: 0; max-width: 34px; height: 36px; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); display: grid; place-items: center; }
#lanes .lane svg { width: 22px; height: 22px; fill: none; stroke: var(--dim); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
#lanes .lane.on { background: var(--go-dim); border-color: rgba(45,255,160,.45); }
#lanes .lane.on svg { stroke: var(--go); filter: drop-shadow(0 0 4px rgba(45,255,160,.7)); }
#thenNext { margin-top: 8px; font: 500 12px var(--f-ui); color: var(--mute); display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#thenNext svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--mute); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* tachometr: tmavý kotouč, vlevo zrnitý svítící oblouk podle rychlosti (vůči limitu jako ve Waze) */
#speedo { position: fixed; right: 4px; top: calc(var(--sat) + var(--gut) - 6px); width: var(--sp); height: var(--sp); --c: #2dffa0; }
#speedo svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.arc-track { fill: none; stroke: rgba(255,255,255,.05); stroke-width: 22; }
.arc-fill { fill: none; stroke: var(--c); stroke-width: 22; stroke-dasharray: 0 100; transition: stroke .5s, stroke-dasharray .25s linear; }
.arc-inner { fill: none; stroke: var(--c); stroke-width: 1.6; opacity: .45; stroke-dasharray: 0 100; transition: stroke .5s, stroke-dasharray .25s linear; }
#limitTick { stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .9; }
.ticks line { stroke: rgba(255,255,255,.16); stroke-width: 1.4; stroke-linecap: round; }
#speedo .num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
#speedo .num b { font: 300 calc(var(--sp) * .3)/1 var(--f-ui); letter-spacing: -.03em; color: #f3eee6; transition: color .4s; font-variant-numeric: tabular-nums; }
#speedo .num small { font: 500 9px var(--f-ui); color: var(--mute); letter-spacing: .12em; margin-top: 3px; text-transform: uppercase; }
#speedo .num #simTag { color: var(--amber); margin: 0 0 3px; font-family: var(--f-mono); letter-spacing: .08em; }
#limit { position: absolute; right: 2px; bottom: 0; width: calc(var(--sp) * .3); height: calc(var(--sp) * .3); border-radius: 50%; background: #fff; border: calc(var(--sp) * .034) solid #e0201b; display: grid; place-items: center; color: #111; font: 800 calc(var(--sp) * .115) var(--f-ui); letter-spacing: -.04em; box-shadow: 0 3px 14px rgba(0,0,0,.5); transition: transform .3s; }
#limit.guess { border-color: #c9504c; opacity: .82; }
#speedo.over { --c: #ff6a1a; }
#speedo.over .num b { color: #ff8a3d; }
#speedo.way { --c: #ff3b30; }
#speedo.way .num b { color: #ff4a3d; }
#speedo.way #limit { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }

#alertToast { position: fixed; left: 50%; top: calc(var(--sat) + var(--sp) + 22px); transform: translateX(-50%); max-width: calc(100vw - var(--gut) * 2); border-radius: 20px; padding: 8px 16px 8px 8px; display: flex; align-items: center; gap: 12px; animation: drop .35s cubic-bezier(.2,1.4,.4,1); }
#alertIcon { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 800 18px var(--f-ui); color: #111; background: var(--amber); }
#alertToast > div:last-child { min-width: 0; }
#alertToast b { display: block; font: 600 15px var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#alertToast small { font: 500 13px var(--f-ui); color: var(--mute); font-variant-numeric: tabular-nums; }
@keyframes drop { from { transform: translate(-50%, -20px) scale(.9); opacity: 0; } }

/* spodní lišta: maskot | příjezd (pružný, ořezává se) | 2 tlačítka */
#bottom { position: fixed; left: var(--gut); right: var(--gut); bottom: calc(var(--sab) + var(--gut)); height: 76px; border-radius: 26px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 0 10px 0 8px; }
#qara { width: 64px; height: 31px; }
.eta { min-width: 0; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.07); }
.eta-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.eta-main b { font: 300 28px/1 var(--f-ui); letter-spacing: -.02em; color: #f3eee6; font-variant-numeric: tabular-nums; }
.eta-main span { font: 500 10px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--go); overflow: hidden; text-overflow: ellipsis; }
.eta-sub { margin-top: 5px; font: 500 12.5px var(--f-ui); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.eta-sub i { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--dim); margin: 0 7px; vertical-align: 3px; }
.btns { display: flex; gap: 8px; align-items: center; }
.round { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.05); display: grid; place-items: center; transition: background .2s, transform .15s; }
.round:active { transform: scale(.94); }
.round svg { width: 21px; height: 21px; fill: none; stroke: var(--fg); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.round.on { background: var(--go-dim); border-color: rgba(45,255,160,.35); }
.round.on svg { stroke: var(--go); }
.round.stop { background: rgba(255,74,61,.14); border-color: rgba(255,74,61,.2); }
.round.stop svg { stroke: #ff6b5f; stroke-width: 2.2; }
.pill { height: 36px; padding: 0 16px; border-radius: 18px; background: rgba(255,255,255,.08); font: 500 13px var(--f-ui); white-space: nowrap; }
#btnRecenter { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + var(--gut) + 88px); background: var(--card-bg); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#status { position: fixed; right: calc(var(--gut) + 6px); bottom: calc(var(--sab) + var(--gut) + 86px); font: 500 10px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); display: flex; gap: 6px; align-items: center; }
#wazeDot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); display: none; }
#wazeDot.ok { display: block; background: var(--go); box-shadow: 0 0 6px var(--go); }
/* atribuce mapy (povinná) – malá, nad lištou vlevo, nekoliduje s tlačítky */
.maplibregl-ctrl-bottom-right { right: auto !important; left: calc(var(--gut) + 2px); bottom: calc(var(--sab) + var(--gut) + 80px) !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 20px; padding: 0 !important; margin: 0 !important; }
.maplibregl-ctrl-attrib-button { transform: scale(.75); opacity: .4; }
#hud[hidden] ~ * .maplibregl-ctrl-bottom-right { bottom: 8px !important; }

/* značky hlášení na mapě: jen kousek před autem, jinak schované */
.mk { display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 4px; border-radius: 14px; background: rgba(14,14,16,.85); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 8px 24px rgba(0,0,0,.5); color: #f3eee6; font: 600 12px var(--f-ui); white-space: nowrap;
  opacity: 0; transform: translateY(8px) scale(.85); transition: opacity .35s, transform .35s cubic-bezier(.2,1.3,.4,1); pointer-events: none; }
.mk.show { opacity: 1; transform: none; }
.mk i { width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; color: #111; font: 800 12px var(--f-ui); font-style: normal; }

/* ===== Plánování ===== */
#plan { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(var(--sat) + 20px) 14px calc(var(--sab) + 14px);
  background: linear-gradient(to top, rgba(11,11,12,.96) 30%, rgba(11,11,12,.4) 70%, rgba(11,11,12,.15)); transition: opacity .5s, transform .5s; }
#plan.out { opacity: 0; transform: translateY(30px); pointer-events: none; }
.brand { text-align: center; margin-bottom: auto; padding-top: 6vh; }
#qaraBig { width: 184px; height: 88px; }
.brand h1 { font-family: var(--f-dot); font-weight: 900; font-size: 64px; margin: 4px 0 0; letter-spacing: .02em; line-height: 1; }
.brand p { margin: 2px 0 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--mute); }
.card { border-radius: 26px; padding: 14px; max-width: 520px; width: 100%; margin: 0 auto; }
.field { display: block; position: relative; margin-bottom: 10px; }
.field > span { position: absolute; left: 16px; top: 9px; font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); pointer-events: none; }
.field input { width: 100%; height: 58px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--fg); font: 500 17px var(--f-ui); padding: 20px 16px 6px; outline: none; }
.field input:focus { border-color: rgba(45,255,160,.5); background: rgba(45,255,160,.05); }
.sugg { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 5; border-radius: 16px; overflow: hidden; background: #151517; border: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
.sugg:empty { display: none; }
.sugg button { display: block; width: 100%; text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.sugg button:last-child { border-bottom: 0; }
.sugg b { display: block; font-weight: 600; font-size: 15px; }
.sugg small { color: var(--mute); font-size: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; scrollbar-width: none; }
.chips button { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; background: rgba(255,255,255,.06); font-size: 13px; color: var(--fg); }
.chips button.sel { background: var(--go-dim); color: var(--go); }
.row { display: flex; gap: 10px; align-items: center; }
.toggle { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; height: 52px; border-radius: 16px; background: rgba(255,255,255,.05); display: flex; align-items: center; gap: 10px; padding: 0 14px; font-size: 14px; color: var(--mute); }
.toggle i { width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.14); position: relative; transition: background .2s; flex: none; }
.toggle i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); transition: transform .25s cubic-bezier(.3,1.5,.5,1); }
.toggle[aria-pressed=true] { color: var(--amber); }
.toggle[aria-pressed=true] i { background: rgba(255,196,61,.5); }
.toggle[aria-pressed=true] i::after { transform: translateX(14px); background: var(--amber); }
.go { flex: 1.3 1 0; min-width: 0; height: 52px; border-radius: 16px; background: var(--go); color: #04140c; font-weight: 700; font-size: 17px; box-shadow: 0 0 30px rgba(45,255,160,.35); transition: opacity .2s, transform .15s; }
.go:active { transform: scale(.97); }
.go:disabled { opacity: .3; box-shadow: none; }
#planInfo { font-family: var(--f-mono); font-size: 12px; color: var(--mute); margin-top: 10px; min-height: 16px; text-align: center; }

#toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 100px); transform: translateX(-50%); background: #1b1b1e; border: 1px solid var(--line); padding: 10px 16px; border-radius: 14px; font-size: 14px; max-width: 90vw; z-index: 20; }


@media (min-width: 800px) {
  #turn { width: 320px; }
}

/* ===== O appce / Poděkování ===== */
.row { margin-bottom: 10px; }
.go { display: block; width: 100%; }
.about-link { display: block; margin: 12px auto 0; font: 500 12px var(--f-ui); color: var(--mute); letter-spacing: .04em; padding: 6px 10px; }
#about { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; padding: 0 var(--gut) calc(var(--sab) + var(--gut)); background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn .25s; }
#about .sheet { position: relative; width: 100%; max-width: 520px; max-height: 80vh; overflow: auto; border-radius: 28px; padding: 22px 20px 16px; animation: up .4s cubic-bezier(.2,1.2,.4,1); }
#about h2 { font: 900 36px/1 var(--f-dot); margin: 0 0 8px; }
#about .lead { margin: 0 0 18px; color: #cfc9c0; font: 400 14px/1.45 var(--f-ui); max-width: 34ch; }
#about h3 { font: 500 10px var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); margin: 0 0 6px; }
#about ul { list-style: none; margin: 0; padding: 0; }
#about li { padding: 11px 0; border-top: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#about a { color: var(--fg); text-decoration: none; font: 600 15px var(--f-ui); }
#about li small { color: var(--mute); font: 400 12px var(--f-ui); }
#aboutClose { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
/* atribuce na mapě jen jako malé „i“ (rozbalí se ťuknutím) – licence OSM ji chce u mapy */
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner { display: none; }
.maplibregl-ctrl-attrib.user-open .maplibregl-ctrl-attrib-inner { display: block; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(14,14,16,.6) !important; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 !important; }
/* úzké telefony (≤ 360 px): maskot z lišty pryč, ať se vejde čas příjezdu i km */
@media (max-width: 360px) {
  #qara { display: none; }
  #bottom { grid-template-columns: minmax(0, 1fr) auto; padding-left: 16px; }
  .eta { border-left: 0; padding-left: 0; }
}

/* ===== Úvodní animace (jako Mraq): Qára se rozhlédne, mrkne, pak „proletí“ do mapy ===== */
#intro { position: fixed; inset: 0; z-index: 50; background: #0b0b0c; display: grid; place-content: center; justify-items: center; gap: 18px; transition: opacity .7s ease .1s; }
#intro.out { opacity: 0; pointer-events: none; }
#introEyes { width: min(62vw, 260px); aspect-ratio: 230 / 110; transition: transform .9s cubic-bezier(.6,0,.3,1), filter .9s; }
#intro.out #introEyes { transform: scale(5.5); filter: blur(10px); }
.intro-word { font: 900 44px/1 var(--f-dot); letter-spacing: .04em; opacity: 0; transform: translateY(8px); animation: introWord .6s ease .9s forwards; }
#intro.out .intro-word { opacity: 0 !important; transition: opacity .2s; }
@keyframes introWord { to { opacity: 1; transform: none; } }

/* úsekové měření: tachometr ukazuje průměr */
#speedo .num #secTag { color: var(--amber); margin: 0 0 3px; font-family: var(--f-mono); letter-spacing: .08em; }
#speedo.section #limit { border-color: #ffc43d; }

/* oblíbená místa */
.chips button { display: inline-flex; align-items: center; gap: 6px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips button svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chips button.unset { color: var(--mute); background: transparent; border: 1px dashed rgba(255,255,255,.14); }
.chips button.fav { color: #f3eee6; }
