/* BORZ CHALLENGE — собственный стиль: ночной фон, тонкие рамки, один янтарный акцент («глаз волка»; борз — волк).
   Шрифты: Unbounded — знак, крупные числа и заголовки; Geist — весь остальной текст. Оба с кириллицей, лежат у нас. */
@font-face { font-family: Geist; font-weight: 100 900; font-display: swap; src: url(fonts/geist-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0400-04FF, U+2116; }
@font-face { font-family: Geist; font-weight: 100 900; font-display: swap; src: url(fonts/geist-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }
@font-face { font-family: Unbounded; font-weight: 200 900; font-display: swap; src: url(fonts/unbounded-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0400-04FF, U+2116; }
@font-face { font-family: Unbounded; font-weight: 200 900; font-display: swap; src: url(fonts/unbounded-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }

:root {
  --bg: #09090b;
  --surface: #131316;      /* карточки */
  --surface2: #1c1c21;     /* нажатие, вложенные плашки */
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .16);
  --text: #f4f4f5;
  --text2: #a1a1aa;
  --text3: #6f6f7a;
  --accent: #ffb224;       /* янтарь — только главное действие, «я» и первое место */
  --ink: #170f00;          /* текст на янтарном */
  --gold: #ffb224; --silver: #cfd3da; --bronze: #c98a5e;
  --up: #4ade80; --down: #f87171;
  --display: Unbounded, Geist, system-ui, sans-serif;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body {
  min-height: 100vh; color: var(--text); font-family: Geist, system-ui, -apple-system, sans-serif; font-size: 15px;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  background: radial-gradient(90% 340px at 50% -80px, rgba(255, 178, 36, .13), transparent 70%) no-repeat var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { width: 1em; height: 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; }
.view { padding: calc(var(--safe-t) + 18px) 16px calc(116px + var(--safe-b)); }

/* ── шапка ─────────────────────────────────────── */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 34px; height: 34px; flex: none; }
.brand-borz { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1; letter-spacing: .01em; }
.brand-sub { margin-top: 5px; font-size: 10px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--text3); }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font-size: 18px; color: var(--text2); }
.icon-btn:active { background: var(--surface2); }

/* ── общий километраж ───────────────────────────── */
.total { position: relative; padding: 18px 18px 16px; margin-bottom: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; min-height: 104px; }
.total::after { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 14px 14px; -webkit-mask-image: linear-gradient(115deg, transparent 55%, #000); mask-image: linear-gradient(115deg, transparent 55%, #000); }
.total-label { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text3); }
.total-num { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.total-num b { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 10.4vw, 44px); line-height: 1.05; letter-spacing: -.02em; }
.total-num span { font-size: 15px; color: var(--text2); }
.total-meta { margin-top: 8px; font-size: 13px; color: var(--text2); }

/* ── сезоны ─────────────────────────────────────── */
.chips { position: relative; display: flex; gap: 6px; margin: 0 -16px 14px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip-s { flex: none; display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text2); white-space: nowrap; transition: background .2s, color .2s; }
.chip-s.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); }
.dot.active { background: var(--up); box-shadow: 0 0 0 3px rgba(74, 222, 128, .2); }
.dot.upcoming { background: var(--accent); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; vertical-align: 1px; }
.pill.active { background: rgba(74, 222, 128, .14); color: var(--up); }
.pill.finished { background: rgba(255, 255, 255, .08); color: var(--text2); }
.pill.upcoming { background: rgba(255, 178, 36, .14); color: var(--accent); }
.season-title { margin-top: 8px; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.total-note { margin-top: 4px; font-size: 12px; color: var(--text3); }
.sec { margin: 22px 2px 10px; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text3); }
#board > .sec:first-child { margin-top: 6px; }
.hof-list { display: grid; gap: 8px; }
.hof { display: block; width: 100%; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: left; }
.hof:active { background: var(--surface2); }
.hof-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hof-h b { font-family: var(--display); font-weight: 700; font-size: 14px; }
.hof-meta { margin-top: 8px; font-size: 13px; color: var(--text2); }
.hof-top { display: grid; gap: 7px; margin-top: 12px; }
.hof-top span { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.hof-top em { font-style: normal; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hof-top small { font-size: 13px; color: var(--text2); }
.medal { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; font-family: var(--display); font-size: 10px; font-weight: 700; font-style: normal; background: rgba(255, 255, 255, .07); color: var(--text2); }
.medal.m1 { background: var(--gold); color: var(--ink); } .medal.m2 { background: var(--silver); color: #16181c; } .medal.m3 { background: var(--bronze); color: #1d1108; }
.my-seasons { display: grid; }
.my-season { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; }
.my-season + .my-season { border-top: 1px solid var(--line); }
.my-season:first-child { padding-top: 0; } .my-season:last-child { padding-bottom: 0; }
.my-season b { font-weight: 600; } .my-season div small { display: block; margin-top: 2px; font-size: 12px; color: var(--text3); }
.my-season > span { font-weight: 600; white-space: nowrap; } .my-season > span small { font-weight: 400; font-size: 12px; color: var(--text3); margin-left: 3px; }

/* ── вкладки периодов ───────────────────────────── */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px; }
.seg button { padding: 9px 4px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text2); transition: background .2s, color .2s; }
.seg button.on { background: var(--text); color: var(--bg); }
.seg.c3 { grid-template-columns: repeat(3, 1fr); }

/* ── подиум ─────────────────────────────────────── */
.podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: 8px; margin-bottom: 14px; }
.pod { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 30px 8px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: center; overflow: hidden; }
.pod:active { background: var(--surface2); }
.pod.p1 { padding-top: 46px; border-color: rgba(255, 178, 36, .45); background: linear-gradient(180deg, rgba(255, 178, 36, .14), transparent 62%) var(--surface); }
.pod-rank { position: absolute; left: 10px; top: 8px; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1; color: var(--ring); }
.pod .ava { width: 60px; height: 60px; font-size: 18px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ring); margin-bottom: 12px; }
.pod.p1 .ava { width: 72px; height: 72px; font-size: 22px; }
.pod-name { font-weight: 600; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.pod-km { margin-top: 6px; font-family: var(--display); font-weight: 600; font-size: 12px; white-space: nowrap; }
.pod-km small { font-family: Geist, sans-serif; font-weight: 400; font-size: 11px; color: var(--text3); margin-left: 3px; }
.p1 { --ring: var(--gold); } .p2 { --ring: var(--silver); } .p3 { --ring: var(--bronze); }

/* ── список ─────────────────────────────────────── */
.list { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.row { position: relative; display: grid; grid-template-columns: 26px 38px 1fr auto; align-items: center; gap: 12px; padding: 11px 16px 11px 10px; }
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--surface2); }
.row.me { background: rgba(255, 178, 36, .08); }
.row.me::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.row-place { font-family: var(--display); font-weight: 600; font-size: 11px; color: var(--text3); text-align: center; }
.row .ava { width: 38px; height: 38px; font-size: 13px; }
.row-name { min-width: 0; font-size: 15px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.row-km { text-align: right; font-weight: 600; font-size: 15px; white-space: nowrap; }
.row-km small { font-weight: 400; font-size: 12px; color: var(--text3); margin-left: 3px; }
.move { display: block; font-size: 11px; font-weight: 500; }
.move.up { color: var(--up); } .move.down { color: var(--down); }

/* ── аватар ─────────────────────────────────────── */
.ava { position: relative; border-radius: 50%; display: grid; place-items: center; font-weight: 600; letter-spacing: .02em; color: var(--text); background: var(--av, #26262b); overflow: hidden; flex: none; }
.ava img { width: 100%; height: 100%; object-fit: cover; }

/* ── поля ───────────────────────────────────────── */
.search { display: none; margin-bottom: 14px; }
.search.on { display: block; }
.search input, .field input, .field select, .inline-input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus, .field input:focus, .field select:focus, .inline-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 178, 36, .16); }
input[type="date"] { color-scheme: dark; }
input::placeholder { color: var(--text3); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.km-input { font-family: var(--display) !important; font-size: 32px !important; font-weight: 700 !important; text-align: center; padding: 18px 14px !important; }

/* ── нижнее меню: плавающая панель ──────────────── */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; width: min(300px, calc(100% - 48px)); padding: 6px;
  border-radius: 999px; background: rgba(24, 24, 28, .82); border: 1px solid var(--line2);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
}
.tab { display: flex; align-items: center; justify-content: center; gap: 7px; height: 46px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text3); transition: color .2s, background .2s; }
.tab svg { font-size: 19px; }
.tab.on { color: var(--text); background: rgba(255, 255, 255, .08); }
.tab-add { width: 46px; }
.tab-add .plus { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; color: var(--ink); background: var(--accent); transition: transform .15s var(--ease); }
.tab-add.on { background: none; }
.tab-add:active .plus { transform: scale(.92); }

