:root {
  color-scheme: dark;
  --bg: #0a192f;
  --bg-deep: #07111f;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(10, 25, 47, 0.78);
  --text: #fffff0;
  --text-soft: #faf9f6;
  --muted: rgba(250, 249, 246, 0.68);
  --line: rgba(0, 245, 212, 0.18);
  --line-strong: rgba(0, 245, 212, 0.42);
  --primary: #00f5d4;
  --primary-2: #00d4ff;
  --cream: #fffdd0;
  --amber: #ffd45c;
  --danger: #ff4d6d;
  --ok: #51f2a8;
  --shadow: 0 16px 45px rgba(0, 0, 0, 0.38);
  --glow: 0 0 22px rgba(0, 245, 212, 0.24);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-soft);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(0, 245, 212, 0.18), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(255, 212, 92, 0.12), transparent 24%),
    radial-gradient(circle at 50% 110%, rgba(0, 150, 136, 0.18), transparent 36%),
    linear-gradient(145deg, #002b2d 0%, #0a192f 54%, #07111f 100%);
  background-attachment: fixed;
}

a {
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 245, 212, 0.38);
  transition: color 180ms ease, border-color 180ms ease, text-shadow 180ms ease;
}

a:hover,
a:focus-visible {
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-shadow: 0 0 10px rgba(0, 245, 212, 0.45);
}

h1, h2, h3, h4 {
  color: var(--text);
  letter-spacing: 0;
  text-shadow: 0 0 14px rgba(255, 253, 208, 0.12);
}

h1 { margin-top: 0; }

h2 {
  padding-left: 12px;
  border-left: 4px solid var(--primary);
}

p { line-height: 1.58; }

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.62rem 0.9rem;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  background: rgba(10, 25, 47, 0.72);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: inset 0 0 12px rgba(0, 245, 212, 0.05);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

button:hover,
.button:hover,
button:focus-visible,
.button:focus-visible {
  color: #07111f;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.42);
  outline: none;
  transform: translateY(-2px);
}

button.primary,
.button.primary,
.primary {
  color: #07111f;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.danger {
  color: #fff;
  background: rgba(255, 77, 109, 0.16);
  border-color: rgba(255, 77, 109, 0.78);
}

.danger:hover,
.danger:focus-visible {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.45);
}

.host {
  color: #07111f;
  background: var(--amber);
  border-color: transparent;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: linear-gradient(-45deg, rgba(10, 25, 47, 0.94), rgba(0, 150, 136, 0.28), rgba(10, 30, 50, 0.94));
  background-size: 400% 400%;
  border-bottom: 1px solid rgba(0, 245, 212, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(15px) saturate(160%);
  animation: gradientBG 15s ease infinite;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 860;
  font-size: 20px;
  border-bottom: 0;
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.38);
}

.brand img {
  flex: 0 0 auto;
  border-radius: 9px;
  filter: drop-shadow(0 0 10px rgba(0, 245, 212, 0.42));
}

.topbar nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar nav a {
  position: relative;
  overflow: hidden;
  min-height: 38px;
  padding: 0.48rem 0.75rem;
  color: var(--text-soft);
  font-weight: 700;
  border: 0;
  border-radius: 8px;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
  color: var(--cream);
  background: rgba(255, 253, 208, 0.1);
}

.inline { display: inline; }

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 28px auto 52px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.test-drive-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 26px;
  padding: 20px;
  background: rgba(10, 25, 47, 0.58);
  border: 1px solid rgba(0, 245, 212, 0.22);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 0 22px rgba(0, 245, 212, 0.04);
}

.test-drive-banner h2,
.test-drive-banner p {
  margin: 0;
}

.test-drive-banner h2 {
  margin-bottom: 8px;
}

.message {
  padding: 11px 13px;
  color: var(--text);
  background: rgba(10, 25, 47, 0.76);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.message.error { border-left-color: var(--danger); }
.message.success { border-left-color: var(--ok); }
.message.warning { border-left-color: var(--amber); }

.panel,
.card,
.widget {
  position: relative;
  overflow: hidden;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 0 22px rgba(0, 245, 212, 0.035);
  backdrop-filter: blur(12px);
}

.panel,
.card,
.widget { padding: 20px; }

.panel > *,
.card > *,
.widget > *,
.question-card > *,
.live-question-card > * {
  position: relative;
  z-index: 2;
}

.card,
.question-card,
.widget {
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.card:hover,
.question-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 245, 212, 0.48);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42), var(--glow);
  transform: translateY(-5px);
}

