:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #10141b;
  --surface-2: #171c25;
  --surface-3: #202734;
  --text: #f7f9fc;
  --muted: #9da8b8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #2f80ff;
  --accent-strong: #4f96ff;
  --success: #52d38a;
  --warning: #ffc857;
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(47, 128, 255, 0.18), transparent 33rem),
    radial-gradient(circle at 100% 20%, rgba(90, 46, 255, 0.12), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.shell {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 28px 0 64px;
}

.shell.wide {
  width: min(100% - 32px, 1260px);
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 46px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(47, 128, 255, 0.38), rgba(47, 128, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.brand-mark::before {
  content: "K";
  font-size: 18px;
}

.brand-subtle {
  color: var(--muted);
  font-size: 13px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 19px);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(20, 25, 34, 0.96), rgba(13, 17, 23, 0.97));
  box-shadow: var(--shadow);
}

.card-pad {
  padding: clamp(20px, 4vw, 34px);
}

.stack {
  display: grid;
  gap: 20px;
}

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

.comparison-wrap {
  margin: 28px 0;
}

.comparison-wrap > h2 {
  margin-bottom: 16px;
  font-size: 21px;
}

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

.comparison-card {
  position: relative;
  overflow: hidden;
  min-height: 168px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.comparison-card::after {
  position: absolute;
  right: -50px;
  bottom: -65px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(47, 128, 255, 0.12);
  content: "";
  filter: blur(4px);
}

.comparison-label {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comparison-time {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
  font-size: clamp(20px, 4vw, 27px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.comparison-secondary {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
}

.survey-form {
  display: grid;
  gap: 22px;
}

.question {
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(16, 20, 27, 0.92);
}

.question-number {
  display: inline-grid;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 10px;
  color: var(--accent-strong);
  background: rgba(47, 128, 255, 0.13);
  font-size: 13px;
  font-weight: 800;
}

.question-title {
  margin-bottom: 6px;
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.required-mark {
  margin-left: 5px;
  color: var(--warning);
}

.help-text {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

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

.option {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.option:hover {
  border-color: rgba(79, 150, 255, 0.55);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(47, 128, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(47, 128, 255, 0.22);
}

.option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.textarea,
.text-input,
.select-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.textarea {
  min-height: 120px;
  padding: 15px;
  resize: vertical;
}

.text-input,
.select-input {
  min-height: 48px;
  padding: 11px 13px;
}

.textarea:focus,
.text-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.14);
}

.char-count {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 760;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), #6c5cff);
  box-shadow: 0 12px 28px rgba(47, 128, 255, 0.25);
}

.btn-secondary {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  border-color: rgba(255, 107, 107, 0.25);
  color: #ffb0b0;
  background: rgba(255, 107, 107, 0.1);
}

.btn-small {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.notice {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 14px;
}

.notice strong {
  color: var(--text);
}

.notice-success {
  border-color: rgba(82, 211, 138, 0.28);
  color: #b8f2d0;
  background: rgba(82, 211, 138, 0.09);
}

.notice-warning {
  border-color: rgba(255, 200, 87, 0.25);
  color: #ffe3a8;
  background: rgba(255, 200, 87, 0.08);
}

.notice-danger {
  border-color: rgba(255, 107, 107, 0.25);
  color: #ffc1c1;
  background: rgba(255, 107, 107, 0.08);
}

.privacy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.loading {
  display: grid;
  min-height: 320px;
  place-items: center;
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

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

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 20px;
  padding: 18px;
}

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

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

.survey-list-item {
  width: 100%;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.survey-list-item:hover,
.survey-list-item.active {
  border-color: var(--line);
  background: var(--surface-2);
}

.survey-list-item-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 720;
}

.survey-list-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-pill::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.status-pill[data-status="open"]::before { background: var(--success); }
.status-pill[data-status="closed"]::before { background: var(--danger); }
.status-pill[data-status="draft"]::before { background: var(--warning); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.result-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.result-options {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.result-row-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 7px;
  font-size: 14px;
}

.bar-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-fill {
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7f6fff);
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.comment {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.comment-time {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.question-builder {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.builder-question {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

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

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel {
  width: min(100% - 32px, 460px);
  margin: 12vh auto 0;
  padding: 30px;
}

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

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.empty-state {
  padding: 54px 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 850px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 640px) {
  .shell,
  .shell.wide {
    width: min(100% - 22px, 920px);
    padding-top: 18px;
  }

  .brandbar {
    margin-bottom: 34px;
  }

  .brand-subtle {
    display: none;
  }

  .grid-2,
  .comparison-grid,
  .form-grid,
  .metrics,
  .survey-list {
    grid-template-columns: 1fr;
  }

  .card-pad,
  .question {
    padding: 19px;
  }

  .actions .btn {
    width: 100%;
  }

  .top-actions .btn {
    width: auto;
  }
}
