/* Beyond the Run — сайт-приложение. Одна колонка шириной с телефон и нижние вкладки;
   на компьютере колонка стоит по центру. Палитра клуба: оранжевый, кремовый, олива. */
:root {
  --orange: #FD6F2F;
  --cream: #FFEAD1;
  --olive: #515739;
  --bg: #FFEAD1;
  --ground: #F3DDC2;
  --surface: #FFF6EA;
  --surface-2: #F7E1C6;
  --ink: #2C2F1E;
  --muted: #6B6F52;
  --line: rgba(81, 87, 57, .18);
  --hero: #515739;
  --hero-ink: #FFEAD1;
  --hero-muted: rgba(255, 234, 209, .72);
  --good: #3F7A3A;
  --good-bg: #E1EBD3;
  --warn: #9A5B00;
  --warn-bg: #FBE3B8;
  --bad: #B3261E;
  --bad-bg: #F8D7D2;
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 18px;
  --emblem-mark: #515739;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #23261A; --ground: #1B1D14; --surface: #2E3223; --surface-2: #383D2B;
    --ink: #FFEAD1; --muted: #B9B394; --line: rgba(255, 234, 209, .14);
    --hero: #3A3F28; --hero-muted: rgba(255, 234, 209, .66);
    --good: #A6CF94; --good-bg: #2F4128; --warn: #F2C27A; --warn-bg: #4A3A1C;
    --bad: #F2A39B; --bad-bg: #4D2622;
    --emblem-mark: #FFEAD1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }

.app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
body.no-tabs .app { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 14px 10px; background: var(--bg);
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--orange); display: grid; place-items: center; }
.wordmark .mark svg { width: 13px; height: 22px; fill: var(--olive); }
.emblem { width: min(260px, 72%); height: auto; display: block; margin: 8px auto 0; }
.emblem .ring { fill: var(--orange); }
.emblem .m { fill: var(--emblem-mark); }
.wordmark b { font-family: var(--font-display); font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; line-height: 1.05; }
.offline { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); background: var(--warn-bg); padding: 4px 8px; border-radius: 99px; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.screen { display: grid; gap: 14px; }
.screen-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.01em; padding-top: 4px; }
.label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--surface); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; background: var(--surface); border-radius: var(--r); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 800;
  background: var(--orange); color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.olive { background: var(--olive); color: var(--cream); }
.btn.soft { background: var(--surface-2); color: var(--ink); }
.btn.block { width: 100%; padding: 15px; font-size: 16px; }
.btn.small { padding: 9px 12px; font-size: 13px; border-radius: 12px; }
.linkish { background: none; border: 0; color: var(--orange); font-weight: 800; padding: 0; text-decoration: none; }

.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 700; color: var(--muted); }
.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 14px; font: inherit; font-size: 16px;
}
.input.code { font-family: var(--font-display); font-size: 26px; letter-spacing: .3em; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--orange); flex: none; margin-top: 1px; }
.error { color: var(--bad); font-size: 13px; font-weight: 700; min-height: 1em; }
.error:empty { display: none; }

/* подсказка про установку */
.install { display: flex; gap: 12px; align-items: center; background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; }
.install .grow { font-size: 13px; }
.install b { display: block; font-size: 14px; }
.x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 6px; }

