/* ========== Базовая палитра ========== */
:root {
  --bg-0: #07080d;
  --bg-1: #0f1220;
  --bg-2: #161a2f;
  --fg-0: #ffffff;
  --fg-1: #b9c0e0;
  --fg-2: #7a83ad;
  --accent: #00f0ff;       /* циан-неон */
  --accent-2: #ff3df2;     /* пурпур-неон */
  --accent-3: #9d4cff;     /* фиолетовый */
  --warn: #ffd23f;
  --good: #2dd4a4;
  --bad: #ff4d6d;
  --radius: 16px;
  --shadow-neon: 0 0 24px rgba(0,240,255,0.35), 0 0 64px rgba(157,76,255,0.25);
  /* фон по умолчанию; заказчик может задать свои цвета в админке */
  --bg-from: #131fcf;
  --bg-to: #d403f3;
}

/* Свои цвета заказчика (класс ставит js/brand.js). Без поддержки color-mix
   (очень старые телефоны) остаётся обычный фон — ничего не ломается. */
html.branded, html.branded body {
  background:
    linear-gradient(rgba(8,6,24,0.30), rgba(8,6,24,0.30)),
    linear-gradient(125deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background:
    linear-gradient(rgba(8,6,24,0.30), rgba(8,6,24,0.30)),
    radial-gradient(1100px 700px at 85% 8%, color-mix(in srgb, var(--bg-to) 45%, transparent) 0%, transparent 60%),
    linear-gradient(125deg, var(--bg-from) 0%, color-mix(in oklab, var(--bg-from), var(--bg-to) 50%) 50%, var(--bg-to) 100%);
  background-repeat: no-repeat;
  background-size: cover;
}
html.branded {
  --shadow-neon: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 64px color-mix(in srgb, var(--accent-2) 25%, transparent);
}
html.branded .glow-text {
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent), 0 0 28px color-mix(in srgb, var(--accent-2) 40%, transparent);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  /* Градиент из фона баннера: синий → фиолетовый → маджента */
  background:
    linear-gradient(rgba(8,6,24,0.30), rgba(8,6,24,0.30)),
    radial-gradient(1100px 700px at 85% 8%, rgba(212,3,243,0.45) 0%, transparent 60%),
    linear-gradient(125deg, #131fcf 0%, #3817e9 28%, #5b14e8 50%, #900de2 75%, #d403f3 100%);
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--fg-0);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Inter", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* лёгкая мерцающая сетка-фон */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; opacity: .18; z-index: 0;
  background-image:
    linear-gradient(rgba(157,76,255,0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.12) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ========== Утилиты ========== */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 20px; position: relative; z-index: 1; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 280px; }
.center { display: flex; align-items: center; justify-content: center; }
.glow-text { text-shadow: 0 0 12px rgba(0,240,255,.6), 0 0 28px rgba(157,76,255,.4); }
.muted { color: var(--fg-2); }
.hidden { display: none !important; }

/* ========== Кнопки ========== */
.btn {
  padding: 12px 22px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  color: #07080d; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,240,255,.25);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(0,240,255,.45); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary {
  background: rgba(255,255,255,.06); color: var(--fg-0);
  border: 1px solid rgba(255,255,255,.12); box-shadow: none;
}
.btn.secondary:hover { background: rgba(255,255,255,.10); }
.btn.danger { background: linear-gradient(135deg, #ff3d6e, #b00d3e); color: #fff; }
.btn.big { font-size: 20px; padding: 18px 36px; }

/* ========== Карточки ========== */
.card {
  background: linear-gradient(180deg, rgba(10,8,30,0.45) 0%, rgba(10,8,30,0.32) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
}
.card.neon { box-shadow: var(--shadow-neon); border-color: rgba(0,240,255,.3); }

/* ========== Поля формы ========== */
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field label { font-size: 13px; color: var(--fg-1); }
.input, .textarea, .select {
  padding: 12px 14px; border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--fg-0); outline: none; font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,240,255,.18);
}
.textarea { min-height: 80px; resize: vertical; }

/* ========== Шапка ========== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(7,8,13,.7);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.logo {
  font-weight: 800; letter-spacing: .5px; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ========== Главная (index) ========== */
.hero { text-align: center; padding: 80px 20px 40px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); margin: 0 0 12px; }
.hero p { font-size: 18px; color: var(--fg-1); max-width: 700px; margin: 0 auto 32px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; }
.role-card {
  padding: 28px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  text-decoration: none; color: var(--fg-0);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.role-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-neon); }
