/* Тема берётся из Telegram (themeParams), с запасными значениями на случай браузера. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #f1f2f4);
  --fg: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #707579);
  --link: var(--tg-theme-link-color, #2f6fed);
  --accent: var(--tg-theme-button-color, #2f6fed);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --line: color-mix(in srgb, var(--hint) 30%, transparent);
  --top-inset: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --bottom-inset: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
header {
  padding: calc(10px + var(--top-inset)) 14px 10px;
  background: var(--secondary);
  border-bottom: 1px solid var(--line);
}
.row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.title { font-weight: 650; font-size: 16px; letter-spacing: .1px; }
.sub { color: var(--hint); font-size: 12px; margin-top: 2px; }
.pill {
  margin-top: 8px; font-size: 12.5px; padding: 7px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg);
  display: flex; align-items: center; gap: 8px;
}
.pill.warn { background: color-mix(in srgb, #f5a524 22%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.pill b { font-variant-numeric: tabular-nums; }
.bar { height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--hint) 25%, transparent); margin-top: 7px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.stage { position: relative; flex: 1; display: flex; min-height: 0; }
iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.overlay {
  position: absolute; inset: 0; z-index: 10; padding: 26px 22px;
  background: var(--bg); display: flex; align-items: center; justify-content: center; text-align: center;
}
.overlay[hidden] { display: none; }
.ov-box { max-width: 430px; }
.ov-icon { font-size: 46px; line-height: 1; }
.ov-box h2 { margin: 12px 0 8px; font-size: 20px; font-weight: 650; }
.ov-box p { color: var(--hint); margin: 6px 0; font-size: 14.5px; }
.ov-box b { color: var(--fg); font-variant-numeric: tabular-nums; }
.ov-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
/* Факты вместо пустоты: место в очереди, ожидание, срок слота */
.ov-facts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 0; }
.ov-facts span {
  background: var(--secondary); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; color: var(--hint); white-space: nowrap;
}
.ov-facts b { color: var(--fg); font-variant-numeric: tabular-nums; }
.ov-note { margin-top: 12px !important; font-size: 13px !important; line-height: 1.45; }
footer {
  padding: 10px 14px calc(10px + var(--bottom-inset));
  border-top: 1px solid var(--line); background: var(--bg);
}
button {
  border: 0; border-radius: 11px; padding: 12px 16px; font-size: 15px; font-weight: 550;
  background: var(--accent); color: var(--accent-text); cursor: pointer;
}
button.tiny { font-size: 13px; padding: 8px 11px; background: var(--secondary); color: var(--link); }
button.wide { width: 100%; }
button.ghost { background: var(--secondary); color: var(--fg); }
button:disabled { opacity: .55; }
.toast {
  position: absolute; left: 12px; right: 12px; bottom: calc(12px + var(--bottom-inset));
  padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--fg) 88%, transparent);
  color: var(--bg); font-size: 14px; z-index: 30; text-align: center;
}
.toast[hidden] { display: none; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--hint) 30%, transparent); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Полоса загрузки портала: холодный старт занимает 10–25 с, белый экран пугал владельца. */
.loading {
  margin-top: 6px; font-size: 12.5px; padding: 6px 10px; border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--fg);
  display: flex; align-items: center; gap: 8px;
}
.loading[hidden] { display: none; }
.spin {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--hint) 35%, transparent); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}