:root {
  --bg: var(--tg-theme-bg-color, #17181c);
  --bg2: var(--tg-theme-secondary-bg-color, #22242a);
  --text: var(--tg-theme-text-color, #f2f3f5);
  --hint: var(--tg-theme-hint-color, #8b8f98);
  --accent: var(--tg-theme-button-color, #3e83f8);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --empty: rgba(127, 127, 140, 0.22);
}
* { 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: 12px 12px 32px; }
h1 { margin: 4px 0 6px; font-size: 24px; }
.hidden { display: none !important; }
.center { text-align: center; padding: 40vh 0; color: var(--hint); }
.muted { color: var(--hint); }
.small { font-size: 13px; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--bg2); font-weight: 600; }

#team-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.team-btn { padding: 16px 10px; border-radius: 14px; background: var(--bg2); text-align: center;
  border: 2px solid transparent; }
.team-btn .emoji { font-size: 34px; display: block; }
.team-btn b { display: block; margin-top: 4px; }
.team-btn:disabled { opacity: .4; }
.team-btn:not(:disabled):active { transform: scale(.97); }
.rules { background: var(--bg2); border-radius: 12px; padding: 10px 14px; }
.rules ul { padding-left: 18px; margin: 8px 0 0; }

#scorebar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--empty); }
#scorebar div { transition: width .4s; }
#scores { display: flex; justify-content: space-between; margin: 6px 2px 10px; }

#map-wrap { overflow: auto; border-radius: 10px; background: var(--bg2); max-height: 62vh;
  touch-action: pan-x pan-y; }
#map { display: block; margin: 0 auto; }
.zoom { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px;
  position: relative; pointer-events: none; }
.zoom button { pointer-events: auto; width: 34px; height: 34px; border-radius: 10px; font-size: 20px;
  background: var(--bg2); }

#panel { margin-top: 8px; background: var(--bg2); border-radius: 14px; padding: 12px; }
.charges-row { display: flex; justify-content: space-between; align-items: center; }
#charges { font-size: 20px; letter-spacing: 2px; }
#charges .off { opacity: .2; }
#cell-info { margin: 8px 0 10px; min-height: 18px; }
.primary { width: 100%; padding: 13px; border-radius: 12px; background: var(--accent);
  color: var(--accent-text); font-weight: 600; font-size: 16px; }
.primary:disabled { opacity: .45; }

.tabs { display: flex; gap: 6px; margin: 16px 0 8px; }
.tabs button { flex: 1; padding: 8px; border-radius: 10px; background: var(--bg2); }
.tabs button.active { background: var(--accent); color: var(--accent-text); }
.tab .row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 4px;
  border-bottom: 1px solid var(--empty); }
.tab .row:last-child { border-bottom: 0; }
.tab .row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .row.mine { font-weight: 600; }
.tab .empty { padding: 16px; text-align: center; color: var(--hint); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: 90vw;
  background: rgba(0, 0, 0, .85); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; z-index: 10; }
