:root {
  --bg:
    radial-gradient(circle at 14% 12%, rgba(69, 194, 255, 0.28), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(255, 155, 109, 0.22), transparent 30%),
    linear-gradient(160deg, #08111d, #10284a 54%, #0f1c30);
  --panel: rgba(6, 15, 28, 0.8);
  --panel-strong: rgba(6, 15, 28, 0.92);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f4f8ff;
  --muted: rgba(244, 248, 255, 0.72);
  --accent: #57d8ff;
  --accent-strong: #ff9d61;
  --danger: #ff6e82;
  --success: #5de0a2;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  position: relative;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

.ambient-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

.auth-shell,
.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px 24px;
}

.brand-line,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker,
.viewer-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.brand-copy h1,
.hero-card h2,
.panel h2,
.panel h3 {
  margin: 0;
}

.brand-copy p,
.hero-copy p,
.muted,
.item-sub,
.question-meta {
  color: var(--muted);
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  margin-top: 18px;
}

.hero-card,
.auth-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 26px;
}

.hero-copy {
  max-width: 620px;
}

.feature-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.feature-item {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  padding: 14px 16px;
}

.feature-item strong {
  display: block;
  margin-bottom: 6px;
}

.auth-card,
.panel {
  padding: 20px;
}

.stack,
.auth-form,
.quiz-form,
.join-form,
.question-builder,
.list {
  display: grid;
  gap: 10px;
}

.auth-form,
.question-builder,
.item {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
}

.auth-form h3,
.question-builder h3 {
  margin: 0;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

input,
textarea,
button,
.link-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 14px;
  text-decoration: none;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(87, 216, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(87, 216, 255, 0.15);
}

button,
.link-btn {
  cursor: pointer;
  font-weight: 700;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #08111d;
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
}

.danger {
  border-color: rgba(255, 110, 130, 0.35);
  background: rgba(255, 110, 130, 0.16);
}

.success {
  border-color: rgba(93, 224, 162, 0.34);
  background: rgba(93, 224, 162, 0.15);
}

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

.app-shell {
  display: grid;
  gap: 18px;
}

.topbar {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel-strong);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-actions button {
  width: auto;
}

.viewer-block {
  text-align: right;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.dashboard-grid .panel.live-panel {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head-copy {
  display: grid;
  gap: 4px;
}

.item-title {
  font-weight: 700;
}

.item {
  display: grid;
  gap: 8px;
}

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

.actions button,
.actions .link-btn {
  width: auto;
}

.live-head {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.question-box {
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 16px;
  min-height: 124px;
  background: rgba(255, 255, 255, 0.04);
}

.answers {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.answer-btn {
  text-align: left;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  color: var(--muted);
}

.notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 20;
  border: 1px solid rgba(87, 216, 255, 0.42);
  border-radius: 999px;
  background: rgba(5, 13, 25, 0.94);
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.notice.notice-error {
  border-color: rgba(255, 110, 130, 0.5);
}

.notice.notice-success {
  border-color: rgba(93, 224, 162, 0.46);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .auth-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .auth-shell,
  .app-shell {
    padding: max(14px, env(safe-area-inset-top)) 14px 20px;
  }

  .brand-line,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .viewer-block {
    text-align: left;
  }

  .inline {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
  }

  .actions button,
  .actions .link-btn,
  .topbar-actions button {
    width: 100%;
  }
}
