/* ════════════════════════════════════════════════════════════
   GuessChat — premium space edition
   ════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@500;600;700&display=swap');

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

:root {
  --bg-0: #030614;
  --bg-1: #060b1f;
  --bg-2: #0a1130;

  --panel: rgba(13, 20, 48, 0.55);
  --panel-solid: #0d1430;
  --glass-border: rgba(140, 160, 255, 0.14);
  --glass-border-hi: rgba(150, 170, 255, 0.32);

  --accent: #7c6cff;
  --accent-2: #2dd4ff;
  --grad-accent: linear-gradient(135deg, #7c6cff 0%, #5a8bff 50%, #2dd4ff 100%);

  --green: #34e8a0;
  --red: #ff5a72;
  --amber: #ffc04d;

  --text: #eef1ff;
  --text-dim: #aab3d9;
  --muted: #6b76a3;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow-card: 0 20px 60px rgba(2, 4, 18, 0.55), 0 2px 8px rgba(2, 4, 18, 0.4);
  --glow-accent: 0 0 24px rgba(124, 108, 255, 0.45);
}

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

body {
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo-text {
  font-family: 'Unbounded', 'Manrope', sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

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

/* ── кастомные SVG-иконки ── */
.ic {
  display: inline-flex;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
  flex-shrink: 0;
}
.ic svg { width: 100%; height: 100%; }
h2 .ic, h3 .ic { color: var(--accent-2); margin-right: 7px; vertical-align: -0.15em; }
.btn .ic { width: 1.2em; height: 1.2em; }
.logo-icon svg { width: 60%; height: 60%; color: #fff; }
.avatar-svg { display: block; border-radius: 50%; }
.player-avatar { display: inline-flex; }
.msg-avatar .ic { width: 58%; height: 58%; color: var(--text-dim); }
.bubble-role .ic { width: 1.3em; height: 1.3em; color: var(--text-dim); }
.msg-tag .ic { width: 1.2em; height: 1.2em; vertical-align: -0.3em; margin-right: 2px; }
.form-group label .ic, .time-setting-label .ic, .chat-builder-header label .ic { margin-right: 5px; vertical-align: -0.28em; color: var(--accent-2); }
.lobby-hint a .ic { margin-right: 3px; }
.ai-eval-name .avatar-svg { display: inline-block; vertical-align: -5px; margin-right: 6px; }

/* ════════════════════════════════════════════════════════════
   SPACE SCENE — stars, orbiting Earth, rocket
   ════════════════════════════════════════════════════════════ */

/* ── 3D canvas background ── */
#bg3d {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  pointer-events: none;
}

.space-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
/* при работающем WebGL прячем CSS-планету и ракету (оставляем только звёзды как лёгкий слой) */
body:not(.no-webgl) .space-bg .earth-orbit,
body:not(.no-webgl) .space-bg .rocket-wrap,
body:not(.no-webgl) .space-bg::before { display: none; }
body.no-webgl #bg3d { display: none; }

/* — vignette / nebulas — */
.space-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 78% 18%, rgba(124, 108, 255, 0.16), transparent 60%),
    radial-gradient(ellipse 55% 45% at 12% 80%, rgba(45, 130, 255, 0.13), transparent 60%),
    radial-gradient(ellipse 40% 35% at 50% 110%, rgba(45, 212, 255, 0.08), transparent 70%);
}

/* — stars (filled by JS) — */
.stars { position: absolute; inset: 0; }
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--tw, 4s) ease-in-out infinite;
  animation-delay: var(--td, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: var(--o, 0.8); }
  50% { opacity: 0.15; }
}

.shooting-star {
  position: absolute;
  width: 130px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
  border-radius: 2px;
  transform: rotate(-35deg);
  opacity: 0;
  animation: shoot 9s linear infinite;
  animation-delay: var(--sd, 0s);
}
@keyframes shoot {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-35deg); }
  1%   { opacity: 1; }
  6%   { opacity: 0; transform: translate(-46vw, 30vw) rotate(-35deg); }
  100% { opacity: 0; transform: translate(-46vw, 30vw) rotate(-35deg); }
}

/* — Earth orbiting — */
.earth-orbit {
  position: absolute;
  right: -14vmin;
  bottom: -16vmin;
  width: 86vmin;
  height: 86vmin;
  animation: orbitDrift 90s linear infinite;
}
@keyframes orbitDrift {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.earth-orbit .orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(140, 170, 255, 0.16);
}
.earth-orbit .orbit-ring.inner {
  inset: 17%;
  border-color: rgba(140, 170, 255, 0.10);
  border-style: solid;
}

