:root {
  --bg: var(--tg-theme-bg-color, #0f1115);
  --card: var(--tg-theme-secondary-bg-color, #181b22);
  --text: var(--tg-theme-text-color, #f3f4f6);
  --hint: var(--tg-theme-hint-color, #8b93a1);
  --accent: var(--tg-theme-button-color, #7c5cff);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  --line: rgba(255,255,255,.07);
  --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, "SF Pro Text", Roboto, system-ui, sans-serif; }
body { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); min-height: 100vh; }
.tab { display: none; padding-top: 18px; }
.tab.active { display: block; animation: tabin .35s ease both; }
h1 { font-size: 24px; margin: 4px 0 2px; letter-spacing: -.3px; }
h2 { font-size: 13px; margin: 24px 4px 10px; color: var(--hint); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.sub { color: var(--hint); margin: 0 0 16px; font-size: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); opacity: 0; transform: translateY(12px); animation: up .5s cubic-bezier(.2,.8,.2,1) forwards; }
.card:nth-child(2) { animation-delay: .06s } .card:nth-child(3) { animation-delay: .12s } .card:nth-child(4) { animation-delay: .18s }
.card:nth-child(5) { animation-delay: .24s } .card:nth-child(6) { animation-delay: .3s } .card:nth-child(n+7) { animation-delay: .36s }
.hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, rgba(124,92,255,.22), rgba(52,211,153,.10)), var(--card); }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring .bg { stroke: var(--line); } .ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 20px; }
.big { font-size: 34px; font-weight: 750; letter-spacing: -1px; line-height: 1; }
.goal { color: var(--hint); font-size: 14px; margin-top: 4px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { background: rgba(255,255,255,.07); border-radius: 99px; padding: 4px 10px; font-size: 13px; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat { background: rgba(255,255,255,.04); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--hint); }
.up { color: var(--ok); } .down { color: var(--bad); }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; } .row .t { font-weight: 600; } .row .s { color: var(--hint); font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); } .bar i.ok { background: var(--ok); }
.btn { border: 0; background: var(--accent); color: var(--accent-text); border-radius: 12px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; transition: transform .12s, filter .2s; }
.btn:active { transform: scale(.94); filter: brightness(1.15); }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--text); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { min-height: 78px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 16px; padding: 18px 12px; font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; transition: transform .12s, background .2s; opacity: 0; animation: up .45s cubic-bezier(.2,.8,.2,1) forwards; }
.tile:active { transform: scale(.95); background: rgba(124,92,255,.25); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; box-shadow: 0 0 0 4px rgba(248,113,113,.15); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.15); animation: pulse 2s infinite; }
.muted { color: var(--hint); } .grey { filter: grayscale(.8); opacity: .65; }
.star { color: var(--warn); }
.note { white-space: pre-wrap; font-size: 14px; max-height: 190px; overflow: hidden; position: relative; }
.note.open { max-height: none; }
.empty { color: var(--hint); text-align: center; padding: 14px 0; }
.skeleton { height: 120px; border-radius: var(--r); margin-bottom: 12px; background: linear-gradient(90deg, var(--card) 25%, rgba(255,255,255,.07) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; border: 0; background: none; color: var(--hint); font: inherit; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; cursor: pointer; transition: color .2s, transform .15s; }
.tabbar button .ic { font-size: 22px; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.tabbar button.on { color: var(--text); } .tabbar button.on .ic { transform: translateY(-3px) scale(1.15); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #000c; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .3s; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes up { to { opacity: 1; transform: none; } }
@keyframes tabin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; } }
@media (max-width: 360px) { .grid { grid-template-columns: 1fr 1fr; } .big { font-size: 28px; } }
