:root {
  --bg: #0b0c0f; --card: #15171c; --card2: #1c1f26; --line: #262a33;
  --text: #f4f5f7; --muted: #8b919c; --dim: #4a4f5a;
  --lime: #d4ff3a; --lime-ink: #0b0c0f; --orange: #ffb23e; --red: #ff5b57;
  --r: 20px;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
#app { max-width: 520px; margin: 0 auto; padding: 8px 16px calc(32px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--lime); outline-offset: -1px; }
.num { font-family: Unbounded, Inter, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* шапка */
.hero { padding: 14px 4px 18px; }
.kicker { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { font: 800 64px/1 Unbounded, sans-serif; margin: 6px 0 10px; letter-spacing: -.04em; }
.hero h1 { font-size: 44px; }
.hero h1 span { color: var(--lime); font-size: 1.45em; }
.intro { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.intro b { color: var(--text); font-weight: 600; }
.goal { margin-top: 14px; }
.goal .ex-top b { font-size: 16px; }
.club { font-size: 11px; font-weight: 700; color: var(--lime-ink); background: var(--lime); padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.dayline { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.dayline b { color: var(--text); font-weight: 600; }
.track { height: 6px; background: var(--card2); border-radius: 6px; margin-top: 10px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: 6px; transition: width .6s; }

/* карточки */
.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 12px; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 17px; font-weight: 700; }
.chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.chip.done { background: var(--lime); color: var(--lime-ink); }
.ex { margin-bottom: 14px; }
.ex:last-of-type { margin-bottom: 4px; }
.ex-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.ex-top span { color: var(--muted); font-weight: 500; }
.ex-top b { font: 600 20px Unbounded, sans-serif; }
.ex-top b small { color: var(--muted); font-size: 13px; font-weight: 600; }
.bar { height: 10px; border-radius: 10px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lime); border-radius: 10px; transition: width .6s; }
.bar.part i { background: var(--orange); }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }
.hint code { color: var(--text); background: var(--card2); padding: 2px 7px; border-radius: 6px; font-family: Unbounded, sans-serif; font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--card); border-radius: 16px; padding: 12px 10px; min-width: 0; }
.tile b { display: block; font: 600 18px Unbounded, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { color: var(--muted); font-size: 11.5px; }
.tile.bad b { color: var(--red); }
.sheet .tile { background: var(--card2); }

/* календарь 90 дней */
.cal { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.cal i { aspect-ratio: 1; border-radius: 6px; background: var(--card2); font: normal 600 9px Inter; color: var(--dim); display: grid; place-items: center; }
.cal i.done { background: var(--lime); color: #3d4a00; }
.cal i.short { background: var(--orange); color: #4a3000; }
.cal i.miss { background: var(--red); color: #4a0a08; }
.cal i.waived { background: repeating-linear-gradient(45deg, var(--card2) 0 3px, #2e323c 3px 6px); }
.cal i.today { box-shadow: inset 0 0 0 2px var(--lime); color: var(--text); }
.cal i.none { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 12px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; background: var(--c); }

/* вступить */
.join { text-align: center; padding: 26px 20px; }
.join p { color: var(--muted); margin: 8px 0 0; }
.rules { text-align: left; margin: 18px 0; padding: 0; list-style: none; }
.rules li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; }
.rules li b { color: var(--lime); font-family: Unbounded; font-size: 13px; min-width: 18px; }
.btn { display: block; width: 100%; padding: 15px; border-radius: 16px; background: var(--lime); color: var(--lime-ink); font-weight: 700; font-size: 16px; }
.btn.ghost { background: var(--card2); color: var(--text); }
.btn.red { background: rgba(255,91,87,.14); color: var(--red); }
.btn.sm { display: inline-block; width: auto; padding: 10px 14px; font-size: 14px; border-radius: 12px; }

/* переключатель */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 14px; padding: 4px; margin: 18px 0 4px; }
.seg button { padding: 9px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card2); color: var(--text); }

/* рейтинг */
.h2 { font: 600 13px Inter; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin: 22px 4px 10px; display: flex; justify-content: space-between; }
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:active { background: var(--card2); }
.place { width: 22px; text-align: center; font: 600 14px Unbounded; color: var(--muted); flex: none; }
.place.p1 { color: #ffd54a; } .place.p2 { color: #d6dbe4; } .place.p3 { color: #e3a067; }
.ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; position: relative; color: #0b0c0f; }
.ava.ok::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); border: 2.5px solid var(--card); }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { color: var(--muted); font-size: 12.5px; }
.who .red { color: var(--red); }
.score { text-align: right; flex: none; }
.score b { display: block; font: 600 17px Unbounded; }
.score span { color: var(--muted); font-size: 11px; }
.me-row { background: rgba(212,255,58,.06); }
.empty { color: var(--muted); padding: 28px; text-align: center; }

/* шторка */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 10; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 24px 24px 0 0; z-index: 11; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .25s ease-out; max-width: 520px; margin: 0 auto; }
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 0; font-size: 22px; font-weight: 700; }
.sheet .sub { color: var(--muted); font-size: 13px; margin: 2px 0 16px; }
.sec { font: 600 12px Inter; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin: 20px 0 10px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); }
.kv .red { color: var(--red); }
.kv .x { color: var(--muted); font-size: 13px; padding: 0 0 0 10px; text-decoration: underline; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* админ */
.form { display: grid; gap: 8px; }
.form .line { display: flex; gap: 8px; align-items: center; }
.form .line > * { flex: 1; }
.form .line .w80 { flex: 0 0 84px; }
.form .line .btn.sm { flex: none; }
.admin-ex { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.admin-ex input:first-child { flex: 1; }
.admin-ex input.w80 { width: 76px; text-align: center; }
.admin-ex .del { color: var(--red); padding: 8px; font-size: 18px; }
.note { color: var(--muted); font-size: 13px; }
.ok-dot { color: var(--lime); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 600; padding: 10px 16px; border-radius: 12px; z-index: 20; animation: up .2s; max-width: 90vw; }