/* ── экраны ─────────────────────────────────────── */
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; min-height: 40px; }
.bar h1 { flex: 1; font-family: var(--display); font-size: 17px; font-weight: 700; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 18px; }
.hero .ava { width: 92px; height: 92px; font-size: 28px; margin-bottom: 14px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--line2); }
.hero h2 { font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.hero p { display: inline-block; margin-top: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text2); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--text); position: relative; overflow: hidden; }
.chip:active { background: var(--surface2); }
.chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip.accent { background: var(--text); border-color: var(--text); color: var(--bg); }
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.stat { padding: 14px 14px 13px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.stat small { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); }
.stat small svg { color: var(--accent); font-size: 13px; }
.stat b { display: block; margin-top: 8px; font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.stat b span { font-family: Geist, sans-serif; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--text3); margin-left: 5px; }
.card { padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.card h3 small { font-weight: 400; font-size: 13px; color: var(--text3); }
.chart { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 5px; height: 84px; }
.chart i { display: block; border-radius: 4px; background: var(--accent); min-height: 3px; }
.chart i.zero { background: rgba(255, 255, 255, .09); }
.chart-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; margin-top: 7px; font-size: 9px; color: var(--text3); text-align: center; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { padding: 12px 6px 10px; border-radius: 14px; text-align: center; border: 1px dashed var(--line2); font-size: 11px; line-height: 1.25; color: var(--text3); }
.badge i { display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto 8px; border-radius: 50%; font-family: var(--display); font-size: 11px; font-weight: 700; font-style: normal; background: rgba(255, 255, 255, .05); color: var(--text3); }
.badge.got { color: var(--text); border: 1px solid rgba(255, 178, 36, .35); background: rgba(255, 178, 36, .07); }
.badge.got i { background: var(--accent); color: var(--ink); }
.runs { display: flex; flex-direction: column; }
.run { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; }
.run + .run { border-top: 1px solid var(--line); }
.run:first-child { padding-top: 0; } .run:last-child { padding-bottom: 0; }
.run-ph { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; background: var(--surface2); display: grid; place-items: center; color: var(--text3); font-size: 18px; }
.run-ph img { width: 100%; height: 100%; object-fit: cover; }
.run b { font-weight: 600; } .run small { display: block; margin-top: 2px; font-size: 12px; color: var(--text3); }
.run small.why { color: var(--down); }
.run-side { text-align: right; }
.st { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; }
.st.pending { background: rgba(255, 178, 36, .14); color: var(--accent); }
.st.approved { background: rgba(74, 222, 128, .13); color: var(--up); }
.st.rejected { background: rgba(248, 113, 113, .13); color: var(--down); }
.st.del { display: block; margin: 6px 0 0 auto; padding-right: 0; color: var(--text3); }
.photo-pick { position: relative; display: grid; place-items: center; gap: 4px; min-height: 150px; border-radius: 18px; border: 1.5px dashed var(--line2); background: var(--surface); color: var(--text2); text-align: center; overflow: hidden; cursor: pointer; padding: 14px; }
.photo-pick svg { font-size: 26px; color: var(--accent); }
.photo-pick small { color: var(--text3); max-width: 240px; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn { display: block; width: 100%; padding: 15px; border-radius: 14px; font-weight: 600; font-size: 16px; text-align: center; background: var(--accent); color: var(--ink); transition: transform .15s var(--ease), opacity .15s; }
.btn:active { transform: scale(.985); opacity: .9; }
.btn:disabled { opacity: .5; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn.gap { margin-top: 10px; }
.note { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--text2); line-height: 1.45; margin-bottom: 14px; }
.note.below { margin: 14px 0 0; }
.empty { text-align: center; padding: 44px 20px; color: var(--text2); }
.empty.small { padding: 12px; }
.empty svg { font-size: 30px; color: var(--text3); margin-bottom: 10px; }
.foot { margin-top: 26px; text-align: center; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--text3); }

.toast { position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, -160%); z-index: 40; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: transform .3s var(--ease); }
.toast.on { transform: translate(-50%, 0); }
.toast.bad { background: #fecaca; color: #450a0a; }
.fade { animation: fade .3s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.skeleton { height: 60px; border-radius: 18px; background: linear-gradient(100deg, var(--surface) 40%, var(--surface2) 50%, var(--surface) 60%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.tall { height: 180px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.defs { position: absolute; }
