/* Общие компоненты. Цвета задаёт каждая игра своими переменными (--bg, --surface, --accent …). */
:root {
  --radius: 18px;
  --gutter: 16px;
  --tabbar-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--text); background: var(--bg);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
.app { max-width: 520px; margin: 0 auto;
  padding: 10px var(--gutter) calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0;
  border-radius: 14px; padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--accent-text); transition: transform .1s, opacity .2s; }
.btn:active, .pill-btn:active { transform: scale(.96); }
.btn.ghost { background: var(--surface2); color: var(--text); }
.btn.block { display: flex; width: 100%; }
.btn.big { padding: 15px 18px; font-size: 16px; }
.btn:disabled, .pill-btn:disabled { opacity: .45; cursor: default; }
.pill-btn { border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px;
  font-weight: 700; cursor: pointer; background: var(--surface2); color: var(--text); white-space: nowrap; }

/* Карточки и списки */
.card { background: var(--surface); border-radius: var(--radius); padding: 14px; margin: 10px 0;
  box-shadow: var(--shadow, none); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800;
  color: var(--section-title, var(--muted)); margin: 20px 4px 8px; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 12px; }
.row-item + .row-item { border-top: 1px solid var(--line); }
.row-item.me { background: var(--me-bg); border-top-color: transparent; }
.row-item.me + .row-item { border-top-color: transparent; }
.row-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .place { width: 26px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #fff; flex: none; font-size: 15px; }
.empty { padding: 18px 6px; text-align: center; color: var(--muted); }

.segmented { display: flex; background: var(--surface2); border-radius: 12px; padding: 3px; margin: 12px 0 4px; }
.segmented button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 10px;
  font: inherit; font-weight: 700; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px #0003; }

/* Нижнее меню */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--tabbar-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { display: flex; max-width: 520px; margin: 0 auto; }
.tabbar button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px;
  font-weight: 700; padding: 7px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
.tabbar .ic { font-size: 22px; line-height: 28px; filter: grayscale(1); opacity: .6; transition: .2s; }
.tabbar button.active { color: var(--accent-strong, var(--accent)); }
.tabbar button.active .ic { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }

/* Шторка снизу */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: #0009; display: flex;
  align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  background: var(--surface); color: var(--text); border-radius: 24px 24px 0 0;
  padding: 22px var(--gutter) calc(24px + env(safe-area-inset-bottom)); transform: translateY(40px); transition: transform .25s; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet h2 { font-size: 21px; margin-bottom: 10px; padding-right: 36px; }
.sheet h3 { font-size: 15px; margin: 16px 0 6px; }
.sheet p, .sheet li { margin: 6px 0; }
.sheet ol, .sheet ul { padding-left: 20px; margin: 6px 0; }
.sheet-close { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--surface2); color: var(--text); font-size: 14px; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; background: #000d; color: #fff; padding: 10px 16px;
  border-radius: 20px; transition: .2s; pointer-events: none; z-index: 60; max-width: 90vw; text-align: center; font-weight: 600; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fake-ad { position: fixed; inset: 0; background: #000e; color: #fff; display: grid; place-items: center;
  text-align: center; z-index: 70; }
.fake-ad-timer { font-size: 40px; font-weight: 800; }
.confetti { position: fixed; top: -40px; z-index: 55; pointer-events: none; font-size: 26px;
  animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(115vh) rotate(600deg); } }

.shop { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-item { border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow, none); padding: 14px 10px; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.shop-item:active { transform: scale(.97); }
.shop-item:disabled { opacity: .5; }
.shop-item .big-ic { font-size: 34px; line-height: 1.1; }
.shop-item .t { font-weight: 700; font-size: 14px; }
.shop-item .price { margin-top: 4px; background: var(--accent); color: var(--accent-text); border-radius: 999px;
  padding: 4px 12px; font-weight: 800; font-size: 13px; }

/* Плашка для тех, кто открыл игру не в Telegram */
.guest-banner { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; box-shadow: var(--shadow, none); }
.guest-banner span { flex: 1; }
.guest-banner .btn { flex: none; padding: 8px 12px; font-size: 13px; text-decoration: none; }
