:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --text: var(--tg-theme-text-color, #16161a);
  --muted: var(--tg-theme-hint-color, #8a8a93);
  --accent: var(--tg-theme-button-color, #3a7bd5);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #3a7bd5);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --ok: #2e9d5b;
  --bad: #d64545;
  --common: #8a8a93;
  --rare: #3a7bd5;
  --epic: #8455d4;
  --legendary: #e08a1e;
  --mythic: #d64545;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tg]) { --bg: #17181c; --bg2: #212329; --text: #ececf1; --muted: #8d8f99; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: 14px 14px 84px; max-width: 560px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 18px 0 8px; font-weight: 600; }
p { margin: 4px 0; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; padding: 40px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.card { background: var(--bg2); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.bar { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; text-align: center; }
.stats div { background: var(--bg); border-radius: 10px; padding: 6px 0; }
.stats b { display: block; font-size: 17px; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: none; }
.item .ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none; background: var(--bg); border: 2px solid var(--common); }
.item .grow { flex: 1; min-width: 0; }
.item .name { font-weight: 600; }
.r-common { border-color: var(--common) !important; } .t-common { color: var(--common); }
.r-rare { border-color: var(--rare) !important; } .t-rare { color: var(--rare); }
.r-epic { border-color: var(--epic) !important; } .t-epic { color: var(--epic); }
.r-legendary { border-color: var(--legendary) !important; } .t-legendary { color: var(--legendary); }
.r-mythic { border-color: var(--mythic) !important; } .t-mythic { color: var(--mythic); }
.empty .ic { border-style: dashed; opacity: .55; }
button { font: inherit; }
.btn { border: none; border-radius: 10px; padding: 7px 12px; background: var(--accent); color: var(--on-accent);
  cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--link); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.subtabs { display: flex; gap: 6px; margin-bottom: 10px; }
.subtabs button { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 10px;
  padding: 7px 0; cursor: pointer; }
.subtabs button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.odds { font-size: 30px; font-weight: 700; }
.tl { border-left: 2px solid var(--line); margin: 12px 0 0 7px; padding-left: 14px; }
.st { position: relative; padding-bottom: 12px; }
.st::before { content: ""; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line); }
.st.ok::before { border-color: var(--ok); background: var(--ok); }
.st.bad::before { border-color: var(--bad); background: var(--bad); }
.st.now::before { border-color: var(--accent); background: var(--accent); }
.st .line { font-size: 13px; color: var(--muted); }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px; padding: 10px 12px;
  margin-top: 6px; cursor: pointer; }
.opt.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.thread { font-size: 12px; color: var(--muted); }
.rounds { display: flex; gap: 4px; margin-top: 6px; }
.rounds b { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; }
.rounds .w { background: var(--ok); } .rounds .l { background: var(--bad); }
.trip { padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.trip:first-child { border-top: none; }
.win { color: var(--ok); font-weight: 600; } .loss { color: var(--bad); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trophy { background: var(--bg); border-radius: 12px; padding: 10px 6px; text-align: center; font-size: 12px; cursor: pointer; }
.trophy .big { font-size: 24px; display: block; }
.trophy.locked { opacity: .4; }
.lb { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.lb:first-child { border-top: none; }
.lb.me { font-weight: 700; }
.place { width: 24px; text-align: center; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg2);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
nav#tabs button { flex: 1; border: none; background: none; color: var(--muted); font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav#tabs button span { font-size: 19px; }
nav#tabs button.on { color: var(--accent); font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 14px; border-radius: 12px; font-size: 13px; max-width: 86%; text-align: center; z-index: 20; }
#sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 10; display: flex; align-items: flex-end; }
#sheet[hidden], #toast[hidden] { display: none; }
.sheet-body { background: var(--bg); width: 100%; max-height: 86vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 16px 16px 30px; position: relative; }
.sheet-body .close { position: absolute; right: 12px; top: 10px; border: none; background: none; font-size: 18px;
  color: var(--muted); cursor: pointer; }
.report { white-space: pre-wrap; font-size: 14px; }
.report blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); }