.narrow { max-width: 540px; margin: 0 auto; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card h3 { margin-top: 0; color: var(--cream); }
.card p, .card span, .card div, .card li, .card small { color: var(--text-soft); }

.card dl {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 240, 0.08);
}

dt { color: var(--muted); }
dd { margin: 0; color: var(--text); text-align: right; }

.split,
.game-shell,
.host-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  align-items: start;
}

.form {
  display: grid;
  gap: 12px;
}

.form p,
.form label {
  display: grid;
  gap: 6px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  font: inherit;
  background: rgba(10, 25, 47, 0.72);
  border: 1px solid rgba(0, 245, 212, 0.32);
  border-radius: 8px;
  outline: none;
  padding: 0.68rem 0.78rem;
  box-shadow: inset 0 0 12px rgba(0, 245, 212, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

select option {
  color: var(--text);
  background: #0a192f;
}

input::placeholder,
textarea::placeholder { color: rgba(255, 255, 240, 0.45); }

input:focus,
textarea:focus,
select:focus {
  background: rgba(10, 25, 47, 0.92);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.34);
}

label {
  color: var(--cream);
  font-weight: 650;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

.timer {
  margin: 16px 0;
  color: var(--cream);
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 18px rgba(255, 253, 208, 0.35);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.32rem 0.68rem;
  color: var(--cream);
  font-size: 14px;
  font-weight: 750;
  background: rgba(10, 25, 47, 0.78);
  border: 1px solid rgba(0, 245, 212, 0.22);
  border-radius: 999px;
}

.badge.ok {
  color: #07111f;
  background: var(--ok);
  border-color: transparent;
}

.badge.error {
  color: #fff;
  background: rgba(255, 77, 109, 0.18);
  border-color: rgba(255, 77, 109, 0.75);
}

.options { display: grid; gap: 12px; }

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.option-row.is-selected {
  background: rgba(255, 212, 92, 0.1);
  border-color: rgba(255, 212, 92, 0.58);
  box-shadow: inset 0 0 18px rgba(255, 212, 92, 0.08);
}

.option-row.is-selected .answer-option {
  color: #07111f;
  background: var(--amber);
  border-color: transparent;
}

.option-row.is-confirmed {
  background: rgba(0, 245, 212, 0.12);
  border-color: rgba(0, 245, 212, 0.72);
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.18), inset 0 0 18px rgba(0, 245, 212, 0.08);
}

.option-row.is-confirmed .answer-option,
.option-row.is-confirmed .confirm-option {
  color: #07111f;
  background: var(--primary);
  border-color: transparent;
}

.chat-log {
  height: 360px;
  overflow: auto;
  padding: 12px;
  background: rgba(7, 17, 31, 0.58);
  border: 1px solid rgba(0, 245, 212, 0.24);
  border-radius: 8px;
  box-shadow: inset 0 0 16px rgba(0, 245, 212, 0.04);
}

.chat-log p {
  margin: 0 0 9px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(0, 245, 212, 0.4);
  border-radius: 8px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.system-message {
  color: var(--amber);
  border-left-color: var(--amber) !important;
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.team-box {
  padding-top: 12px;
  border-top: 1px solid rgba(0, 245, 212, 0.18);
}

.table {
  width: 100%;
  min-width: 560px;
  color: var(--text);
  border-collapse: collapse;
  background: transparent;
}

.table th,
.table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 240, 0.1);
}

.table th {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0;
  background: rgba(0, 150, 136, 0.2);
  border-bottom: 2px solid var(--primary);
}

.table tr:hover td {
  background: rgba(0, 245, 212, 0.06);
}

.widget-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.widget-head h1,
.widget-head h2 { margin: 0; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 9px rgba(0, 245, 212, 0.38);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  min-height: 82px;
  padding: 14px;
  background: rgba(10, 25, 47, 0.62);
  border: 1px solid rgba(0, 245, 212, 0.22);
  border-radius: 8px;
  box-shadow: inset 0 0 18px rgba(0, 245, 212, 0.04);
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 14px;
}

.section-title h2 { margin: 0; }
.section-title p { max-width: 560px; margin: 0; color: var(--muted); }

.question-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.question-card,
.live-question-card,
.empty-widget,
.preview-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: rgba(10, 25, 47, 0.58);
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 8px;
  box-shadow: inset 0 0 18px rgba(0, 245, 212, 0.04);
}

