:root {
  --bg: #0B0B0B; --card: #151515; --card-2: #1C1C1C; --line: #232323;
  --text: #F2F2F2; --soft: #CFCFCF; --muted: #9A9A9A; --dim: #7A7A7A;
  --red: #E5262A; --red-soft: rgba(229, 38, 42, 0.12);
  --pos: #22C55E; --neg: #EF4444; --warn: #F59E0B;
  --s3: #16A34A; --s2: #22C55E; --s1: #4ADE80; --s0: #8A8A8A; --sm1: #F97316; --sm2: #EF4444; --sm3: #DC2626;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
       padding: 12px 16px; background: rgba(11,11,11,0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.top .meta { font-size: 12px; color: var(--muted); }

#view { flex: 1; padding: 16px 16px calc(92px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
#view.with-mebar { padding-bottom: calc(160px + var(--safe-b)); }

/* text */
.title { font-size: 22px; font-weight: 700; margin: 0; }
.sub { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.section { font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 2px -4px; }
.p { font-size: 14px; line-height: 1.55; color: var(--soft); margin: 0; }

/* controls */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--card);
       border: 1px solid var(--line); border-radius: 12px; }
.seg button { height: 38px; border: none; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
              font-size: 14px; font-weight: 600; }
.seg button.on { background: var(--red); color: #fff; }
.chips { display: flex; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
        color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { border-color: var(--text); color: var(--text); }

/* info line */
.info { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--card);
        border: 1px solid var(--line); font-size: 13px; color: var(--soft); }
.info svg { color: var(--red); flex: 0 0 auto; }
.info b { color: var(--text); }

/* list */
.list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: none; border-bottom: 1px solid var(--line);
        background: transparent; width: 100%; text-align: left; cursor: pointer; color: var(--text); }
.item:last-child { border-bottom: none; }
.item:active { background: var(--card-2); }
.item.me { background: var(--red-soft); }
.rank { width: 26px; text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank.rank-top { color: var(--red); }
.ava { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; background: #262626; display: flex; align-items: center;
       justify-content: center; font-size: 13px; font-weight: 700; color: #D0D0D0; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.who .n { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .s { font-size: 12.5px; color: var(--muted); }
.pts { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 36px; }
.chev { color: #555; flex: 0 0 auto; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: #262626; color: var(--muted); margin-left: 4px; }
.score-pill { min-width: 44px; height: 30px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center;
              justify-content: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

/* me bar */
.mebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(66px + var(--safe-b)); width: calc(100% - 24px); max-width: 496px;
         padding: 12px 14px; border-radius: 12px; background: #1A1111; border: 1px solid #4A1B1C; display: flex; align-items: center; gap: 12px;
         z-index: 4; box-shadow: 0 -8px 24px rgba(0,0,0,0.5); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* cards & key-values */
.card { padding: 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; padding-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; text-align: right; }

/* days */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer;
       display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.day .w { font-size: 11px; }
.day .d { font-size: 16px; font-weight: 700; color: var(--text); }
.day.on { background: var(--red); border-color: var(--red); color: #fff; }
.day.on .d { color: #fff; }

/* analysis */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: 12px;
        background: var(--card); border: 1px solid var(--line); }
.hero .big { font-size: 44px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero .lab { font-size: 17px; font-weight: 700; }
.chart-img { width: 100%; border-radius: 12px; display: block; background: #121212; border: 1px solid var(--line); }
.placeholder { height: 140px; border-radius: 12px; background: var(--card); border: 1px dashed #333; display: flex; align-items: center;
               justify-content: center; color: var(--dim); font-size: 13px; }
.scale { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.scale > * { height: 40px; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
             font-weight: 700; font-size: 15px; background: transparent; font-variant-numeric: tabular-nums; }
.scale button { cursor: pointer; }

.bar { flex: 1; height: 6px; border-radius: 3px; background: #262626; overflow: hidden; }
.bar i { display: block; height: 6px; border-radius: 3px; }

.btn { height: 46px; border-radius: 12px; border: none; background: var(--red); color: #fff; cursor: pointer; font-size: 15px; font-weight: 700;
       display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.back { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text);
        display: flex; align-items: center; justify-content: center; cursor: pointer; }
.row { display: flex; align-items: center; gap: 12px; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.note { padding: 10px 12px; border-radius: 10px; background: #1F1708; border: 1px solid #5A3A0C; font-size: 13px; line-height: 1.5; color: #FCD34D; }
.demo { font-size: 11px; color: var(--warn); text-align: center; }

/* tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 6;
          display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px 8px calc(6px + var(--safe-b));
          background: rgba(11,11,11,0.97); border-top: 1px solid var(--line); }
.tabbar button { background: none; border: none; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center;
                 gap: 4px; color: var(--dim); font-size: 11px; font-weight: 600; cursor: pointer; }
.tabbar button.on { color: var(--red); }

.toast { position: fixed; left: 50%; bottom: calc(140px + var(--safe-b)); transform: translateX(-50%) translateY(16px); opacity: 0;
         background: #F2F2F2; color: #0B0B0B; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
         transition: 0.2s; pointer-events: none; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.skeleton { height: 64px; border-radius: 12px; background: linear-gradient(90deg, #151515, #1c1c1c, #151515); background-size: 200% 100%;
            animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------------- SoyuzCoin (SYZ) */
:root { --gold: #F2C14E; --gold-2: #C8902A; }
.syz { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.coin { width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.stat .v .coin { width: 17px; height: 17px; }
.coin.lg { width: 22px; height: 22px; }
.hero .big small { font-size: 14px; font-weight: 700; margin-left: 4px; color: var(--gold); letter-spacing: .04em; }

/* ---------------- Mavsum kartasi */
.season { position: relative; overflow: hidden; padding: 16px; border-radius: 16px; display: flex; flex-direction: column; gap: 14px;
          background: radial-gradient(120% 90% at 0% 0%, rgba(229,38,42,.28), transparent 60%),
                      radial-gradient(80% 80% at 100% 0%, rgba(242,193,78,.12), transparent 60%), #141010;
          border: 1px solid #3A1A1B; }
.season-top { display: flex; align-items: center; gap: 14px; }
.season-coin { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%;
               filter: drop-shadow(0 6px 14px rgba(242,193,78,.25)); animation: spin 6s ease-in-out infinite; }
@keyframes spin { 0%, 70%, 100% { transform: rotateY(0); } 85% { transform: rotateY(180deg); } }
@media (prefers-reduced-motion: reduce) { .season-coin { animation: none; } }
.season-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.season h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.season-sub { font-size: 13px; color: var(--soft); }
.season-sub b { color: var(--text); }
.season-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.season-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--red), var(--gold)); }
.prizes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prize { padding: 12px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08);
         display: flex; flex-direction: column; gap: 2px; }
.prize .pk { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.prize .pv { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.prize .ps { font-size: 12px; color: var(--muted); }
.prize.gold { border-color: rgba(242,193,78,.35); background: linear-gradient(160deg, rgba(242,193,78,.14), rgba(0,0,0,.35) 60%); }
.prize.gold .pv { background: linear-gradient(180deg, #FFE39A, var(--gold) 55%, var(--gold-2)); -webkit-background-clip: text;
                  background-clip: text; color: transparent; }
.prize.gold .pk svg { color: var(--gold); }
.prize:not(.gold) .pk svg { color: var(--red); }