.earth-holder {
  /* sits on the orbit ring; counter-rotates so the planet stays upright */
  position: absolute;
  top: -23vmin;
  left: 50%;
  width: 46vmin;
  height: 46vmin;
  max-width: 430px;
  max-height: 430px;
  margin-left: -23vmin;
  animation: orbitDriftReverse 90s linear infinite;
}
@keyframes orbitDriftReverse {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.earth {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* базовый слой — безжизненная порода (стадия 0) */
  background:
    radial-gradient(ellipse 18% 14% at 60% 60%, rgba(50, 42, 34, 0.8), transparent 70%),
    radial-gradient(ellipse 10% 8% at 38% 70%, rgba(45, 38, 30, 0.7), transparent 70%),
    radial-gradient(ellipse 12% 10% at 70% 35%, rgba(55, 46, 36, 0.7), transparent 70%),
    radial-gradient(circle at 32% 28%, #b3a48c 0%, #8d7c63 30%, #5f5244 55%, #3a322a 78%, #1c1813 100%);
  overflow: hidden;
  transition: box-shadow 2.5s ease;
  box-shadow:
    inset -7vmin -5vmin 9vmin rgba(1, 3, 16, 0.85),
    inset 1.5vmin 1.5vmin 5vmin rgba(160, 215, 255, 0.30),
    0 0 7vmin rgba(64, 140, 255, 0.40),
    0 0 18vmin rgba(64, 140, 255, 0.16);
}

/* океаны — стадия 1+ */
.earth .ocean {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #66b8ff 0%, #2f7fe8 30%, #1450b8 55%, #0a2a73 78%, #051538 100%);
  opacity: 1;
  transition: opacity 2.5s ease;
}

/* огни городов на тёмной стороне — стадия 4 */
.earth .lights {
  position: absolute;
  top: 0;
  left: 0;
  width: 220%;
  height: 100%;
  background:
    radial-gradient(2.5px 2.5px at 12% 38%, rgba(255, 214, 120, 0.95), transparent 100%),
    radial-gradient(2px 2px at 16% 44%, rgba(255, 200, 100, 0.8), transparent 100%),
    radial-gradient(3px 3px at 26% 58%, rgba(255, 214, 120, 0.9), transparent 100%),
    radial-gradient(2px 2px at 31% 30%, rgba(255, 200, 100, 0.8), transparent 100%),
    radial-gradient(2.5px 2.5px at 43% 52%, rgba(255, 214, 120, 0.9), transparent 100%),
    radial-gradient(2px 2px at 49% 34%, rgba(255, 200, 100, 0.75), transparent 100%),
    radial-gradient(3px 3px at 58% 62%, rgba(255, 214, 120, 0.9), transparent 100%),
    radial-gradient(2px 2px at 64% 28%, rgba(255, 200, 100, 0.8), transparent 100%),
    radial-gradient(2.5px 2.5px at 74% 48%, rgba(255, 214, 120, 0.9), transparent 100%),
    radial-gradient(2px 2px at 84% 36%, rgba(255, 200, 100, 0.8), transparent 100%),
    radial-gradient(2.5px 2.5px at 92% 56%, rgba(255, 214, 120, 0.85), transparent 100%);
  animation: landSlide 46s linear infinite;
  opacity: 1;
  transition: opacity 2.5s ease;
  -webkit-mask-image: radial-gradient(circle at 30% 28%, transparent 50%, #000 74%);
  mask-image: radial-gradient(circle at 30% 28%, transparent 50%, #000 74%);
}

/* ── стадии терраформинга (атрибут на body) ── */
.earth .land, .earth .clouds { transition: opacity 2.5s ease; }
.earth-holder::after { transition: opacity 2.5s ease; }

body[data-planet-stage="0"] .earth .ocean,
body[data-planet-stage="0"] .earth .land,
body[data-planet-stage="0"] .earth .clouds,
body[data-planet-stage="0"] .earth .lights { opacity: 0; }
body[data-planet-stage="0"] .earth-holder::after { opacity: 0; }
body[data-planet-stage="0"] .earth {
  box-shadow:
    inset -7vmin -5vmin 9vmin rgba(1, 3, 16, 0.88),
    inset 1.5vmin 1.5vmin 5vmin rgba(255, 235, 200, 0.12),
    0 0 5vmin rgba(170, 150, 120, 0.2);
}

body[data-planet-stage="1"] .earth .land,
body[data-planet-stage="1"] .earth .clouds,
body[data-planet-stage="1"] .earth .lights { opacity: 0; }
body[data-planet-stage="1"] .earth-holder::after { opacity: 0.5; }

body[data-planet-stage="2"] .earth .clouds,
body[data-planet-stage="2"] .earth .lights { opacity: 0; }

body[data-planet-stage="3"] .earth .lights { opacity: 0; }

/* ── бейдж планеты ── */
.planet-badge {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(13, 20, 48, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 9px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.planet-badge-icon { width: 26px; height: 26px; color: var(--accent-2); flex-shrink: 0; }
.planet-badge-icon svg { width: 100%; height: 100%; }
.planet-badge-title { font-size: 11px; font-weight: 800; letter-spacing: 0.3px; }
.planet-badge-bar {
  width: 132px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: 4px 0 3px;
}
.planet-badge-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--grad-accent);
  transition: width 1.2s ease;
}
.planet-badge-sub { font-size: 10px; color: var(--muted); }
@media (max-width: 760px) { .planet-badge { display: none !important; } }

/* continents — wide layer sliding inside the sphere = rotation */
.earth .land {
  position: absolute;
  top: 0;
  left: 0;
  width: 220%;
  height: 100%;
  background:
    radial-gradient(ellipse 14% 22% at 8% 32%,  rgba(52, 190, 120, 0.95), transparent 65%),
    radial-gradient(ellipse 20% 30% at 22% 60%, rgba(46, 175, 108, 0.9),  transparent 65%),
    radial-gradient(ellipse 11% 16% at 35% 28%, rgba(58, 200, 130, 0.85), transparent 65%),
    radial-gradient(ellipse 17% 26% at 49% 55%, rgba(44, 168, 104, 0.9),  transparent 65%),
    radial-gradient(ellipse 12% 18% at 61% 30%, rgba(56, 196, 126, 0.85), transparent 65%),
    radial-gradient(ellipse 21% 30% at 75% 62%, rgba(46, 175, 108, 0.9),  transparent 65%),
    radial-gradient(ellipse 13% 20% at 89% 34%, rgba(54, 192, 124, 0.9),  transparent 65%),
    radial-gradient(ellipse 9% 13%  at 97% 58%, rgba(48, 180, 112, 0.85), transparent 65%);
  filter: blur(2px);
  opacity: 0.85;
  animation: landSlide 46s linear infinite;
}
@keyframes landSlide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* clouds — second layer, different speed */
.earth .clouds {
  position: absolute;
  top: 0;
  left: 0;
  width: 220%;
  height: 100%;
  background:
    radial-gradient(ellipse 18% 9% at 12% 22%, rgba(255,255,255,0.5), transparent 70%),
    radial-gradient(ellipse 24% 8% at 34% 48%, rgba(255,255,255,0.38), transparent 70%),
    radial-gradient(ellipse 16% 7% at 55% 70%, rgba(255,255,255,0.42), transparent 70%),
    radial-gradient(ellipse 22% 9% at 72% 30%, rgba(255,255,255,0.4),  transparent 70%),
    radial-gradient(ellipse 15% 7% at 92% 55%, rgba(255,255,255,0.36), transparent 70%);
  filter: blur(3px);
  animation: landSlide 28s linear infinite;
}

/* day/night terminator */
.earth .shade {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, transparent 42%, rgba(1, 3, 16, 0.55) 75%, rgba(1, 3, 16, 0.92) 100%);
}

/* atmosphere rim */
.earth-holder::after {
  content: '';
  position: absolute;
  inset: -2.5%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(140, 200, 255, 0.0) 58%, rgba(120, 190, 255, 0.22) 72%, transparent 78%);
}

/* moon on inner orbit */
.moon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5.5vmin;
  height: 5.5vmin;
  max-width: 52px;
  max-height: 52px;
  margin: -2.75vmin 0 0 -2.75vmin;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #e8edf5 0%, #aab3c5 45%, #5d6675 80%, #3a4150 100%);
  box-shadow: inset -8px -6px 14px rgba(5, 8, 20, 0.7), 0 0 14px rgba(200, 220, 255, 0.18);
  animation: moonOrbit 22s linear infinite;
}
@keyframes moonOrbit {
  0%   { transform: rotate(0deg)   translateX(33vmin) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(33vmin) rotate(-360deg); }
}

/* — rocket flying bottom → top — */
.rocket-wrap {
  position: absolute;
  bottom: -14vh;
  left: 8%;
  animation: rocketFly 13s ease-in infinite;
  animation-delay: 1.2s;
  will-change: transform;
}
@keyframes rocketFly {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  4%   { opacity: 1; }
  50%  { transform: translate(26vw, -62vh) rotate(8deg); opacity: 1; }
  78%  { opacity: 1; }
  100% { transform: translate(44vw, -128vh) rotate(12deg); opacity: 0; }
}
.rocket {
  width: 54px;
  height: auto;
  transform: rotate(-12deg);
  filter: drop-shadow(0 0 14px rgba(124, 160, 255, 0.5));
}
.rocket .flame {
  transform-origin: 50% 0%;
  animation: flameFlicker 0.18s ease-in-out infinite alternate;
}
@keyframes flameFlicker {
  from { transform: scaleY(0.85) scaleX(0.95); opacity: 0.95; }
  to   { transform: scaleY(1.25) scaleX(1.05); opacity: 0.75; }
}
.rocket-trail {
  position: absolute;
  left: 50%;
  top: 84%;
  width: 3px;
  height: 26vh;
  transform: translateX(-50%) rotate(-12deg);
  transform-origin: top center;
  background: linear-gradient(180deg, rgba(150, 190, 255, 0.55), rgba(150, 190, 255, 0.12) 45%, transparent);
  border-radius: 3px;
  filter: blur(2px);
}

@media (prefers-reduced-motion: reduce) {
  .earth-orbit, .earth-holder, .earth .land, .earth .clouds,
  .moon, .rocket-wrap, .rocket .flame, .star, .shooting-star {
    animation: none !important;
  }
}

/* ════════════════════════════════════════════════════════════
   APP LAYOUT
   ════════════════════════════════════════════════════════════ */

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(14px, 4vw, 32px);
  height: 60px;
  background: rgba(4, 7, 22, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--glass-border);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad-accent);
  box-shadow: var(--glow-accent);
  font-size: 17px;
}
.logo-text {
  font-size: 15px;
  background: linear-gradient(90deg, #fff, #b9c5ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.room-info { display: flex; align-items: center; gap: 10px; }
.room-code {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--accent-2);
  background: rgba(45, 212, 255, 0.1);
  border: 1px solid rgba(45, 212, 255, 0.3);
  padding: 5px 14px 5px 18px;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(45, 212, 255, 0.15);
}
.player-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(140, 160, 255, 0.08);
  border: 1px solid var(--glass-border);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 40px) clamp(12px, 3vw, 24px) 56px;
}