.role-card .ico { font-size: 36px; margin-bottom: 12px; }
.role-card h3 { margin: 0 0 8px; }
.role-card p { margin: 0; color: var(--fg-2); }

/* ========== Хост-экран ========== */
.host-stage {
  height: 100vh;
  height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.host-header { padding: 16px 32px; min-height: 72px; display: flex; justify-content: space-between; align-items: center; position: relative; }
/* логотипы строго по центру шапки, независимо от боковых блоков */
.host-header .partners { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.host-title { font-size: 20px; }
.code-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid rgba(0,240,255,.4); background: rgba(0,240,255,.08);
  font-family: "SF Mono", "JetBrains Mono", monospace; letter-spacing: 4px; font-size: 18px;
}

.host-main { padding: 12px 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.qr-block { display: flex; gap: 48px; align-items: center; flex-wrap: wrap; justify-content: center; }
.qr-card {
  background: #fff; padding: 24px; border-radius: 24px;
  box-shadow: 0 0 60px rgba(0,240,255,.4), 0 0 120px rgba(157,76,255,.35);
}
.qr-card img { display: block; width: 360px; height: 360px; }
.qr-hint h2 { font-size: 40px; margin: 0 0 14px; }
.qr-hint p { font-size: 22px; color: var(--fg-1); margin: 6px 0; }
.qr-hint .url { font-family: "SF Mono", monospace; color: var(--accent); }

.players-strip { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 28px; max-width: 1200px; }
.player-chip {
  padding: 8px 16px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  animation: pop .35s ease-out;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Вопрос на экране */
.question-screen { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; max-width: 1400px; }
.q-meta { color: var(--fg-2); font-size: 16px; letter-spacing: 2px; text-transform: uppercase; }
.q-text {
  font-size: clamp(28px, 4vw, 52px); text-align: center; max-width: 1200px;
  background: linear-gradient(135deg, #fff, #b9c0e0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.q-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; width: 100%; max-width: 1100px; }
.q-option {
  padding: 22px 24px; border-radius: 16px; font-size: 24px; font-weight: 600;
  border: 2px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  display: flex; gap: 14px; align-items: center;
}
.q-option .badge {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #07080d; font-weight: 800;
}
.q-option.opt-0 .badge { background: linear-gradient(135deg, #ff5e9c, #ff3df2); }
.q-option.opt-1 .badge { background: linear-gradient(135deg, #00f0ff, #1d9bf0); }
.q-option.opt-2 .badge { background: linear-gradient(135deg, #ffd23f, #ff9f1c); }
.q-option.opt-3 .badge { background: linear-gradient(135deg, #2dd4a4, #00d084); }

.timer-ring { position: relative; width: 120px; height: 120px; }
.timer-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-ring .num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800; color: #fff;
}
.timer-ring circle.bg { stroke: rgba(255,255,255,.1); fill: transparent; stroke-width: 10; }
.timer-ring circle.fg {
  stroke: url(#g1); fill: transparent; stroke-width: 10;
  stroke-linecap: round; transition: stroke-dashoffset 1s linear;
}

.answered-count {
  padding: 8px 16px; border-radius: 999px;
  background: rgba(45,212,164,.12); border: 1px solid rgba(45,212,164,.3);
  color: var(--good); font-weight: 600;
}

/* Постоянный QR в самом правом верхнем углу, подпись — сбоку слева */
.corner-qr {
  position: fixed; right: 16px; top: 14px; z-index: 50;
  display: flex; flex-direction: row; align-items: center; gap: 14px;
  background: rgba(7,8,13,.9); border: 1px solid rgba(0,240,255,.4);
  border-radius: 14px; padding: 10px 14px;
  box-shadow: var(--shadow-neon);
}
.corner-qr img {
  width: 110px; height: 110px; background: #fff;
  border-radius: 8px; padding: 5px; display: block; flex: none;
}
.corner-qr .corner-qr-text { font-size: 14px; line-height: 1.35; color: var(--fg-1); max-width: 160px; text-align: right; }
.corner-qr .corner-qr-text b { color: var(--accent); font-size: 16px; }
@media (max-width: 900px) {
  .corner-qr { top: auto; bottom: 78px; }
  .corner-qr img { width: 88px; height: 88px; }
}

/* Прогресс-бар ответов */
.answer-progress-wrap { width: 100%; max-width: 1200px; }
.answer-progress-label { font-size: 16px; color: var(--fg-1); margin-bottom: 6px; text-align: center; }
.answer-progress-label b { color: var(--good); }
.answer-progress {
  width: 100%; height: 14px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
}
.answer-progress .fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--good));
  box-shadow: 0 0 16px rgba(45,212,164,.5);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
  border-radius: 999px;
}

/* Дорожка ответов: имена переезжают из «думают» в «ответили» */
.answer-track {
  display: flex; gap: 20px; width: 100%; max-width: 1200px; margin-top: 8px;
}
.track-col {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px; padding: 14px 16px; min-height: 120px;
}
.track-col.done-col { border-color: rgba(45,212,164,.35); background: rgba(45,212,164,.06); }
.track-title { font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--fg-2); margin-bottom: 12px; }
.track-title.good { color: var(--good); }
.track-title b { color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.ans-chip {
  padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 18px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  will-change: transform;
}
.ans-chip.pending { animation: float 3s ease-in-out infinite; }
.ans-chip.done {
  background: linear-gradient(135deg, rgba(45,212,164,.30), rgba(0,240,255,.22));
  border-color: rgba(45,212,164,.55);
  box-shadow: 0 0 16px rgba(45,212,164,.35);
}
.ans-chip.moving { z-index: 20; position: relative; }

/* Область визуализации результатов — заполняет оставшуюся высоту, без скролла */
.viz-area {
  flex: 1 1 0; width: 100%; min-height: 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.question-screen.reveal {
  height: 100%; flex: 1 1 0; min-height: 0;
  display: flex; flex-direction: column; gap: 16px;
}

/* Результаты-диаграмма */
.bars { display: flex; gap: 24px; align-items: flex-end; height: 360px; width: 100%; max-width: 1000px; margin-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar {
  width: 100%; max-width: 140px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
  border-radius: 16px 16px 6px 6px;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 10px;
  color: #07080d; font-weight: 800; font-size: 22px;
  transition: height 1.2s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 24px rgba(0,240,255,.4);
}
.bar.correct { background: linear-gradient(180deg, #2dd4a4, #00d084); box-shadow: 0 0 30px rgba(45,212,164,.5); }
.bar.wrong { background: linear-gradient(180deg, #ff5e9c, #ff3df2); }
.bar-col .lbl { font-size: 16px; color: var(--fg-1); text-align: center; }

/* Облако тегов — масштабируется под количество слов, всё на одном экране */
.tagcloud {
  display: flex; flex-wrap: wrap; gap: 10px 20px;
  justify-content: center; align-content: center; align-items: center;
  width: 100%; height: 100%; padding: 10px; overflow: hidden;
  line-height: 1.05;
}
.tagcloud span {
  display: inline-block; font-weight: 800;
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Коллаж — сетка вычисляется в JS под количество фото, заполняет всю область.
   Фото показываются ПОЛНОСТЬЮ (object-fit: contain), без обрезок, а пустое
   место заполняется размытой копией самого фото — выглядит как в Apple Photos. */
.collage { display: grid; gap: 8px; width: 100%; height: 100%; }
.collage .item {
  position: relative; border-radius: 12px; overflow: hidden;
  min-height: 0; min-width: 0;
  border: 2px solid rgba(255,255,255,.12);
  background: rgba(7,8,13,.6);
  animation: pop .4s;
}
.collage .item-bg {
  position: absolute; inset: -8%;
  background-size: cover; background-position: center;
  filter: blur(22px) brightness(0.55) saturate(1.1);
  z-index: 0;
}
.collage img, .collage video {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}
.collage .who { z-index: 2; }
.collage .item.broken { background: linear-gradient(135deg, rgba(255,77,109,.2), rgba(157,76,255,.15)); }
.collage .item.broken::after {
  content: '⚠ не удалось показать';
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--fg-1); font-size: 13px; text-align: center; padding: 8px;
}

/* Слот-аватар для гостя, который не успел загрузить фото */
.collage .item.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.collage .item.placeholder.ph-0 { background: linear-gradient(135deg, rgba(0,240,255,.18), rgba(157,76,255,.18)); }
.collage .item.placeholder.ph-1 { background: linear-gradient(135deg, rgba(255,61,242,.22), rgba(157,76,255,.18)); }
.collage .item.placeholder.ph-2 { background: linear-gradient(135deg, rgba(255,210,63,.18), rgba(255,93,141,.18)); }
.collage .item.placeholder.ph-3 { background: linear-gradient(135deg, rgba(45,212,164,.18), rgba(0,240,255,.18)); }
.collage .item.placeholder.ph-4 { background: linear-gradient(135deg, rgba(157,76,255,.22), rgba(0,127,255,.18)); }
.collage .item.placeholder.ph-5 { background: linear-gradient(135deg, rgba(255,93,141,.18), rgba(157,76,255,.18)); }
.collage .item.placeholder .placeholder-circle {
  width: 46%; aspect-ratio: 1; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #07080d;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: clamp(28px, 7vw, 92px);
  box-shadow: 0 0 30px rgba(0,240,255,.25);
}
.collage .item.placeholder .placeholder-hint {
  color: var(--fg-2); font-size: clamp(11px, 1vw, 14px); letter-spacing: 1px; text-transform: uppercase;
}
.collage .who {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent 0%, rgba(0,0,0,.55) 40%, rgba(0,0,0,.92) 100%);
  color: #fff; font-weight: 800;
  font-size: clamp(14px, 1.4vw, 22px);
  padding: 22px 12px 10px;
  text-align: center;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Лидерборд внизу */
.leaderbar {
  display: flex; gap: 18px; padding: 14px 28px; align-items: center;
  background: rgba(7,8,13,.85); border-top: 1px solid rgba(255,255,255,.06);
}
.leaderbar .leader-status {
  flex: none; color: var(--fg-2); font-size: 14px; white-space: nowrap;
  padding-right: 18px; border-right: 1px solid rgba(255,255,255,.12);
}
.leaderbar .leader-items {
  display: flex; gap: 14px; overflow-x: auto; flex: 1; min-width: 0; align-items: center;
}
.leaderbar .item {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10);
  font-size: 14px; white-space: nowrap;
}
.leaderbar .rank { font-weight: 800; color: var(--accent); }
.leaderbar .score { color: var(--warn); font-weight: 700; }
.leaderbar .speed { color: var(--good); font-size: 12px; }

/* Подсветка лидеров на отдельном экране */
.leaderboard-screen { width: 100%; max-width: 900px; }
.lb-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin: 10px 0;
  border-radius: 14px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 22px;
  animation: slideIn .5s ease both;
}
.lb-row .rank { font-size: 28px; font-weight: 800; width: 52px; text-align: center; }
.lb-row .rank-1 { color: #ffd23f; }
.lb-row .rank-2 { color: #c0c8e0; }
.lb-row .rank-3 { color: #cd7f32; }
.lb-row .name { flex: 1; font-weight: 600; }
.lb-row .score { color: var(--accent); font-weight: 800; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

/* ========== Клиент игрока (телефон) ========== */
.player-app {
  min-height: 100vh;
  min-height: 100svh; /* учитывает панели браузера на телефоне */
  display: flex; flex-direction: column;
  padding: 16px;
}
.player-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 16px;
}
.player-name { font-weight: 700; }
.player-score {
  font-family: "SF Mono", monospace; color: var(--warn); font-weight: 800;
}

.player-card {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;        /* вопрос по центру экрана */
  gap: 22px; padding: 12px 4px 24px;
}
.player-card #q-progress { text-align: center; }
.p-question { font-size: 23px; font-weight: 700; text-align: center; line-height: 1.35; }
.p-options { display: grid; gap: 14px; }

/* блок ответа: поле + кнопка с воздухом между ними */
.p-answer { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }
.p-option {
  padding: 18px; border-radius: 14px; font-size: 18px; font-weight: 700;
  border: 2px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #fff;
  text-align: left; display: flex; gap: 12px; align-items: center;
  transition: all .15s;
}
.p-option:active { transform: scale(.98); }
.p-option.opt-0 { border-left: 6px solid #ff3df2; }
.p-option.opt-1 { border-left: 6px solid #00f0ff; }
.p-option.opt-2 { border-left: 6px solid #ffd23f; }
.p-option.opt-3 { border-left: 6px solid #2dd4a4; }
.p-option.selected { background: linear-gradient(135deg, rgba(0,240,255,.3), rgba(157,76,255,.3)); border-color: var(--accent); }
.p-option.locked { opacity: .55; pointer-events: none; }

.p-text-input { font-size: 18px; padding: 16px; }
.p-media-input { display: flex; flex-direction: column; gap: 10px; }

.p-state {
  text-align: center; padding: 30px 10px;
}
.p-state .big { font-size: 28px; font-weight: 800; margin-bottom: 8px; }

.p-timer {
  font-family: "SF Mono", monospace; font-weight: 800; font-size: 16px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(0,240,255,.1); color: var(--accent);
}

/* ========== Админка ========== */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 1.4fr 1fr; } }
.q-list .q-item {
  padding: 14px; border-radius: 12px; margin-bottom: 10px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
}
.q-item h4 { margin: 0 0 8px; }
.q-item .controls { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-row { display: flex; gap: 4px; margin-bottom: 10px; }
.tab {
  padding: 8px 14px; border-radius: 10px 10px 0 0; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-bottom: none;
  color: var(--fg-1);
}
.tab.active { background: rgba(0,240,255,.1); color: #fff; border-color: rgba(0,240,255,.3); }

.code-display {
  padding: 16px; border-radius: 14px; background: rgba(0,240,255,.08); border: 1px solid rgba(0,240,255,.3);
  text-align: center;
}
.code-display .code {
  font-family: "SF Mono", monospace; font-size: 36px; letter-spacing: 8px; font-weight: 800;
  color: var(--accent); text-shadow: 0 0 20px rgba(0,240,255,.6);
}

/* ========== Лого партнёров ========== */
.partners {
  display: flex; align-items: center; justify-content: center;
  gap: 48px; flex-wrap: wrap;
}
.partners img {
  height: 56px; width: auto; display: block;
  opacity: .92;
  filter: drop-shadow(0 0 8px rgba(0,240,255,.25));
}
/* в шапке экрана сцены — компактнее */
.host-header .partners { gap: 28px; }
.host-header .partners img { height: 40px; }

/* над QR в лобби — крупнее */
.partners-lobby { margin-bottom: 28px; gap: 56px; }
.partners-lobby img { height: 64px; }

/* плашка партнёров на телефоне */
.partners-mini {
  display: flex; align-items: center; justify-content: center;
  gap: 22px; flex-wrap: wrap;
  padding: 12px 8px;
}
.partners-mini img { height: 30px; width: auto; opacity: .9; }

.partners-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.partners-caption {
  text-align: center; font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--fg-2); margin-bottom: 8px;
}

@media (max-width: 700px) {
  .partners-mini { gap: 16px; }
  .partners-mini img { height: 26px; }
}

/* Логотипы показываются, только если заказчик их загрузил (js/brand.js) */
.partners:empty { display: none; }

/* ========== Вход, ошибки, служебные плашки ========== */
.form-error { color: var(--bad); font-size: 14px; margin: 8px 0 0; }
.consent { font-size: 12px; line-height: 1.45; color: var(--fg-2); margin: 12px 0 0; }
.event-name { color: var(--fg-1); margin: -4px 0 12px; font-weight: 600; }
.upload-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 8px; }
.upload-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .2s; }
.overlay-msg {
  position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
  background: rgba(7,8,13,.85); backdrop-filter: blur(8px); text-align: center; padding: 24px;
}

/* ========== Админка: игры, библиотека, оформление ========== */
.admin-top { display: flex; align-items: center; gap: 12px; }
.list-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 8px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
}
.list-row .grow { flex: 1 1 220px; min-width: 0; }
.list-row .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { font-size: 13px; color: var(--fg-2); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.state-pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.15); color: var(--fg-1); }
.state-pill.live { border-color: var(--good); color: var(--good); }
.save-status { font-size: 13px; color: var(--fg-2); }
.save-status.dirty { color: var(--warn); }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.brand-grid label { font-size: 13px; color: var(--fg-1); display: flex; align-items: center; gap: 8px; }
.brand-grid input[type="color"] { width: 40px; height: 32px; border: none; background: none; padding: 0; cursor: pointer; }
.logo-list { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.logo-thumb {
  position: relative; height: 56px; padding: 6px 10px; border-radius: 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center;
}
.logo-thumb img { height: 44px; width: auto; max-width: 160px; object-fit: contain; }
.logo-thumb button {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--bad); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0;
}
.brand-preview {
  margin-top: 10px; border-radius: 12px; padding: 14px; display: flex; gap: 12px; align-items: center;
  border: 1px solid rgba(255,255,255,.12);
}
.brand-preview .swatch-btn { padding: 8px 14px; border-radius: 10px; font-weight: 700; color: #07080d; }
details.section > summary { cursor: pointer; font-weight: 700; font-size: 17px; margin: 18px 0 8px; }

/* ========== Тосты ========== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 12px;
  background: rgba(7,8,13,.95); border: 1px solid var(--accent);
  box-shadow: 0 0 30px rgba(0,240,255,.4);
  z-index: 1000; animation: pop .25s;
}

/* ========== Адаптив ========== */
@media (max-width: 700px) {
  .qr-card img { width: 260px; height: 260px; }
  .qr-hint h2 { font-size: 28px; }
  .qr-hint p { font-size: 16px; }
  .host-header { padding: 12px 16px; }
  .host-main { padding: 12px 16px; }
}

/* ======================================================================
   Тема «Наука» — для научных мероприятий (Конгресс молодых учёных и т.п.):
   глубокий синий градиент, тонкая светящаяся линейная графика
   (шестиугольники, «дорожки» схем), жирные заголовки капсом, шрифт Manrope.
   Включается классом html.theme-science (js/brand.js, стиль из админки).
   ====================================================================== */
@font-face {
  font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/manrope-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/manrope-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html.theme-science {
  --fg-1: #c7d6f5;
  --fg-2: #8fa6d6;
  --warn: #c7e3ff;
  --good: #5fd39a;
  --sci-line: #91b2df;
  --sci-glow: #c7e3ff;
  --code-color: #c7e3ff;
  --shadow-neon: 0 0 0 1px rgba(199,227,255,.12) inset, 0 0 40px rgba(26,76,249,.35);
}
html.theme-science, html.theme-science body {
  background: linear-gradient(160deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background:
    radial-gradient(1000px 650px at 85% -5%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 65%),
    radial-gradient(800px 600px at -5% 105%, color-mix(in srgb, var(--bg-from) 55%, transparent) 0%, transparent 70%),
    linear-gradient(160deg, var(--bg-from) 0%, color-mix(in oklab, var(--bg-from), var(--bg-to) 65%) 45%, var(--bg-to) 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}
html.theme-science body {
  font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* сота из тонких линий вместо неоновой сетки */
html.theme-science body::before {
  opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%2391b2df' stroke-opacity='.28' stroke-width='1'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%2391b2df' stroke-opacity='.12' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 56px 100px;
  mask-image: radial-gradient(ellipse at 75% 20%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 75% 20%, black 0%, transparent 70%);
}
/* светящиеся концентрические шестиугольники и «дорожки» в углу */
html.theme-science body::after {
  content: '';
  position: fixed; top: -14vmin; right: -14vmin; width: 72vmin; height: 72vmin;
  pointer-events: none; z-index: 0; opacity: .45;
  filter: drop-shadow(0 0 6px rgba(79,146,255,.9));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none' stroke='%23c7e3ff' stroke-width='1.3'%3E%3Cpolygon points='200,20 355.9,110 355.9,290 200,380 44.1,290 44.1,110' stroke-opacity='.55'/%3E%3Cpolygon points='200,70 312.6,135 312.6,265 200,330 87.4,265 87.4,135' stroke-opacity='.4'/%3E%3Cpolygon points='200,120 269.3,160 269.3,240 200,280 130.7,240 130.7,160' stroke-opacity='.3'/%3E%3Cpath d='M44.1 290L10 310L10 360M87.4 265L60 281L60 330L30 348M200 380L200 400M130.7 240L100 258' stroke-opacity='.5'/%3E%3Ccircle cx='10' cy='360' r='3.5' fill='%23c7e3ff'/%3E%3Ccircle cx='30' cy='348' r='3' fill='%23c7e3ff'/%3E%3Ccircle cx='100' cy='258' r='3' fill='%23c7e3ff'/%3E%3Ccircle cx='200' cy='200' r='4' fill='%23c7e3ff' fill-opacity='.8'/%3E%3C/svg%3E") no-repeat center / contain;
}
html.theme-science .host-stage,
html.theme-science .player-app { position: relative; z-index: 1; }

/* заголовки: жирные, белые, капсом */
html.theme-science h1, html.theme-science h2, html.theme-science h3,
html.theme-science .q-text, html.theme-science .p-question, html.theme-science .p-state .big {
  font-weight: 800; letter-spacing: .01em;
}
html.theme-science h1, html.theme-science .glow-text, html.theme-science .qr-hint h2,
html.theme-science .q-meta, html.theme-science .logo {
  text-transform: uppercase; letter-spacing: .04em;
}
html.theme-science .glow-text {
  text-shadow: 0 0 14px rgba(199,227,255,.55), 0 0 34px rgba(79,146,255,.45);
}

/* кнопки: электрический синий, белый текст */
html.theme-science .btn:not(.secondary):not(.danger) {
  background: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in oklab, var(--accent), var(--bg-to) 40%) 100%);
  color: #fff; text-transform: uppercase; letter-spacing: .05em;
  box-shadow: 0 0 0 1px rgba(199,227,255,.28) inset, 0 8px 26px rgba(26,76,249,.45);
}
html.theme-science .btn:not(.secondary):not(.danger):hover { box-shadow: 0 0 0 1px rgba(199,227,255,.5) inset, 0 10px 32px rgba(62,107,255,.6); }
html.theme-science .btn.secondary { background: rgba(199,227,255,.07); border-color: rgba(145,178,223,.3); }

/* карточки и поля: полупрозрачный тёмно-синий с тонкой светлой рамкой */
html.theme-science .card {
  background: linear-gradient(180deg, rgba(5,17,109,.55) 0%, rgba(5,17,109,.38) 100%);
  border-color: rgba(145,178,223,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
html.theme-science .card.neon { border-color: rgba(145,178,223,.45); }
html.theme-science .input, html.theme-science .textarea {
  background: rgba(5,17,109,.35); border-color: rgba(145,178,223,.3);
}
html.theme-science .input:focus, html.theme-science .textarea:focus {
  border-color: var(--sci-glow); box-shadow: 0 0 0 3px rgba(199,227,255,.18);
}

/* экран сцены */
html.theme-science .qr-card { box-shadow: 0 0 0 1px rgba(199,227,255,.4), 0 0 60px rgba(79,146,255,.55), 0 0 140px rgba(26,76,249,.45); }
html.theme-science .qr-hint .url { color: var(--sci-glow); }
html.theme-science .leaderbar { background: rgba(3,10,70,.82); border-top-color: rgba(145,178,223,.22); }
html.theme-science .leaderbar .rank, html.theme-science .lb-row .score { color: var(--sci-glow); }
html.theme-science .player-score { color: var(--sci-glow); }
html.theme-science .p-timer { background: rgba(199,227,255,.1); color: var(--sci-glow); }
html.theme-science .corner-qr { background: rgba(3,10,70,.85); border-color: rgba(145,178,223,.35); }

/* варианты ответов: синий, зелёный, фиолетовый, оранжевый, голубой, светло-синий */
html.theme-science .q-option.opt-0 .badge { background: linear-gradient(135deg, #4f92ff, #1a4cf9); color: #fff; }
html.theme-science .q-option.opt-1 .badge { background: linear-gradient(135deg, #5fd39a, #37b049); color: #fff; }
html.theme-science .q-option.opt-2 .badge { background: linear-gradient(135deg, #9a8ff0, #67438b); color: #fff; }
html.theme-science .q-option.opt-3 .badge { background: linear-gradient(135deg, #f08a5d, #db502f); color: #fff; }
html.theme-science .q-option.opt-4 .badge { background: linear-gradient(135deg, #8cc4ff, #4f92ff); color: #fff; }
html.theme-science .q-option.opt-5 .badge { background: linear-gradient(135deg, #c7e3ff, #91b2df); color: #05116d; }
html.theme-science .p-option.opt-0 { border-left-color: #4f92ff; }
html.theme-science .p-option.opt-1 { border-left-color: #37b049; }
html.theme-science .p-option.opt-2 { border-left-color: #7569de; }
html.theme-science .p-option.opt-3 { border-left-color: #db502f; }
html.theme-science .p-option.opt-4 { border-left-color: #8cc4ff; }
html.theme-science .p-option.opt-5 { border-left-color: #c7e3ff; }
html.theme-science .p-option.selected { background: linear-gradient(135deg, rgba(79,146,255,.35), rgba(26,76,249,.35)); border-color: var(--sci-glow); }

/* админка: выбранный стиль */
.style-btn.active { border-color: var(--accent); background: rgba(255,255,255,.12); }
.brand-preview.science {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%2391b2df' stroke-opacity='.35' stroke-width='1'/%3E%3C/svg%3E"), var(--pv-bg) !important;
  font-family: 'Manrope', sans-serif; text-transform: uppercase; letter-spacing: .04em;
}
.brand-preview.science .swatch-btn { color: #fff; }
/* на мероприятии заказчика надпись «EVENT QUIZ» на телефоне не нужна */
html.theme-science .player-header .logo { visibility: hidden; }
html.theme-science .input::placeholder { color: rgba(199,214,245,.5); }
