:root {
  --bg: var(--tg-theme-bg-color, #0d1320);
  --bg2: #131c2e;
  --card: var(--tg-theme-secondary-bg-color, #18233a);
  --line: rgba(255,255,255,.07);
  --text: var(--tg-theme-text-color, #f3f6fa);
  --hint: var(--tg-theme-hint-color, #8094ad);
  --accent: var(--tg-theme-button-color, #4f8cff);
  --gold: #ffc24b;
  --green: #46d493;
  --cool: #5cc0ff;
  --red: #ff6b6b;
  --purple: #a78bfa;
  --gap: #ffb020;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: radial-gradient(1200px 400px at 50% -120px, rgba(91,33,182,.25), transparent), var(--bg);
  color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; padding-bottom: 52px;
}

/* Hero + mode switch */
.hero { padding: 20px 18px 16px; }
.hero h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.hero .sub { color: var(--hint); font-size: 12px; margin-top: 3px; }
.modeswitch { display: flex; gap: 6px; margin-top: 14px; background: var(--card); padding: 4px; border-radius: 14px; border: 1px solid var(--line); }
.mode { flex: 1; border: none; border-radius: 10px; padding: 9px; background: transparent; color: var(--hint); font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s; }
.mode.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,140,255,.35); }
.stats { display: flex; gap: 10px; margin-top: 14px; }
.stat { flex: 1; background: linear-gradient(160deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: 16px; padding: 11px 8px; text-align: center; }
.stat .n { font-size: 19px; font-weight: 800; line-height: 1.1; }
.stat .n.gold { background: linear-gradient(120deg, var(--gold), #ff9a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { font-size: 10px; color: var(--hint); margin-top: 4px; }

/* Subnav (tabs / filters) */
.subnav { display: flex; gap: 6px; padding: 10px 12px 4px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg), rgba(13,19,32,.85)); backdrop-filter: blur(8px); overflow-x: auto; }
.chip { flex: 0 0 auto; border: 1px solid transparent; border-radius: 14px; padding: 8px 13px; background: var(--card);
  color: var(--hint); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: .15s; }
.chip.active { background: var(--accent); color: #fff; }

main { padding: 8px 14px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px; margin-top: 12px; }
h2.sec { font-size: 12px; color: var(--hint); text-transform: uppercase; letter-spacing: .06em; margin: 18px 4px 2px; font-weight: 700; }
.muted { color: var(--hint); font-size: 12px; }
.empty { color: var(--hint); text-align: center; padding: 44px 0; }
footer { color: var(--hint); font-size: 11px; text-align: center; margin-top: 26px; padding: 0 14px; }

/* Calendar — toggle row */
.calhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calhead .nav { margin-left: auto; display: flex; gap: 6px; }
.calhead .nav button, .calmode button { border: none; background: var(--bg2); color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.calmode { display: flex; gap: 4px; }
.calmode button.active { background: var(--accent); color: #fff; }
.calhead .label { font-weight: 700; font-size: 14px; }

/* Heatmap (All) */
.cal { display: inline-block; min-width: 100%; }
.cal-top { display: flex; padding-left: 26px; margin-bottom: 4px; }
.mlabel { width: 17px; flex: 0 0 17px; font-size: 10px; color: var(--hint); white-space: nowrap; overflow: visible; }
.cal-main { display: flex; }
.weekdays { display: flex; flex-direction: column; gap: 3px; width: 26px; flex: 0 0 26px; }
.weekdays span { height: 14px; line-height: 14px; font-size: 9px; color: var(--hint); }
.heat { display: flex; gap: 3px; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.cell { width: 14px; height: 14px; border-radius: 3px; background: rgba(255,255,255,.04); }
.cell.l1 { background: rgba(70,212,147,.30); } .cell.l2 { background: rgba(70,212,147,.52); }
.cell.l3 { background: rgba(70,212,147,.76); } .cell.l4 { background: var(--green); box-shadow: 0 0 6px rgba(70,212,147,.5); }
.cell.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.legend { display: flex; align-items: center; gap: 5px; color: var(--hint); font-size: 11px; margin-top: 10px; justify-content: flex-end; }
.legend .cell { width: 11px; height: 11px; }

/* Month grid */
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.mgrid .wd { text-align: center; font-size: 10px; color: var(--hint); padding-bottom: 2px; }
.mcell { aspect-ratio: 1; border-radius: 9px; background: rgba(255,255,255,.03); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; }
.mcell.has { cursor: pointer; }
.mcell .dn { color: var(--hint); font-size: 11px; }
.mcell.l1 { background: rgba(70,212,147,.18); } .mcell.l2 { background: rgba(70,212,147,.34); }
.mcell.l3 { background: rgba(70,212,147,.55); } .mcell.l4 { background: rgba(70,212,147,.78); }
.mcell .rc { font-size: 10px; font-weight: 700; color: #fff; }
.mcell.sel { outline: 2px solid var(--gold); }
.mcell.empty { background: transparent; }

/* Week list */
.wday { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.wday:first-child { border-top: none; }
.wday .dn { min-width: 54px; font-weight: 700; font-size: 13px; }
.wday .dn small { display: block; color: var(--hint); font-weight: 500; }
.wday .rc { flex: 1; color: var(--hint); font-size: 13px; }
.wday .cv { color: var(--gold); font-weight: 800; }

/* Run rows (expandable) */
.run { padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.run:first-child { border-top: none; }
.run-top { display: flex; align-items: center; gap: 11px; }
.run .w { font-weight: 800; min-width: 60px; }
.run .w small { display: block; color: var(--cool); font-weight: 700; font-size: 11px; }
.run .mid { flex: 1; font-size: 13px; color: var(--hint); }
.run .coins { color: var(--gold); font-weight: 800; text-align: right; white-space: nowrap; }
.run .coins small { display: block; color: var(--hint); font-weight: 600; font-size: 11px; }
.run-detail { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.run.open .run-detail { max-height: 1600px; }
.rd-inner { padding-top: 12px; }
.rd-inner h4 { font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 5px; }
.brk { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12.5px; }
.brk .l { min-width: 96px; }
.brk .tr { flex: 1; height: 7px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.brk .fl { height: 100%; border-radius: 4px; }
.brk.coin .fl { background: linear-gradient(90deg, var(--gold), #ff8a3d); }
.brk.kill .fl { background: linear-gradient(90deg, var(--purple), var(--cool)); }
.brk .v { color: var(--hint); font-size: 11px; min-width: 64px; text-align: right; }
.hl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hl span { background: rgba(255,255,255,.06); border-radius: 8px; padding: 4px 9px; font-size: 12px; }
.hl b { color: var(--gold); }

/* Earnings */
.bigstat { text-align: center; padding: 8px 0 4px; }
.bigstat .n { font-size: 34px; font-weight: 800; background: linear-gradient(120deg, var(--gold), #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bigstat .l { color: var(--hint); font-size: 12px; margin-top: 2px; }
.wk { padding: 11px 0; border-top: 1px solid var(--line); }
.wk:first-child { border-top: none; }
.wk-head { display: flex; align-items: baseline; gap: 8px; }
.wk-head .k { font-weight: 700; font-size: 13px; }
.wk-head .rg { color: var(--hint); font-size: 11px; }
.wk-head .v { margin-left: auto; color: var(--gold); font-weight: 800; }
.wk-bar { height: 6px; border-radius: 3px; margin-top: 7px; background: linear-gradient(90deg, var(--gold), #ff8a3d); }
.wk .meta { color: var(--hint); font-size: 11px; margin-top: 5px; }

/* Stats KPIs */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 12px; }
.kpi { background: linear-gradient(160deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: 16px; padding: 15px; }
.kpi .ic { font-size: 17px; } .kpi .n { font-size: 22px; font-weight: 800; margin-top: 6px; }
.kpi .l { color: var(--hint); font-size: 11px; margin-top: 2px; } .kpi .d { color: var(--hint); font-size: 10px; margin-top: 3px; opacity: .8; }
.bar { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 13px; }
.bar .lbl { min-width: 78px; text-transform: capitalize; }
.bar .track { flex: 1; height: 8px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); border-radius: 4px; }
.bar .cnt { color: var(--hint); font-size: 12px; min-width: 26px; text-align: right; }

/* Content topic cards */
.tcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px 13px 18px; margin-top: 11px; cursor: pointer; overflow: hidden; }
.tcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cool); }
.tcard.gap::before { background: var(--gap); }
.tcard-top { display: flex; align-items: center; gap: 11px; }
.tcard .rk { font-weight: 800; min-width: 26px; color: var(--hint); }
.tcard .tp { flex: 1; font-weight: 700; font-size: 16px; text-transform: capitalize; }
.opp { border-radius: 10px; padding: 4px 9px; font-size: 12px; font-weight: 800; }
.opp .lab { font-size: 9px; opacity: .65; display: block; text-align: center; }
.opp.hot { background: linear-gradient(135deg, var(--red), #ff9a3d); color: #2a0a0a; }
.opp.warm { background: linear-gradient(135deg, #ff9a3d, var(--gap)); color: #1a1205; }
.opp.cool { background: var(--cool); color: #04243f; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px; background: rgba(255,255,255,.06); color: var(--hint); }
.badge.gap { background: rgba(255,176,32,.14); color: var(--gap); }
.badge.comp { background: rgba(92,192,255,.12); color: var(--cool); }
.badge.auto { background: rgba(70,212,147,.16); color: var(--green); }
.tdetail { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.tcard.open .tdetail { max-height: 1400px; margin-top: 10px; }
.tdetail h4 { font-size: 11px; color: var(--hint); text-transform: uppercase; margin: 10px 0 4px; }
.q { padding: 7px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.q .s { color: var(--gap); font-weight: 800; font-size: 12px; min-width: 32px; }
.q a, .q span.t { color: var(--text); text-decoration: none; font-size: 13px; }
.vid { padding: 6px 0; border-top: 1px solid var(--line); }
.vid a { color: var(--cool); text-decoration: none; font-weight: 600; font-size: 13px; }
.vid .ch { color: var(--hint); font-size: 11px; }
