@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-condensed/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-condensed/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fonts/barlow/barlow-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+2192; }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fonts/barlow/barlow-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow/barlow-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+2192; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow/barlow-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }

:root {
  --asphalt: #16181b;
  --asphalt-2: #1f2226;
  --asphalt-3: #2a2e33;
  --line: #353a41;
  --text: #f2f0ea;
  --muted: #a3a7ae;
  --paint: #ffcf33;      /* teekattemärgistuse kollane */
  --paint-ink: #1a1500;
  --plate: #f6f6f1;
  --plate-ink: #101113;
  --eu: #0c3fa5;
  --danger: #ff8a7a;
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--asphalt);
  color: var(--text);
  font: 400 17px/1.45 var(--body);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 3px solid var(--paint); outline-offset: 3px; border-radius: 6px; }

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 40px) calc(env(safe-area-inset-left) + 18px);
}
.boot { font: 700 28px var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; padding-top: 38vh; }

/* ---------- numbrimärk ---------- */
.plate {
  display: inline-flex;
  align-items: stretch;
  background: var(--plate);
  color: var(--plate-ink);
  border-radius: .16em;
  box-shadow: inset 0 0 0 .05em var(--plate-ink), 0 .06em 0 rgba(0, 0, 0, .5);
  font-family: var(--display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: .04em;
  overflow: hidden;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.plate-eu {
  background: var(--eu);
  color: #fff;
  width: .62em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: .1em;
  padding-bottom: .12em;
  margin: .05em 0 .05em .05em;
  border-radius: .11em 0 0 .11em;
}
.plate-eu > span:last-child { font-size: .2em; font-weight: 700; letter-spacing: .02em; }
.plate-stars { width: .3em; height: .3em; border: .05em dotted #ffd84a; border-radius: 50%; }
.plate-num { padding: .13em .1em .13em .2em; }
.plate-let { padding: .13em .22em .13em .12em; }
.plate-num:last-child { padding-right: .24em; }

.plate-hero { font-size: clamp(54px, 19vw, 92px); }
.plate-mini { font-size: 26px; }

.plate-live { cursor: text; max-width: 100%; margin: 0; }
.plate-input {
  width: 2.05em;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  color: var(--plate-ink);
  padding: .13em .16em .13em .1em;
  margin: 0;
  text-transform: uppercase;
  border-radius: 0;
  caret-color: var(--eu);
}
.plate-input::placeholder { color: #c9c9c2; opacity: 1; }
.plate-input:focus { outline: none; background: #fff6cc; }
.plate-live:focus-within { box-shadow: inset 0 0 0 .05em var(--plate-ink), 0 0 0 4px var(--paint); }

@keyframes plate-in {
  from { transform: translateY(26px) rotate(-2deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.plate-new { animation: plate-in .32s cubic-bezier(.2, .9, .3, 1.2); }

/* ---------- päis ---------- */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { font: 700 20px var(--display); letter-spacing: .09em; text-transform: uppercase; color: var(--paint); }
.me-btn {
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-dots { color: var(--muted); letter-spacing: .05em; }

/* ---------- oma number ---------- */
.hero { text-align: center; padding: 26px 0 34px; display: flex; flex-direction: column; align-items: center; }
.eyebrow { font: 600 15px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.plate-help { color: var(--muted); font-size: 14px; margin: 12px 0 22px; }
.hero-done .lede { margin: 16px 0 6px; }

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 52px;
  padding: 12px 22px;
  font: 700 20px var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(2px) scale(.985); }
.btn:disabled { filter: saturate(.3) brightness(.8); cursor: default; }
.btn-go { background: var(--paint); color: var(--paint-ink); box-shadow: 0 4px 0 #b58e0c; width: 100%; }
.btn-go:active { box-shadow: 0 2px 0 #b58e0c; }
.btn-big { min-height: 76px; font-size: 32px; border-radius: 18px; }
.btn-quiet { background: var(--asphalt-3); color: var(--text); border: 1px solid var(--line); font-size: 17px; min-height: 46px; }

.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; min-height: 44px; padding: 8px 10px; margin-top: 8px; }
.link-danger { color: var(--danger); margin-top: 22px; display: block; padding-left: 0; }

/* ---------- edetabel ---------- */
h2 { font: 700 15px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 6px 0 10px; }
section + section { margin-top: 30px; }

.board { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--asphalt-2);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 12px 12px 10px;
}
.row-me { border-color: var(--paint); background: #25241c; }
.rank { font: 700 24px var(--display); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.row:first-child .rank { color: var(--paint); }
.who { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font: 600 12px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--paint); margin-left: 8px; }
.who-meta { font-size: 13px; color: var(--muted); }

/* tee: tume rada katkendjoonega, läbitud osa kollane */
.road { position: relative; height: 8px; border-radius: 4px; background: var(--asphalt-3); overflow: hidden; display: block; }
.road::after { content: ""; position: absolute; inset: 3px 0; background: repeating-linear-gradient(90deg, #4a5058 0 8px, transparent 8px 16px); }
.road-fill { position: absolute; inset: 0 auto 0 0; background: var(--paint); border-radius: 4px; z-index: 1; transition: width .5s ease; }

.seeking { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.seeking-label { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.finish { font: 700 18px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--paint-ink); background: var(--paint); border-radius: 8px; padding: 6px 10px; }

/* ---------- viimati nähtud ---------- */
.feed li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--asphalt-3); }
.feed li:last-child { border-bottom: 0; }
.feed .plate-mini { font-size: 22px; flex: none; }
.feed-who { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-when { color: var(--muted); font-size: 13px; flex: none; }
.empty { color: var(--muted); font-size: 15px; }

/* ---------- sisselogimine ---------- */
.auth { padding-top: 5vh; }
.auth-hero { text-align: center; margin-bottom: 26px; }
.auth-hero .plate-hero { font-size: clamp(48px, 17vw, 76px); transform: rotate(-3deg); margin-bottom: 20px; }
h1 { font: 700 46px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; color: var(--paint); }
.lede { color: var(--muted); margin-top: 10px; text-wrap: balance; }
.hint { background: var(--asphalt-2); border-left: 4px solid var(--paint); border-radius: 8px; padding: 12px 14px; font-size: 15px; margin: 0 0 20px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--asphalt-2); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { background: none; border: 0; border-radius: 9px; min-height: 44px; font-weight: 600; font-size: 15px; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--asphalt-3); color: var(--text); }

.auth-form { display: flex; flex-direction: column; }
label { font-weight: 600; font-size: 15px; margin: 14px 0 6px; display: block; }
label small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
input:not(.plate-input) {
  width: 100%;
  background: var(--asphalt-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 50px;
  padding: 10px 14px;
  font-size: 17px;
}
input:not(.plate-input):focus { outline: none; border-color: var(--paint); box-shadow: 0 0 0 3px rgba(255, 207, 51, .25); }
.input-pin, .input-num { font: 600 26px var(--display) !important; letter-spacing: .3em; max-width: 170px; }
.input-num { letter-spacing: .08em; max-width: 120px; }
.form-error { color: var(--danger); font-size: 15px; margin-top: 14px; }
.auth-form .btn { margin-top: 22px; }

/* ---------- menüü ---------- */
.sheet {
  border: 0;
  padding: 20px 20px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--asphalt-2);
  color: var(--text);
  width: min(100%, 520px);
  max-width: 100%;
  max-height: 88dvh;
  margin: auto auto 0;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 26px; color: var(--text); letter-spacing: .04em; margin: 0; }
.sheet-head .link { margin: 0; }
.sheet h3 { font: 700 14px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--paint); margin: 22px 0 8px; }
.sheet input:not(.plate-input) { background: var(--asphalt); }
.rules { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.rules li { padding-left: 16px; position: relative; }
.rules li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 3px; background: var(--paint); }
.sheet-text { font-size: 15px; margin-bottom: 10px; }
.code { font: 700 20px var(--display); letter-spacing: .12em; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-form label { width: 100%; margin: 0; font-weight: 400; color: var(--muted); }
.inline-form input { flex: 0 0 auto; }
.sheet .hint { margin: 22px 0 0; background: var(--asphalt); }

/* ---------- teade ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  background: var(--plate);
  color: var(--plate-ink);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  z-index: 2147483647;
}
.toast-action { background: none; border: 0; color: var(--eu); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px 2px; min-height: 32px; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- leiud: vajutatavad read, täpsustamine, pilt ---------- */
.board li { display: block; }
button.row { width: 100%; text-align: left; color: inherit; font: inherit; }
button.row:active, .find:active { filter: brightness(1.25); }
.feed li { display: block; padding: 0; }
.find { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 9px 0; background: none; border: 0; text-align: left; }
.has-photo, .add-more { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; border-radius: 6px; padding: 3px 7px; flex: none; }
.has-photo { background: var(--paint); color: var(--paint-ink); }
.add-more { color: var(--muted); border: 1px dashed var(--line); }
.plate-mid { font-size: clamp(44px, 15vw, 64px); }
.find-plate { text-align: center; margin: 18px 0 8px; }
.find-when { text-align: center; color: var(--muted); }
.find-photo { display: block; width: 100%; max-height: 60dvh; object-fit: contain; background: var(--asphalt); border-radius: 12px; margin-top: 6px; }
.input-letters { text-transform: uppercase; }
.link-inline { margin: 0; display: inline-block; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.sheet:focus-visible { outline: none; }

/* ---------- alguskuupäev ja eeldatav lõpuaeg ---------- */
.input-date { max-width: 220px; min-width: 170px; -webkit-appearance: none; appearance: none; color-scheme: dark; }
.forecast { margin-top: 18px; width: 100%; background: var(--asphalt-2); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; align-items: center; }
.forecast-label { font: 600 12px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.forecast-date { font: 700 28px/1.15 var(--display); letter-spacing: .03em; color: var(--paint); }
.forecast-pace { font-size: 13px; color: var(--muted); }
.forecast-none { font-size: 14px; color: var(--muted); }

/* ---------- avakuvale lisamise juhend ---------- */
.guide { background: var(--asphalt-2); border-left: 4px solid var(--paint); border-radius: 8px; padding: 12px 14px; font-size: 15px; margin: 0 0 20px; }
.sheet .guide { background: var(--asphalt); margin: 22px 0 0; }
.guide summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; list-style: none; padding-right: 26px; position: relative; min-height: 44px; justify-content: center; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "+"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); font: 700 24px var(--display); color: var(--paint); }
.guide[open] summary::after { content: "\2212"; }
.guide summary span { color: var(--muted); font-size: 13px; }
.guide-steps { list-style: decimal; padding-left: 22px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.guide-steps li::marker { color: var(--paint); font-weight: 600; }
.guide h4 { font: 700 13px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 14px 0 0; }
.guide .install-now { margin-top: 12px; }
