:root {
  --bg: #F5F4F0; --card: #FFFFFF; --ink: #0E1013; --muted: #7C7F86; --line: rgba(14,16,19,.06);
  --accent: #2BE36A; --accent-2: #0FBF6B; --accent-ink: #072B16;
  --g-accent: linear-gradient(135deg, #3DF585 0%, #12C46E 100%);
  --g-mint: linear-gradient(135deg, #E9FCEF, #CFF5DC); --g-lilac: linear-gradient(135deg, #EFEBFF, #DED6FF);
  --g-peach: linear-gradient(135deg, #FFF0E4, #FFDFC8); --g-sky: linear-gradient(135deg, #E7F3FF, #D2E7FF);
  --rose: #FFE0E0; --peach: #FFE6D5; --mint: #DDF6E4;
  --r: 24px; --shadow: 0 1px 2px rgba(14,16,19,.04), 0 14px 36px -14px rgba(14,16,19,.16);
  --ease: cubic-bezier(.2,.8,.2,1);
  --font-display: Unbounded, Manrope, system-ui, sans-serif;
}
[data-theme=dark] {
  --bg: #0B0C0F; --card: #15171B; --ink: #F4F5F7; --muted: #8B8F98; --line: rgba(255,255,255,.07);
  --g-mint: linear-gradient(135deg, #16352A, #0F2A20); --g-lilac: linear-gradient(135deg, #2A2547, #1F1B36);
  --g-peach: linear-gradient(135deg, #3E2A1E, #2E1F17); --g-sky: linear-gradient(135deg, #1B2C40, #14212F);
  --rose: #45201F; --peach: #3E2A1E; --mint: #1F3A2B;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 14px 36px -14px rgba(0,0,0,.6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0 auto; max-width: 560px; padding: 14px 14px 104px; min-height: 100vh;
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.35;
  color: var(--ink);
  background: radial-gradient(120% 50% at 50% -8%, rgba(43,227,106,.16), transparent 60%), var(--bg);
  background-attachment: fixed;
}
h2 { font: 700 19px/1.2 var(--font-display); letter-spacing: -.01em; margin: 26px 4px 12px; display: flex; align-items: baseline; gap: 10px; }
h2 .muted { font-family: Manrope; font-weight: 700; }
h3 { font-size: 17px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- top / hero ---- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 16px; }
.hello { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 30px; padding: 24px 22px 22px; margin-bottom: 6px;
  background: linear-gradient(160deg, #1A1F27 0%, #0B0D11 100%);
  box-shadow: 0 24px 48px -20px rgba(14,16,19,.5), inset 0 1px 0 rgba(255,255,255,.08);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; filter: blur(18px);
}
.hero::before {
  right: -80px; top: -90px; width: 280px; height: 280px; opacity: .6;
  background: radial-gradient(circle, var(--accent) 0, transparent 68%); animation: float 7s ease-in-out infinite alternate;
}
.hero::after {
  left: -90px; bottom: -120px; width: 260px; height: 260px; opacity: .35;
  background: radial-gradient(circle, #7C5CFF 0, transparent 68%); animation: float 9s ease-in-out infinite alternate-reverse;
}
.hero > * { position: relative; }
.hero .label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; font-weight: 700; }
.bal { display: flex; align-items: center; gap: 12px; font: 700 42px/1 var(--font-display); letter-spacing: -.02em; margin: 10px 0 18px; }
.bal .coin { width: 40px; height: 40px; filter: drop-shadow(0 6px 12px rgba(43,227,106,.45)); }
.hero .row { margin-top: 10px; font-size: 13px; opacity: .85; }
.hero .chip.ghost { background: rgba(255,255,255,.1); color: #fff; backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12); }

/* ---- primitives ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.tint-mint { background: var(--g-mint); } .tint-lilac { background: var(--g-lilac); }
.tint-peach { background: var(--g-peach); } .tint-sky { background: var(--g-sky); }
.card.tint-mint, .card.tint-lilac, .card.tint-peach, .card.tint-sky { border-color: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 6px 11px;
  border-radius: 999px; background: rgba(14,16,19,.05); white-space: nowrap;
}
[data-theme=dark] .chip { background: rgba(255,255,255,.08); }
.chip.accent { background: var(--g-accent); color: var(--accent-ink); }
.coin { width: 14px; height: 14px; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px;
  padding: 13px 18px; font: inherit; font-weight: 800; font-size: 15px; letter-spacing: -.01em;
  background: var(--ink); color: var(--bg); cursor: pointer; position: relative;
  box-shadow: 0 8px 20px -10px rgba(14,16,19,.5); transition: transform .15s var(--ease), opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.96); box-shadow: none; }
.btn:disabled { opacity: .4; pointer-events: none; box-shadow: none; }
.btn.accent { background: var(--g-accent); color: var(--accent-ink); box-shadow: 0 10px 24px -8px rgba(43,227,106,.55); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
[data-theme=dark] .btn.ghost { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); }
.btn.sm { padding: 9px 13px; font-size: 13px; }
.btn.block { flex: 1; width: 100%; }
input, select, textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 15px; margin: 6px 0; outline: none; transition: box-shadow .2s, border-color .2s; resize: vertical;
}
[data-theme=dark] input, [data-theme=dark] select, [data-theme=dark] textarea { background: #0B0C0F; }
input:focus, textarea:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.field { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; }
.bar { height: 10px; border-radius: 6px; background: rgba(14,16,19,.07); overflow: hidden; margin: 6px 0; }
.hero .bar { background: rgba(255,255,255,.12); height: 12px; }
[data-theme=dark] .bar { background: rgba(255,255,255,.08); }
.bar > i {
  display: block; height: 100%; border-radius: 6px; background: var(--g-accent); width: var(--w, 0%);
  box-shadow: 0 0 14px rgba(43,227,106,.55); animation: grow .9s var(--ease) both; transition: width .9s var(--ease);
}

/* ---- tasks ---- */
.task { transition: transform .2s var(--ease); }
.task:active { transform: scale(.985); }
.task.done { opacity: .55; }
.task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.task-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
[data-theme=dark] .task-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.task-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.task-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 3px; }
.task-actions { display: flex; gap: 8px; margin-top: 14px; }
.task-actions .btn { flex: 1; }

/* ---- tiles / lists / podium ---- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 12px; box-shadow: var(--shadow); }
.tile b { display: block; font: 700 24px/1.1 var(--font-display); letter-spacing: -.02em; margin-bottom: 4px; }
.tile span { font-size: 12px; color: var(--muted); }
.list > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > div:last-child { border: 0; padding-bottom: 0; }
.podium { display: flex; gap: 8px; align-items: flex-end; margin: 14px 0 6px; }
.podium > div { flex: 1; text-align: center; border-radius: 20px; padding: 14px 6px; background: var(--bg); border: 1px solid var(--line); }
.podium > div.first { background: var(--g-accent); color: var(--accent-ink); padding-top: 20px; border-color: transparent; box-shadow: 0 16px 32px -14px rgba(43,227,106,.7); }
.podium .m { width: 28px; height: 28px; margin: 0 auto 8px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.podium .first .m { background: #0E1013; color: #fff; }
.podium .first .muted { color: rgba(7,43,22,.7); }
.podium b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .chip { margin-top: 6px; background: rgba(14,16,19,.08); }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--g-accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 24px var(--font-display); overflow: hidden; flex: none; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--accent); }
.avatar.sm { width: 40px; height: 40px; font-size: 16px; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.status { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.status.pending { background: var(--peach); } .status.approved { background: var(--mint); } .status.rejected { background: var(--rose); }
[data-theme=dark] .status { color: var(--ink); }

/* ---- wheel ---- */
/* Doughnut wheel: SVG ring of equal arcs with gaps; only the <svg> rotates, hub and pointer stay put. */
.wheel-wrap { position: relative; width: min(310px, 80vw); aspect-ratio: 1; margin: 10px auto 0; }
.wheel-wrap::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle, rgba(43,227,106,.22), transparent 70%); filter: blur(14px);
}
.wheel {
  position: relative; width: 100%; height: 100%; overflow: visible; display: block;
  transform: rotate(var(--angle, 0deg)); transition: transform 4.5s cubic-bezier(.12,.8,.12,1);
  filter: drop-shadow(0 16px 28px rgba(14,16,19,.22));
}
.wheel .arc { fill: none; transition: stroke .28s var(--ease), filter .4s, opacity .4s; }
.wheel.has-win .arc:not(.win) { opacity: .35; }
.wheel .arc.win { filter: drop-shadow(0 0 10px currentColor) brightness(1.1); }
.wheel text { fill: #fff; font: 700 12.5px var(--font-display); text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.25); stroke-width: 2px; pointer-events: none; }
.pointer {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%); z-index: 2; width: 0; height: 0;
  border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 20px solid var(--ink);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.3));
}
.hub {
  position: absolute; left: 50%; top: 50%; width: 44%; height: 44%; transform: translate(-50%, -50%); z-index: 2;
  border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 10px 30px -10px rgba(14,16,19,.35), inset 0 0 0 1px var(--line);
}
.hub b { font: 700 34px/1 var(--font-display); letter-spacing: -.02em; }
.hub span { font-size: 12px; color: var(--muted); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; box-shadow: 0 0 8px currentColor; }

/* ---- details (admin sections) ---- */
details.card summary { list-style: none; cursor: pointer; font-weight: 800; font-size: 17px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "+"; font-size: 24px; font-weight: 500; color: var(--muted); transition: transform .3s var(--ease); }
details[open].card summary::after { transform: rotate(45deg); }
details.card > *:not(summary) { margin-top: 12px; animation: rise .35s var(--ease) both; }
.wd { padding: 10px 0; border-bottom: 1px solid var(--line); } .wd:last-child { border: 0; }

/* ---- nav (glass) ---- */
nav {
  position: fixed; left: 14px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); max-width: 532px; margin: 0 auto;
  display: flex; padding: 6px; border-radius: 999px; z-index: 5;
  background: color-mix(in srgb, var(--card) 78%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(14,16,19,.35);
}
nav .ind { position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / var(--n)); border-radius: 999px; background: var(--g-accent); box-shadow: 0 8px 20px -8px rgba(43,227,106,.7); transition: transform .4s var(--ease); }
nav button {
  position: relative; z-index: 1; flex: 1; background: none; border: 0; padding: 9px 2px; font: inherit; font-size: 11px; font-weight: 700;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; transition: color .3s;
}
nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--accent-ink); }

/* ---- motion ---- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes grow { from { width: 0; } }
@keyframes float { to { transform: translate(-24px, 24px) scale(1.15); } }
@keyframes pop { 40% { transform: scale(1.25); } }
.pop { animation: pop .5s var(--ease); }
@keyframes flyup {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  20% { opacity: 1; transform: translate(-50%, -12px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(1); }
}
.fly { position: fixed; z-index: 9; pointer-events: none; font: 700 18px var(--font-display); color: var(--accent-ink); background: var(--g-accent); padding: 8px 16px; border-radius: 999px; box-shadow: 0 10px 24px -8px rgba(43,227,106,.7); animation: flyup 1.1s var(--ease) forwards; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 9; background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: toastin .4s var(--ease); transition: opacity .3s;
}
.toast.out { opacity: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel { height: 90px; border-radius: var(--r); margin-bottom: 12px; background: linear-gradient(90deg, var(--card) 25%, var(--bg) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.empty { text-align: center; padding: 24px 12px; }

/* Keep the app shell hidden until Telegram authorization succeeds. */
body.booting { visibility: hidden; }