/* ── screens ── */
.screen {
  display: none;
  width: 100%;
  max-width: 500px;
  animation: screenIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.screen.active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════════════════════════
   CARDS / GLASS
   ════════════════════════════════════════════════════════════ */

.card, .welcome-card {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: clamp(22px, 4.5vw, 36px);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
  position: relative;
}
.card::before, .welcome-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07), transparent 38%);
}

.card h2 { font-size: clamp(18px, 4vw, 22px); margin-bottom: 6px; }
.card h3 { font-size: 14px; margin: 4px 0 12px; color: var(--text-dim); letter-spacing: 0.04em; }

.subtitle { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.highlight {
  font-family: 'SF Mono', ui-monospace, monospace;
  color: var(--accent-2);
  letter-spacing: 5px;
  text-shadow: 0 0 22px rgba(45, 212, 255, 0.5);
}

.divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border-hi), transparent);
  margin: 22px 0;
}

/* ════════════════════════════════════════════════════════════
   WELCOME (hero)
   ════════════════════════════════════════════════════════════ */

#welcomeScreen { max-width: 560px !important; }

.welcome-card { text-align: center; padding: clamp(34px, 7vw, 56px) clamp(22px, 5vw, 48px); }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(45, 212, 255, 0.08);
  border: 1px solid rgba(45, 212, 255, 0.25);
  border-radius: 999px;
  padding: 7px 16px;
  margin-bottom: 22px;
}
.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulseDot 1.8s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.welcome-card h1 {
  font-size: clamp(26px, 6vw, 40px);
  line-height: 1.18;
  margin-bottom: 14px;
  background: linear-gradient(110deg, #ffffff 20%, #b9c5ff 55%, #6fd8ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.hero-features {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 22px);
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-feature {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 22px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-border);
  background: rgba(140, 160, 255, 0.07);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { border-color: var(--glass-border-hi); background: rgba(140, 160, 255, 0.13); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-accent);
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(96, 110, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { filter: brightness(1.12); background: var(--grad-accent); box-shadow: 0 14px 34px rgba(96, 110, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25); }

.btn-secondary { background: rgba(45, 212, 255, 0.08); border-color: rgba(45, 212, 255, 0.28); color: #aaeeff; }
.btn-secondary:hover { background: rgba(45, 212, 255, 0.15); border-color: rgba(45, 212, 255, 0.45); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); margin-top: 6px; }
.btn-ghost:hover { color: var(--text-dim); background: rgba(140, 160, 255, 0.06); transform: none; }

.btn-compact { width: auto; padding: 10px 18px; font-size: 13px; border-radius: var(--r-sm); }

/* ════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%;
  background: rgba(4, 8, 26, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(124, 108, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; line-height: 1.55; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b76a3' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ════════════════════════════════════════════════════════════
   LOBBY — players, builder, trainings
   ════════════════════════════════════════════════════════════ */

.lobby-header { text-align: center; margin-bottom: 18px; }
.lobby-hint { color: var(--muted); font-size: 13px; margin-top: 8px; }
.lobby-hint a { font-weight: 700; }

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  margin: 14px 0 4px;
}
.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(140, 160, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
.player-avatar { font-size: 15px; }
.player-tag .score {
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
  background: rgba(52, 232, 160, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
}

/* prepared / trainings sections */
.prepared-section { text-align: left; margin-bottom: 4px; }
.prepared-rounds-list { display: flex; flex-direction: column; gap: 8px; }
.empty-hint { color: var(--muted); font-size: 13px; font-style: italic; }

.prepared-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  animation: popIn 0.3s ease;
}
.prepared-number {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--grad-accent);
  box-shadow: 0 0 14px rgba(124, 108, 255, 0.35);
}
.prepared-title { flex: 1; font-size: 14px; font-weight: 600; word-break: break-word; }
.prepared-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.prepared-remove:hover { color: var(--red); background: rgba(255, 90, 114, 0.1); }

.start-hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 10px; }

/* ── chat builder ── */
.chat-builder {
  background: rgba(4, 8, 26, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.chat-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.chat-builder-header label { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.msg-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(140, 160, 255, 0.07);
  border: 1px solid var(--glass-border);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.msg-count-badge.has-msgs { color: var(--accent-2); border-color: rgba(45, 212, 255, 0.3); }

.chat-preview {
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; font-style: italic; }

.chat-bubble {
  position: relative;
  max-width: 88%;
  padding: 10px 36px 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-bubble.user {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(64, 110, 220, 0.34), rgba(40, 75, 160, 0.30));
  border: 1px solid rgba(110, 150, 240, 0.3);
  border-bottom-left-radius: 4px;
}
.chat-bubble.agent {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.26), rgba(86, 70, 200, 0.22));
  border: 1px solid rgba(150, 135, 255, 0.3);
  border-bottom-right-radius: 4px;
}
.bubble-role {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.bubble-remove {
  position: absolute;
  top: 7px;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 6px;
}
.bubble-remove:hover { color: var(--red); }

.chat-composer { border-top: 1px solid var(--glass-border); padding: 12px 14px; }
.composer-role-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.role-select, .tag-select { width: auto; min-width: 0; padding: 9px 32px 9px 12px; font-size: 13px; border-radius: var(--r-sm); flex: 1; }
.composer-hint { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.composer-input-row { display: flex; gap: 8px; align-items: stretch; }
.msg-input-full { flex: 1; min-height: 56px; font-size: 14px; }
.btn-add-msg-v {
  flex-shrink: 0;
  padding: 0 18px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(124, 108, 255, 0.4);
  background: rgba(124, 108, 255, 0.14);
  color: #cdc6ff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-add-msg-v:hover { background: rgba(124, 108, 255, 0.26); }

.chat-attachments { border-top: 1px solid var(--glass-border); padding: 12px 14px; }
.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(140, 160, 255, 0.07);
  border: 1px dashed var(--glass-border-hi);
  border-radius: var(--r-sm);
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.btn-upload:hover { background: rgba(140, 160, 255, 0.13); color: var(--text); }

.screenshots-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.screenshot-thumb { position: relative; }
.screenshot-thumb img {
  height: 64px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-hi);
  display: block;
}
.thumb-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── time presets ── */
.time-setting { margin: 18px 0 6px; text-align: left; }
.time-setting-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.time-setting-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.time-preset {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(140, 160, 255, 0.06);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s;
}
.time-preset:hover { border-color: var(--glass-border-hi); color: var(--text); }
.time-preset.active {
  background: var(--grad-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(96, 110, 255, 0.4);
}
.time-custom-wrap { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.time-custom-input { width: 84px; padding: 9px 12px; font-size: 13px; border-radius: 999px; text-align: center; }
.time-custom-label { font-size: 12px; color: var(--muted); }

/* ════════════════════════════════════════════════════════════
   HOST FULLSCREEN (writing monitor)
   ════════════════════════════════════════════════════════════ */

#hostWritingScreen { max-width: 100% !important; }

.fullscreen-chat {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 60px - clamp(32px, 8vw, 96px));
  min-height: 480px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.fullscreen-chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(4, 7, 22, 0.45);
  flex-wrap: wrap;
}

.round-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  background: var(--grad-accent);
  padding: 7px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(96, 110, 255, 0.4);
  white-space: nowrap;
}

.progress-compact { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.progress-text { font-size: 12.5px; color: var(--text-dim); font-weight: 700; white-space: nowrap; }
.progress-bar-mini {
  width: 110px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--grad-accent);
  border-radius: 4px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.answered-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.answered-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: rgba(52, 232, 160, 0.1);
  border: 1px solid rgba(52, 232, 160, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
  animation: popIn 0.3s ease;
  white-space: nowrap;
}

/* host timer */
.host-timer-block { display: flex; align-items: center; gap: 7px; }
.host-timer-display {
  background: rgba(4, 8, 26, 0.7);
  border: 1px solid var(--glass-border-hi);
  border-radius: var(--r-sm);
  padding: 7px 14px;
}
.host-timer-num {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.host-timer-num.warning { color: var(--amber); text-shadow: 0 0 14px rgba(255, 192, 77, 0.5); }
.host-timer-num.danger { color: var(--red); text-shadow: 0 0 14px rgba(255, 90, 114, 0.6); animation: blinkNum 0.9s step-end infinite; }
@keyframes blinkNum { 50% { opacity: 0.45; } }

.btn-extend, .btn-pause-timer {
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-border);
  background: rgba(140, 160, 255, 0.07);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s;
}
.btn-extend:hover, .btn-pause-timer:hover { border-color: var(--glass-border-hi); color: var(--text); }
.btn-pause-timer.paused { background: rgba(255, 192, 77, 0.15); border-color: rgba(255, 192, 77, 0.4); color: var(--amber); }

/* ── QR-оверлей для проектора ── */
.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(2, 4, 14, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
  animation: fadeIn 0.25s ease;
}
.qr-card {
  background: #fff;
  border-radius: 26px;
  padding: clamp(22px, 4vw, 40px);
  text-align: center;
  max-width: min(92vw, 480px);
  cursor: default;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(124, 108, 255, 0.25);
}
.qr-box svg {
  width: min(62vw, 340px);
  height: min(62vw, 340px);
  display: block;
  margin: 0 auto;
}
.qr-code-text {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: 10px;
  color: #1b1f3a;
  margin: 14px 0 6px;
  padding-left: 10px;
}
.qr-hint { color: #6b7390; font-size: 13.5px; line-height: 1.6; margin-bottom: 8px; }
.qr-card .btn-ghost { color: #6b7390; }
.qr-card .btn-ghost:hover { color: #1b1f3a; background: rgba(0, 0, 0, 0.05); }

/* ── кнопка «Завершить игру» (только у ведущего) ── */
.btn-end-game {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 90, 114, 0.35);
  background: rgba(255, 90, 114, 0.08);
  color: #ff8ea0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s;
  white-space: nowrap;
}
.btn-end-game:hover { background: rgba(255, 90, 114, 0.18); border-color: rgba(255, 90, 114, 0.55); color: #ffb3bf; }

/* ── live-рейтинг игроков на экране тренинга ── */
.rating-sidebar {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid var(--glass-border);
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rating-sidebar:empty { display: none; }
.rating-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rating-title .ic { color: var(--accent-2); }
.rating-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 9px 11px;
  transition: border-color 0.3s, background 0.3s;
}
.rating-row.top1 {
  border-color: rgba(255, 209, 102, 0.5);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.1), rgba(255, 209, 102, 0.03));
}
.rating-row.top2 { border-color: rgba(200, 212, 230, 0.35); }
.rating-row.top3 { border-color: rgba(214, 144, 88, 0.4); }
.rating-rank {
  font-family: 'Unbounded', sans-serif;
  font-size: 12px;
  font-weight: 700;
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
}
.rating-row.top1 .rating-rank { color: #ffd166; }
.rating-row.top2 .rating-rank { color: #c8d4e6; }
.rating-row.top3 .rating-rank { color: #d69058; }
.rating-row .avatar-svg { flex-shrink: 0; }
.rating-info { flex: 1; min-width: 0; }
.rating-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rating-status {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(124, 108, 255, 0.12);
  color: #b3a8ff;
  border: 1px solid rgba(124, 108, 255, 0.3);
}
.rating-row.top1 .rating-status { background: rgba(255, 209, 102, 0.12); color: #ffd166; border-color: rgba(255, 209, 102, 0.35); }
.rating-row.top2 .rating-status { background: rgba(200, 212, 230, 0.1); color: #c8d4e6; border-color: rgba(200, 212, 230, 0.3); }
.rating-row.top3 .rating-status { background: rgba(214, 144, 88, 0.12); color: #e0a878; border-color: rgba(214, 144, 88, 0.35); }
.rating-score {
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
}
.rating-empty { color: var(--muted); font-size: 12px; font-style: italic; padding: 6px 4px; }

.chat-body { display: flex; flex: 1; min-height: 0; }
.chat-fullscreen {
  flex: 1;
  overflow-y: auto;
  padding: clamp(16px, 2.5vh, 36px) clamp(14px, 2vw, 32px);
  display: flex;
  flex-direction: column;
}

/* поток сообщений ведущего — раскрывается под экран */
.chat-stream {
  width: 100%;
  max-width: min(1150px, 96%);
  margin: auto; /* центр и по вертикали, пока сообщений мало */
  padding: 0 clamp(6px, 1vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.7vh, 12px);
}
.chat-fullscreen .chat-msg {
  max-width: min(78%, 820px);
  font-size: clamp(14px, 0.55vw + 9px, 20px);
  line-height: 1.6;
  padding: clamp(10px, 0.9vw, 17px) clamp(14px, 1.1vw, 22px);
  border-radius: clamp(14px, 1.1vw, 20px);
}
.chat-fullscreen .msg-row.user .chat-msg { border-bottom-left-radius: 5px; }
.chat-fullscreen .msg-row.agent .chat-msg { border-bottom-right-radius: 5px; }
.chat-fullscreen .msg-avatar {
  width: clamp(30px, 2.3vw, 46px);
  height: clamp(30px, 2.3vw, 46px);
  font-size: clamp(14px, 1.1vw, 22px);
}
.chat-fullscreen .msg-name { font-size: clamp(9.5px, 0.45vw + 5px, 13px); }
.chat-fullscreen .msg-tag { font-size: clamp(10px, 0.5vw + 5px, 13px); }
.screenshots-sidebar {
  width: 168px;
  flex-shrink: 0;
  border-left: 1px solid var(--glass-border);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.screenshots-sidebar:empty { display: none; }
.screenshots-sidebar img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--glass-border-hi);
  cursor: zoom-in;
  transition: transform 0.18s, box-shadow 0.18s;
}
.screenshots-sidebar img:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }

/* chat messages (host display) */
.msg-row { display: flex; align-items: flex-end; gap: 9px; }
.msg-row.agent { flex-direction: row-reverse; }
/* колонка с именем и бабблом: у агента прижата к аватару справа */
.msg-row > div:not(.msg-avatar) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.msg-row.agent > div:not(.msg-avatar) { align-items: flex-end; }
.msg-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 50%;
  background: rgba(140, 160, 255, 0.1);
  border: 1px solid var(--glass-border);
}
.msg-name {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.msg-row.agent .msg-name { justify-content: flex-end; }
.msg-tag-inline { margin-bottom: 4px; padding: 0 10px; }
.msg-row.agent .msg-tag-inline { text-align: right; }

.chat-msg {
  max-width: 460px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-row.user .chat-msg {
  background: linear-gradient(180deg, rgba(64, 110, 220, 0.34), rgba(40, 75, 160, 0.30));
  border: 1px solid rgba(110, 150, 240, 0.3);
  border-bottom-left-radius: 4px;
}
.msg-row.agent .chat-msg {
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.26), rgba(86, 70, 200, 0.22));
  border: 1px solid rgba(150, 135, 255, 0.3);
  border-bottom-right-radius: 4px;
}

/* message tags */
.msg-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.msg-tag.empathy  { background: rgba(255, 192, 77, 0.13); color: var(--amber); border: 1px solid rgba(255, 192, 77, 0.3); }
.msg-tag.improve  { background: rgba(255, 90, 114, 0.12); color: var(--red);   border: 1px solid rgba(255, 90, 114, 0.28); }
.msg-tag.solution { background: rgba(52, 232, 160, 0.1);  color: var(--green); border: 1px solid rgba(52, 232, 160, 0.28); }
.msg-tag.info     { background: rgba(45, 212, 255, 0.1);  color: var(--accent-2); border: 1px solid rgba(45, 212, 255, 0.28); }
.msg-tag.error    { background: rgba(255, 90, 114, 0.1);  color: #ff8ea0; border: 1px solid rgba(255, 90, 114, 0.22); }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(2, 4, 14, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

/* ════════════════════════════════════════════════════════════
   ANSWERS / VOTING
   ════════════════════════════════════════════════════════════ */

.answers-list { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 18px; }

.answer-card {
  position: relative;
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  text-align: left;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s, background 0.18s;
  animation: popIn 0.35s ease backwards;
}
.answers-list .answer-card:nth-child(2) { animation-delay: 0.05s; }
.answers-list .answer-card:nth-child(3) { animation-delay: 0.1s; }
.answers-list .answer-card:nth-child(4) { animation-delay: 0.15s; }
.answers-list .answer-card:nth-child(5) { animation-delay: 0.2s; }
.answers-list .answer-card:nth-child(6) { animation-delay: 0.25s; }

.answers-list.voting .answer-card { cursor: pointer; }
.answers-list.voting .answer-card:hover {
  border-color: rgba(124, 108, 255, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(2, 4, 18, 0.5), 0 0 0 1px rgba(124, 108, 255, 0.25);
}
.answer-card.selected {
  border-color: var(--accent);
  background: rgba(124, 108, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.2);
}
.answer-card.voted { pointer-events: none; }
.answer-card.voted::after {
  content: '✓ Ваш голос';
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
}
.answer-card.own-answer { opacity: 0.55; cursor: not-allowed; }
.answer-card.own-answer:hover { transform: none; border-color: var(--glass-border); box-shadow: none; }

.answer-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.own-badge {
  font-size: 10px;
  color: var(--amber);
  background: rgba(255, 192, 77, 0.12);
  border: 1px solid rgba(255, 192, 77, 0.3);
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0.3px;
}
.answer-text { font-size: 14.5px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

.host-controls { margin-top: 8px; }

/* summarize */
.btn-summarize {
  margin-top: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 255, 0.3);
  background: rgba(45, 212, 255, 0.07);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-summarize:hover { background: rgba(45, 212, 255, 0.14); }
.btn-summarize.loading { opacity: 0.6; pointer-events: none; }
.answer-summary {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  background: rgba(45, 212, 255, 0.06);
  border-left: 3px solid rgba(45, 212, 255, 0.5);
  border-radius: 0 10px 10px 0;
  padding: 9px 13px;
}

/* progress (voting monitor) */
.progress-info { margin: 18px 0 22px; }
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 10px;
}

/* ════════════════════════════════════════════════════════════
   RESULTS
   ════════════════════════════════════════════════════════════ */

.results-answers { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }

.result-card {
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  text-align: left;
  animation: popIn 0.35s ease backwards;
}
.result-card.original {
  border-color: rgba(52, 232, 160, 0.45);
  background: linear-gradient(180deg, rgba(52, 232, 160, 0.09), rgba(52, 232, 160, 0.03));
  box-shadow: 0 0 28px rgba(52, 232, 160, 0.12);
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.result-author { font-size: 12.5px; font-weight: 800; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.result-author .avatar-svg { display: inline-block; }
.result-card.original .result-author { color: var(--green); }
.result-votes {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-2);
  background: rgba(45, 212, 255, 0.09);
  border: 1px solid rgba(45, 212, 255, 0.25);
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.result-votes:empty { display: none; }
.result-text { font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

.game-over-banner {
  text-align: center;
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 600;
  padding: 30px 16px;
  background: linear-gradient(110deg, #fff 15%, #b9c5ff 55%, #6fd8ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* scoreboard */
.scoreboard { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.score-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 12px 18px;
  animation: popIn 0.35s ease backwards;
}
.score-row:nth-child(1) {
  border-color: rgba(255, 209, 102, 0.5);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.1), rgba(255, 209, 102, 0.03));
  box-shadow: 0 0 26px rgba(255, 209, 102, 0.1);
}
.score-row:nth-child(2) { border-color: rgba(200, 212, 230, 0.35); }
.score-row:nth-child(3) { border-color: rgba(214, 144, 88, 0.4); }
.score-row .rank {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  width: 30px;
  color: var(--muted);
}
.score-row:nth-child(1) .rank { color: #ffd166; }
.score-row:nth-child(2) .rank { color: #c8d4e6; }
.score-row:nth-child(3) .rank { color: #d69058; }
.score-row .name { flex: 1; font-weight: 700; font-size: 14.5px; word-break: break-word; }
.score-row .score { font-weight: 800; font-size: 14px; color: var(--green); white-space: nowrap; }

/* ── судейство ведущим (score review) ── */
#scoreReviewScreen { max-width: 720px !important; }
.review-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.review-row {
  background: rgba(4, 8, 26, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.review-row.correct { border-color: rgba(52, 232, 160, 0.45); background: rgba(52, 232, 160, 0.06); }
.review-row.wrong { border-color: rgba(255, 90, 114, 0.4); background: rgba(255, 90, 114, 0.05); }
.review-row.noanswer { opacity: 0.6; }
.review-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.review-name { font-size: 13.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 7px; }
.review-speed {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(45, 212, 255, 0.09);
  border: 1px solid rgba(45, 212, 255, 0.25);
  padding: 2px 9px;
  border-radius: 999px;
}
.review-noanswer-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(140, 160, 255, 0.07);
  border: 1px solid var(--glass-border);
  padding: 2px 9px;
  border-radius: 999px;
}
.review-toggle { margin-left: auto; display: inline-flex; gap: 6px; }
.review-toggle button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(140, 160, 255, 0.06);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.review-toggle button.act-correct.on { background: rgba(52, 232, 160, 0.16); border-color: rgba(52, 232, 160, 0.5); color: var(--green); }
.review-toggle button.act-wrong.on { background: rgba(255, 90, 114, 0.14); border-color: rgba(255, 90, 114, 0.5); color: #ff8ea0; }
.review-answer { font-size: 14px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.review-ai {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
  background: rgba(124, 108, 255, 0.06);
  border-left: 3px solid rgba(124, 108, 255, 0.5);
  border-radius: 0 8px 8px 0;
  padding: 7px 11px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.review-ai .ic { color: #a99eff; margin-top: 1px; }

/* бейджи баллов в результатах */
.result-points {
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}
.result-points.pos { color: var(--green); }
.result-points.zero { color: var(--muted); }
.result-correct-chip {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 8px;
  border-radius: 999px;
}
.result-correct-chip.yes { background: rgba(52, 232, 160, 0.12); color: var(--green); border: 1px solid rgba(52, 232, 160, 0.3); }
.result-correct-chip.no { background: rgba(255, 90, 114, 0.1); color: #ff8ea0; border: 1px solid rgba(255, 90, 114, 0.25); }
.results-noanswer { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* ── AI evaluation ── */
.ai-eval-block { text-align: left; margin-top: 4px; }
.ai-eval-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 18px 0 12px;
  color: var(--text-dim);
}
.ai-eval-title .ai-chip {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  background: var(--grad-accent);
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(124, 108, 255, 0.4);
}
.ai-eval-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(124, 108, 255, 0.06);
  border: 1px solid rgba(124, 108, 255, 0.22);
  border-radius: var(--r-md);
  padding: 13px 16px;
  margin-bottom: 9px;
  animation: popIn 0.35s ease backwards;
}
.ai-score {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  font-weight: 700;
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(96, 110, 255, 0.4);
}
.ai-score.mid { background: linear-gradient(135deg, #ffc04d, #ff9a3d); box-shadow: 0 4px 16px rgba(255, 170, 60, 0.35); }
.ai-score.low { background: linear-gradient(135deg, #ff5a72, #ff7d5a); box-shadow: 0 4px 16px rgba(255, 90, 114, 0.35); }
.ai-eval-body { flex: 1; min-width: 0; }
.ai-eval-name { font-size: 12.5px; font-weight: 800; margin-bottom: 4px; }
.ai-eval-comment { font-size: 13px; line-height: 1.55; color: var(--text-dim); }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 14px 4px;
}
.ai-loading .waiting-spinner { width: 22px; height: 22px; margin: 0; border-width: 2px; }

/* ════════════════════════════════════════════════════════════
   PLAYER WRITING / WAITING
   ════════════════════════════════════════════════════════════ */

#writingScreen .card { text-align: center; }
#writingScreen .round-badge { margin-bottom: 16px; }
#writingScreen textarea { min-height: 140px; font-size: 15px; }

.waiting-spinner {
  width: 46px;
  height: 46px;
  margin: 6px auto 22px;
  border-radius: 50%;
  border: 3px solid rgba(140, 160, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#waitingScreen .card { text-align: center; }
#waitingScreen h2 { font-size: 16px; font-weight: 500; color: var(--text-dim); font-family: 'Manrope', sans-serif; }

/* player timer ring */
.timer-ring {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
}
.timer-ring svg { transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: rgba(140, 160, 255, 0.12); stroke-width: 5; }
.timer-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.timer-progress.warning { stroke: var(--red); }
.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.timer-text.warning { color: var(--red); }

/* ════════════════════════════════════════════════════════════
   TOAST / CONFETTI / POPUPS
   ════════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 500;
  transform: translateX(-50%) translateY(90px);
  background: rgba(13, 20, 48, 0.92);
  border: 1px solid var(--glass-border-hi);
  backdrop-filter: blur(18px);
  padding: 13px 24px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 18px 50px rgba(2, 4, 18, 0.6);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
  pointer-events: none;
  max-width: min(92vw, 480px);
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(52, 232, 160, 0.5); color: var(--green); }
.toast.error { border-color: rgba(255, 90, 114, 0.5); color: #ff8ea0; }

.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: 400;
  pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.4; }
}

.score-popup {
  position: fixed;
  z-index: 450;
  font-family: 'Unbounded', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 18px rgba(52, 232, 160, 0.6);
  pointer-events: none;
  animation: scoreFloat 1.5s ease-out forwards;
}
@keyframes scoreFloat {
  0%   { opacity: 0; transform: translateY(6px) scale(0.7); }
  20%  { opacity: 1; transform: translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateY(-44px) scale(1); }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 760px) {
  .earth-orbit { right: -34vmin; bottom: -30vmin; opacity: 0.85; }
  .rocket { width: 42px; }

  .header { height: 54px; }
  .logo-text { font-size: 13px; }
  .room-code { font-size: 12px; letter-spacing: 3px; padding: 4px 11px 4px 14px; }
  .player-count { display: none; }

  .content { padding-bottom: 40px; }

  .fullscreen-chat { height: auto; min-height: 0; }
  .fullscreen-chat-header { gap: 9px; padding: 10px 12px; }
  .answered-list { order: 10; width: 100%; }
  .chat-body { flex-direction: column; }
  .rating-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
  }
  .rating-sidebar .rating-title { display: none; }
  .rating-row { min-width: 170px; }
  .btn-end-game { font-size: 11px; padding: 5px 10px; }
  .chat-fullscreen { max-height: 52vh; padding: 16px 12px; }
  .screenshots-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .screenshots-sidebar img { width: auto; height: 84px; }
  .chat-msg { max-width: 78vw; }

  .composer-role-row { flex-wrap: wrap; }
  .composer-hint { display: none; }
  .composer-input-row { flex-direction: column; }
  .btn-add-msg-v { padding: 12px; }

  .time-custom-wrap { margin-left: 0; width: 100%; }

  .host-timer-block { margin-left: auto; }
}

@media (max-width: 420px) {
  .card, .welcome-card { padding: 20px 16px; }
  .btn { padding: 13px 16px; font-size: 14px; }
  .chat-bubble { max-width: 100%; }
  .score-row { padding: 11px 13px; gap: 10px; }
}

/* large screens — let host monitor breathe */
@media (min-width: 1100px) {
  .chat-fullscreen { padding: 30px; }
}