/* карточка ранга */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 24px; padding: 20px 18px 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -84px; top: -84px; width: 200px; height: 200px; border-radius: 50%; border: 28px solid var(--orange); }
.hero > * { position: relative; z-index: 1; }
.hello { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--cream); color: var(--olive); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 15px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hello .name { font-weight: 800; }
.hello .sub { font-size: 12px; color: var(--hero-muted); }
.rank { margin-top: 22px; }
.rank .label { color: var(--hero-muted); }
.rank h2 { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.04; letter-spacing: -.02em; margin-top: 6px; max-width: 12ch; }
.rank p { margin: 8px 0 0; color: var(--hero-muted); font-size: 14px; max-width: 32ch; }
.visits { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.visits b { font-family: var(--font-display); font-size: 44px; font-weight: 800; color: var(--orange); line-height: 1; }
.visits span { color: var(--hero-muted); font-size: 13px; }
.track { position: relative; height: 86px; margin-top: 4px; }
.track .rail { position: absolute; left: 0; right: 0; top: 54px; height: 6px; border-radius: 6px; background: rgba(255, 234, 209, .18); }
.track .fill { position: absolute; left: 0; top: 54px; height: 6px; border-radius: 6px; background: var(--orange); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.track .dot { position: absolute; top: 52px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--hero); border: 2px solid rgba(255, 234, 209, .45); }
.track .dot.on { background: var(--orange); border-color: var(--orange); }
.track .tick { position: absolute; top: 68px; font-size: 11px; color: var(--hero-muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.track .tick.first { transform: none; }
.track .tick.last { transform: translateX(-100%); }
.track .runner { position: absolute; top: 0; width: 49px; height: 58px; margin-left: -24px; transition: left .8s cubic-bezier(.2, .8, .2, 1); overflow: visible; }
.next { margin-top: 4px; font-size: 13px; }
.next b { color: var(--orange); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 14px; }
.stat b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.hot b { color: var(--orange); }

/* мероприятия */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: transparent; border-radius: 99px; padding: 7px 14px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--olive); border-color: var(--olive); color: var(--cream); }
.event { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; background: var(--surface); border-radius: var(--r); padding: 14px; }
.date { background: var(--surface-2); border-radius: 14px; text-align: center; padding: 8px 4px; align-self: start; }
.date b { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 800; line-height: 1.1; }
.date span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.event h3 { font-size: 16px; font-weight: 800; }
.event .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.event .desc { font-size: 13px; margin-top: 8px; white-space: pre-line; }
.event .desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.event .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.price b { font-size: 16px; }
.price s { color: var(--muted); font-size: 13px; margin-left: 6px; }
.price small { display: block; font-size: 12px; color: var(--good); font-weight: 700; }
.tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-bottom: 6px; }
.event.featured { background: var(--orange); color: #fff; }
.event.featured .date { background: rgba(255, 255, 255, .2); }
.event.featured .date span, .event.featured .meta { color: rgba(255, 255, 255, .88); }
.event.featured .price small, .event.featured .price s { color: #fff; }
.event.featured .tag { background: rgba(255, 255, 255, .22); color: #fff; }
.event.featured .btn:not(.done) { background: #fff; color: var(--orange); }
.event.featured .linkish { color: #fff; text-decoration: underline; }
.btn.done { background: var(--good-bg); color: var(--good); }

/* билеты */
.ticket { background: var(--surface); border-radius: 24px; overflow: hidden; }
.ticket .top { background: var(--olive); color: var(--cream); padding: 16px 18px; }
.ticket .top h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.ticket .top p { margin: 4px 0 0; font-size: 13px; color: rgba(255, 234, 209, .78); }
.perf { border-top: 2px dashed var(--line); margin: 0 18px; }
.ticket .qr { padding: 20px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.qrbox { background: #fff; padding: 10px; border-radius: 16px; width: 220px; height: 220px; display: grid; place-items: center; }
.qrbox img { width: 200px; height: 200px; image-rendering: pixelated; }
.qr .who { font-weight: 800; }
.qr .hint { font-size: 13px; color: var(--muted); max-width: 28ch; }
.mini-tickets { display: grid; gap: 8px; }
.mini { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px 14px; border: 0; text-align: left; width: 100%; }
.mini[aria-current="true"] { outline: 2px solid var(--orange); }
.mini small { display: block; color: var(--muted); font-size: 12px; }

.switch { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.switch button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--muted); }
.switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }

/* сканер */
.scanner { position: relative; aspect-ratio: 1 / 1; width: 100%; border-radius: 24px; background: #15170F; overflow: hidden; display: grid; place-items: center; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { width: 62%; aspect-ratio: 1; position: relative; z-index: 1; }
.scanner .frame i { position: absolute; width: 34px; height: 34px; border: 4px solid var(--orange); }
.scanner .frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.scanner .frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.scanner .frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.scanner .frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.scanner .cap { position: absolute; bottom: 14px; left: 12px; right: 12px; text-align: center; color: rgba(255, 234, 209, .9); font-size: 13px; z-index: 1; }
.scanner .start { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; }
.result { border-radius: 16px; padding: 14px 16px; font-weight: 700; display: grid; gap: 2px; }
.result small { font-weight: 600; opacity: .85; }
.result.ok { background: var(--good-bg); color: var(--good); }
.result.already { background: var(--warn-bg); color: var(--warn); }
.result.not_found, .result.error { background: var(--bad-bg); color: var(--bad); }
.log { display: grid; gap: 6px; }
.log div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 10px 12px; background: var(--surface); border-radius: 12px; }
.log b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log span { color: var(--muted); white-space: nowrap; }
.log .who { min-width: 0; display: grid; }
.log .who span { white-space: normal; font-size: 12px; }

/* клуб */
.lb { display: grid; gap: 2px; background: var(--surface); border-radius: var(--r); padding: 6px; }
.lb-row { display: grid; grid-template-columns: 26px 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; }
.lb-row.me { background: var(--orange); color: #fff; }
.lb-row.me .lb-av { background: #fff; color: var(--orange); }
.lb-row.me .lb-v { color: #fff; }
.lb-place { font-family: var(--font-display); font-weight: 800; font-size: 14px; text-align: center; }
.lb-av { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; overflow: hidden; position: relative; }
.lb-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-v { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-me { font-size: 13px; color: var(--muted); padding: 2px 4px; }
.badge-sec { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; padding: 4px 2px 0; }
.badge-sec b { color: var(--muted); font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.badge { background: var(--surface); border-radius: var(--r); padding: 12px 6px; text-align: center; display: grid; justify-items: center; align-content: start; gap: 4px; }
.badge svg { width: 64px; height: 64px; }
.badge.locked svg { filter: grayscale(1) opacity(.45); }
.badge b { font-size: 12px; line-height: 1.2; }
.badge small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.bar { width: 80%; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--orange); }

/* профиль */
.list { background: var(--surface); border-radius: var(--r); }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item small { display: block; color: var(--muted); font-size: 12px; }
.pill { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.pill.ok { color: var(--good); background: var(--good-bg); }
.pill.accent { background: var(--orange); color: #fff; }
.toggle { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--surface-2); position: relative; flex: none; cursor: pointer; transition: background .2s; border: 1px solid var(--line); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.toggle:checked { background: var(--orange); border-color: var(--orange); }
.toggle:checked::after { transform: translateX(18px); }
.run { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.run b { display: block; font-size: 14px; }
.run small { color: var(--muted); font-size: 12px; }
.run .km { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; }

/* вход */
.login { display: grid; gap: 28px; padding-top: 12px; }
.login .big { font-family: var(--font-display); font-weight: 800; font-size: 42px; line-height: .98; letter-spacing: -.03em; text-transform: uppercase; }
.login .big em { font-style: normal; color: var(--orange); display: block; }
.login p { color: var(--muted); max-width: 34ch; margin: 14px 0 0; }
.stack { display: grid; gap: 10px; }
.fine { font-size: 12px; color: var(--muted); text-align: center; }
.login p.fine { max-width: none; margin: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wait { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--orange); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* нижние вкладки */
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(460px, 100%); z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--orange); }
.tab .qr-dot { width: 48px; height: 48px; margin-top: -24px; border-radius: 16px; background: var(--orange); display: grid; place-items: center; color: #fff; border: 4px solid var(--surface); }

/* нижний лист (подтверждения) */
.sheet-back { position: fixed; inset: 0; background: rgba(20, 22, 14, .45); z-index: 20; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 21;
  width: min(460px, 100%); background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 22px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  display: grid; gap: 12px; max-height: 85vh; overflow-y: auto;
}
.sheet h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.sheet p { margin: 0; color: var(--muted); }

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