:root {
  --bg: var(--tg-theme-bg-color, #0f1419);
  --bg2: var(--tg-theme-secondary-bg-color, #182029);
  --text: var(--tg-theme-text-color, #e9eef3);
  --hint: var(--tg-theme-hint-color, #8a96a3);
  --accent: var(--tg-theme-button-color, #2ea6ff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --room: #2ea6ff;
  --ok: #34c759;
  --bad: #ff453a;
  --warn: #ff9f0a;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 76px; }
.hidden { display: none !important; }
.muted { color: var(--hint); font-size: 13px; }
.center { text-align: center; }
a { color: var(--accent); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.btn { background: var(--bg2); padding: 12px 16px; border-radius: 12px; font-weight: 600; width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .45; }
.btn.small { width: auto; padding: 8px 12px; font-size: 13px; }
.btn.warn { background: var(--warn); color: #000; }
.btn.ghost { background: none; color: var(--hint); margin-top: 6px; }
.link { color: var(--accent); font-size: 14px; }
.link.danger { color: var(--hint); text-decoration: underline; font-size: 13px; }
.big-emoji { font-size: 44px; margin-bottom: 6px; }

/* Экран согласия и экран «откройте по ссылке» */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-card { background: var(--bg2); border-radius: 20px; padding: 24px; max-width: 420px; width: 100%; }
.gate-badge { display: inline-block; background: var(--bad); color: #fff; font-weight: 800; border-radius: 8px; padding: 2px 10px; }
.gate h1 { font-size: 21px; margin: 12px 0; }
.gate-list { padding-left: 18px; margin: 0 0 16px; }
.gate-list li { margin: 6px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 14px; font-size: 14px; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

/* Шапка: канал крупно */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg); border-bottom: 1px solid rgba(127,127,127,.15); }
.room-head { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.room-photo { width: 44px; height: 44px; border-radius: 50%; background: var(--room); color: #fff; font-weight: 800; font-size: 20px;
  display: grid; place-items: center; flex: none; overflow: hidden; }
.room-photo.small { width: 34px; height: 34px; font-size: 15px; }
.room-photo img { width: 100%; height: 100%; object-fit: cover; }
.room-name { min-width: 0; display: flex; flex-direction: column; }
.room-name b { font-size: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-name small { color: var(--hint); font-size: 12px; }
.balance { font-weight: 800; font-size: 18px; text-align: right; flex: none; }
.balance small { display: block; color: var(--hint); font-weight: 500; font-size: 11px; }
.banner { background: var(--warn); color: #000; text-align: center; font-size: 13px; padding: 4px; }
.bonus-bar { display: flex; gap: 8px; padding: 10px 14px 0; flex-wrap: wrap; }
.brand { text-align: center; color: var(--hint); font-size: 11px; opacity: .6; padding: 6px 0 18px; letter-spacing: .5px; }

.tab { padding: 12px 14px; }
.section-title { margin: 4px 0 10px; color: var(--hint); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.empty { text-align: center; color: var(--hint); padding: 40px 10px; }

/* Матчи */
.match { background: var(--bg2); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.match-top { display: flex; justify-content: space-between; gap: 8px; color: var(--hint); font-size: 12px; margin-bottom: 10px; }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.vs { align-self: center; color: var(--hint); font-size: 12px; }
.team { background: var(--bg); border-radius: 12px; padding: 12px 6px; text-align: center; border: 1.5px solid transparent;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.team b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.team small { color: var(--accent); font-weight: 700; }
.team:disabled { cursor: default; opacity: .75; }
.team.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); opacity: 1; }
.team.win { border-color: var(--ok); }
.match-status { margin-top: 10px; font-size: 13px; color: var(--hint); }
.live { color: var(--bad); font-weight: 700; }
.my-pick { margin-top: 4px; font-size: 13px; }

/* Купон */
.slip { position: fixed; left: 0; right: 0; bottom: 60px; z-index: 8; background: var(--bg2); border-radius: 18px 18px 0 0;
  padding: 14px; box-shadow: 0 -8px 24px rgba(0,0,0,.35); max-height: 80vh; overflow-y: auto; }
.slip-head, .slip-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.slip-pick { margin-bottom: 12px; }
#slip-stake { flex: 1; width: 100%; background: var(--bg); color: var(--text); border: 1px solid rgba(127,127,127,.3); border-radius: 10px; padding: 12px; font-size: 17px; }
.quick { display: flex; gap: 8px; margin-bottom: 8px; }
.quick button { flex: 1; background: var(--bg); border-radius: 8px; padding: 8px; font-size: 14px; font-weight: 600; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; }
.switch-row input { width: 22px; height: 22px; flex: none; }
.win { margin: 10px 0; font-weight: 600; }

/* Мои прогнозы */
.bet { background: var(--bg2); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.bet-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.st { font-weight: 700; }
.st.won { color: var(--ok); } .st.lost { color: var(--bad); } .st.void, .st.pending, .st.awaiting { color: var(--hint); }
.bet-leg { font-size: 13px; padding: 4px 0; display: flex; justify-content: space-between; gap: 8px; }

/* Аватарки */
.ava { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 18px; flex: none; }
.ava.big { width: 76px; height: 76px; font-size: 40px; }

/* Рейтинг */
.card { background: var(--bg2); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.prize b { display: block; font-size: 17px; margin: 4px 0; }
.row { display: grid; grid-template-columns: 26px 34px 1fr auto; gap: 10px; padding: 8px 12px; background: var(--bg2); border-radius: 12px; margin-bottom: 6px; align-items: center; }
.row.me { outline: 1.5px solid var(--accent); }
.place { font-weight: 800; color: var(--hint); text-align: center; }
.me-line { text-align: center; font-weight: 600; padding: 12px 6px 4px; }

/* Профиль */
.card h2 { margin: 8px 0 12px; font-size: 20px; }
.ava-pick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ava-pick button { padding: 3px; border-radius: 50%; border: 2px solid transparent; line-height: 0; }
.ava-pick button.sel { border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.two div { background: var(--bg); border-radius: 12px; padding: 10px; }
.two b { display: block; font-size: 19px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stats b { font-size: 20px; display: block; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(127,127,127,.12); }
.shop-item:last-child { border: 0; }
.shop-item .btn { margin-left: auto; }
.ach { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(127,127,127,.12); }
.ach:last-child { border: 0; }
.ach-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--bg); flex: none; }
.ach.locked { opacity: .45; }
.ach .rw { margin-left: auto; color: var(--hint); font-size: 12px; white-space: nowrap; }

/* Нижние окна */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.sheet-card { background: var(--bg); width: 100%; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto; }
.sheet-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.room { display: flex; align-items: center; gap: 10px; background: var(--bg2); border-radius: 12px; padding: 12px; margin-top: 8px; width: 100%; text-align: left; }
.room b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room.cur { outline: 1.5px solid var(--accent); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg2); border-top: 1px solid rgba(127,127,127,.15); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { display: flex; flex-direction: column; align-items: center; font-size: 18px; color: var(--hint); }
.tabbar button span { font-size: 11px; }
.tabbar button.active { color: var(--accent); }

.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50; background: #000c; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90%; text-align: center; }

/* Страницы правил и политики */
.doc { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; }
.doc h1 { font-size: 22px; }
