/* ==========================================================================
   КВИЗ-ПАТИ — базовая дизайн-система (общая для экрана ведущего и телефона).
   Владелец файла — Lead. Не переопределяйте токены в других css без нужды.
   Стили экранов — в host.css / play.css поверх этого файла.
   ========================================================================== */

:root {
  /* Фон: глубокая ночь + фиолет */
  --bg-0: #0d0820;
  --bg-1: #1a1138;
  --bg-2: #241a4d;

  /* Текст */
  --text: #f5f2ff;
  --muted: #a89fc7;
  --dim: #6f6690;

  /* Неоновые акценты */
  --pink: #ff3e8a;
  --cyan: #35e0ff;
  --lime: #b6ff3e;
  --amber: #ffc53e;
  --violet: #a78bfa;
  --red: #ff5470;
  --green: #3ef29b;

  /* Поверхности */
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-3: rgba(255, 255, 255, 0.16);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.24);

  /* Скругления / тени */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-pill: 999px;
  --shadow-1: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 24px 70px rgba(0, 0, 0, 0.5);
  --glow-pink: 0 0 40px rgba(255, 62, 138, 0.35);
  --glow-cyan: 0 0 40px rgba(53, 224, 255, 0.3);

  /* Типографика */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-display: "Segoe UI Black", -apple-system, BlinkMacSystemFont, "Arial Black",
    "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Сетка */
  --safe: clamp(14px, 3.2vmin, 44px);
  --gap: clamp(10px, 2vmin, 22px);

  color-scheme: dark;
}

/* ---------- reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.25;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

::selection {
  background: var(--pink);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

/* ---------- фон сцены ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}

.app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 12% 0%, rgba(255, 62, 138, 0.2), transparent 60%),
    radial-gradient(ellipse 70% 55% at 92% 8%, rgba(53, 224, 255, 0.16), transparent 62%),
    radial-gradient(ellipse 90% 70% at 50% 115%, rgba(167, 139, 250, 0.22), transparent 66%),
    linear-gradient(165deg, var(--bg-1) 0%, var(--bg-0) 55%, #0a0618 100%);
}

/* лёгкая сетка «студии» */
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000 30%, transparent 100%);
}

/* цветные blob-подсветки (добавьте внутрь .app контейнер .blobs или используйте сами) */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  animation: blob-float 18s ease-in-out infinite alternate;
}

.blob--pink { width: 46vmin; height: 46vmin; background: var(--pink); top: -12vmin; left: -10vmin; }
.blob--cyan { width: 38vmin; height: 38vmin; background: var(--cyan); bottom: -14vmin; right: -8vmin; animation-delay: -6s; }
.blob--violet { width: 34vmin; height: 34vmin; background: var(--violet); top: 42%; left: 55%; opacity: 0.28; animation-delay: -11s; }

@keyframes blob-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmin, 6vmin, 0) scale(1.14); }
}

/* ---------- типографика ---------- */
.title {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 0.95;
  text-wrap: balance;
}

.title--xl { font-size: clamp(38px, 8.2vmin, 120px); }
.title--lg { font-size: clamp(26px, 5.4vmin, 72px); }
.title--md { font-size: clamp(20px, 3.6vmin, 44px); }
.title--sm { font-size: clamp(16px, 2.4vmin, 28px); }

.gradient-text {
  background: linear-gradient(100deg, var(--pink), var(--amber) 45%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.text-center { text-align: center; }
.text-upper { text-transform: uppercase; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.row { display: flex; flex-direction: row; align-items: center; gap: var(--gap); }
.col { display: flex; flex-direction: column; gap: var(--gap); }
.stack { display: flex; flex-direction: column; gap: calc(var(--gap) * 0.75); }
.center { display: flex; align-items: center; justify-content: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; min-height: 0; }
.full { width: 100%; height: 100%; }
.safe { padding: var(--safe); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- кнопки ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0.7em 1.3em;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 800;
  font-size: clamp(15px, 2vmin, 22px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--stroke);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, opacity 0.18s ease;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--stroke-strong); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; }

.btn--primary {
  background: linear-gradient(135deg, var(--pink), #ff7a3e);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 30px rgba(255, 62, 138, 0.35);
}
.btn--primary:hover:not(:disabled) { box-shadow: var(--glow-pink); }

.btn--cyan {
  background: linear-gradient(135deg, #14b8d8, var(--cyan));
  border-color: transparent;
  color: #04141a;
  box-shadow: 0 10px 30px rgba(53, 224, 255, 0.3);
}

.btn--lime {
  background: linear-gradient(135deg, #7ee81f, var(--lime));
  border-color: transparent;
  color: #10200a;
  box-shadow: 0 10px 30px rgba(182, 255, 62, 0.28);
}

.btn--ghost {
  background: transparent;
  border-color: var(--stroke-strong);
  color: var(--text);
}

.btn--danger { background: linear-gradient(135deg, #e01e46, var(--red)); color: #fff; border-color: transparent; }

.btn--lg { min-height: 62px; padding: 0.85em 1.7em; font-size: clamp(17px, 2.6vmin, 30px); }
.btn--xl { min-height: 76px; padding: 1em 2em; font-size: clamp(20px, 3.4vmin, 40px); border-radius: var(--r-lg); }
.btn--block { display: flex; width: 100%; }
.btn--square { border-radius: var(--r-md); }
.btn--icon { min-width: 48px; padding: 0.7em; }

/* ---------- поверхности ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: clamp(12px, 2vmin, 26px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card--strong { background: var(--surface-2); box-shadow: var(--shadow-1); }
.card--flat { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.9em;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  font-weight: 700;
  font-size: clamp(12px, 1.6vmin, 18px);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.75em;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.1);
  font-size: clamp(11px, 1.4vmin, 15px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--pink { background: rgba(255, 62, 138, 0.18); color: #ff9cc2; }
.badge--cyan { background: rgba(53, 224, 255, 0.16); color: #9beeff; }
.badge--lime { background: rgba(182, 255, 62, 0.16); color: #dcff9e; }
.badge--amber { background: rgba(255, 197, 62, 0.16); color: #ffe1a0; }

/* ---------- аватар ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: var(--surface-2);
  line-height: 1;
  font-size: inherit;
  flex: 0 0 auto;
  user-select: none;
}

/* ---------- прогресс-бар ---------- */
.progress {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  transition: width 0.18s linear;
  transform-origin: left center;
}

.progress--tall { height: 16px; }
.progress--low .progress__bar { background: linear-gradient(90deg, var(--amber), var(--red)); }

/* ---------- код комнаты ---------- */
.code-box {
  display: inline-flex;
  gap: clamp(6px, 1.4vmin, 18px);
  padding: clamp(10px, 1.8vmin, 22px) clamp(14px, 2.6vmin, 34px);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--stroke-strong);
  box-shadow: var(--glow-pink), inset 0 0 30px rgba(255, 62, 138, 0.1);
}

.code-box__char {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(42px, 9vmin, 130px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 26px rgba(255, 62, 138, 0.75);
}

/* ---------- утилиты анимаций ---------- */
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.82) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes float-up {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-55vh) scale(1.25) rotate(10deg); }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.04); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  40% { transform: translateX(8px) rotate(1deg); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes tick-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); color: var(--red); }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.anim-pop { animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.anim-shake { animation: shake 0.45s ease both; }
.anim-pulse { animation: pulse-soft 1.6s ease-in-out infinite; }
.anim-float-up { animation: float-up 3.2s ease-out forwards; }

/* ---------- скроллбары ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- доступность ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hidden { display: none !important; }
}