.question-card {
  display: grid;
  gap: 12px;
}

.question-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-number,
.points {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.26rem 0.68rem;
  font-size: 13px;
  font-weight: 800;
  border-radius: 999px;
}

.card-number {
  color: #07111f;
  background: var(--primary);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.3);
}

.points {
  color: #07111f;
  background: var(--amber);
}

.question-card h3,
.question-card h2,
.live-question-card h1 {
  margin: 0;
  color: var(--cream);
}

.question-text {
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.55;
}

.answer-list {
  display: grid;
  gap: 8px;
}

.answer-chip {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  color: var(--text-soft);
  background: rgba(7, 17, 31, 0.62);
  border: 1px solid rgba(0, 245, 212, 0.18);
  border-radius: 8px;
}

.answer-chip span {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
  background: rgba(0, 245, 212, 0.1);
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 999px;
}

.answer-chip p { margin: 0; }

.answer-chip.correct {
  background: rgba(0, 245, 212, 0.12);
  border-color: rgba(0, 245, 212, 0.62);
  box-shadow: inset 0 0 16px rgba(0, 245, 212, 0.08);
}

.answer-chip.correct span {
  color: #07111f;
  background: var(--primary);
}

.host-note {
  margin: 0;
  padding: 10px;
  color: var(--cream);
  background: rgba(255, 212, 92, 0.1);
  border: 1px solid rgba(255, 212, 92, 0.34);
  border-radius: 8px;
}

.question-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}

.test-drive-page {
  display: grid;
  gap: 18px;
}

.test-drive-hero {
  display: grid;
  gap: 14px;
}

.test-drive-hero p {
  max-width: 820px;
}

.test-drive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.test-drive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.steps-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.steps-list li {
  line-height: 1.5;
}

.credentials-list {
  display: grid;
  gap: 10px;
}

.credentials-list div,
.test-drive-state div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 240, 0.1);
}

.credentials-list span,
.test-drive-state dt {
  color: var(--muted);
}

.credentials-list strong,
.test-drive-state dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.test-drive-page audio {
  width: 100%;
  margin-top: 10px;
}

.question-form-card {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: rgba(10, 25, 47, 0.42);
  border: 1px solid rgba(0, 245, 212, 0.16);
  border-radius: 8px;
}

.form-section h2 {
  margin: 0 0 4px;
}

.form-help {
  margin: 0;
  color: var(--muted);
}

.form label span {
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
}

.compact-actions {
  margin: 0;
  justify-content: flex-end;
}

.full-field {
  display: grid;
  gap: 6px;
}

.option-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.option-editor-grid label {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 8px;
}

.option-editor-grid label span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #07111f;
  font-weight: 900;
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.28);
}

.live-question-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.live-question-card .timer {
  margin: 0;
  font-size: 42px;
}

.live-host-panel {
  align-self: start;
}

.live-list,
#team-live-list {
  display: grid;
  gap: 10px;
}

.live-row,
.live-members li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 245, 212, 0.16);
  border-radius: 8px;
}

.live-members {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.live-members small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.live-team details {
  margin-top: 10px;
  color: var(--muted);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(7, 17, 31, 0.9); }
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  .split,
  .game-shell,
  .host-layout,
  .test-drive-grid,
  .question-editor {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .form-grid,
  .form-grid.two,
  .option-editor-grid {
    grid-template-columns: 1fr;
  }

  .widget-head,
  .section-title,
  .test-drive-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .timer { font-size: 48px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .option-row,
  .chat-form {
    grid-template-columns: 1fr;
  }
}
