:root {
  color-scheme: light;
  --ink: #15202a;
  --muted: #5f6e7a;
  --line: rgba(21, 32, 42, 0.14);
  --panel: rgba(255, 255, 255, 0.93);
  --panel-strong: #ffffff;
  --sky: #dff1ff;
  --runway: #2e3c43;
  --brand: #0f6b78;
  --brand-dark: #094852;
  --accent: #d38b2d;
  --success: #167457;
  --danger: #a33c32;
  --shadow: 0 24px 80px rgba(15, 42, 55, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #eef8ff 0%, #ffffff 58%, #edf3f1 100%);
}

button,
input {
  font: inherit;
}

textarea,
select {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
}

.quiz-hero {
  position: relative;
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.quiz-hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(90deg, rgba(244, 250, 255, 0.96) 0%, rgba(244, 250, 255, 0.82) 43%, rgba(244, 250, 255, 0.34) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(18, 37, 45, 0.18) 100%);
}

.hero-content {
  width: min(720px, calc(100% - 32px));
  margin: 0;
  padding: clamp(28px, 5vw, 68px) 0 clamp(28px, 5vw, 72px) clamp(16px, 6vw, 88px);
  align-self: center;
}

.brand-logo {
  display: block;
  width: min(216px, 58vw);
  height: auto;
  margin: 0 0 20px;
}

h1 {
  max-width: 12ch;
  margin: 0;
  color: #10212a;
  font-size: clamp(2.4rem, 5vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro {
  max-width: 580px;
  margin: 22px 0 26px;
  color: #31444f;
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.6;
}

.status-bar {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  margin-bottom: 14px;
  color: #31444f;
  font-size: 0.92rem;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 33, 42, 0.14);
}

.progress-track span {
  display: block;
  width: 14%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 180ms ease;
}

.quiz-panel,
.result-panel {
  max-width: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.result-panel {
  max-height: min(74vh, 780px);
  overflow: auto;
}

.quiz-panel {
  padding: clamp(18px, 3vw, 28px);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 18px;
  color: #10212a;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 800;
  line-height: 1.25;
}

.qualifier-group + .qualifier-group {
  margin-top: 24px;
}

.qualifier-group legend {
  margin-bottom: 10px;
  font-size: 1.02rem;
}

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

.answers.compact {
  gap: 8px;
}

.answer-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 58px;
  padding: 15px 16px;
  border: 1px solid rgba(21, 32, 42, 0.15);
  border-radius: 8px;
  background: var(--panel-strong);
  color: #243743;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.answers.compact .answer-option {
  min-height: 48px;
  padding: 12px 14px;
}

.answer-option:hover {
  border-color: rgba(15, 107, 120, 0.5);
  box-shadow: 0 10px 26px rgba(21, 32, 42, 0.08);
  transform: translateY(-1px);
}

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

.answer-option:has(input:checked) {
  border-color: var(--brand);
  background: #edf9f8;
  box-shadow: inset 0 0 0 1px rgba(15, 107, 120, 0.24);
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 12px 26px rgba(15, 107, 120, 0.22);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(15, 107, 120, 0.24);
}

.secondary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.result-panel {
  padding: clamp(22px, 4vw, 34px);
}

.result-kicker {
  margin: 0 0 10px;
  color: var(--success);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.result-panel h2 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.result-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.result-panel.fail .result-kicker {
  color: var(--danger);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.booking-email-label {
  display: grid;
  gap: 8px;
  color: #31444f;
  font-size: 0.95rem;
  font-weight: 800;
}

.booking-email-label input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(21, 32, 42, 0.16);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--ink);
  background: #ffffff;
}

.admin-page {
  min-height: 100vh;
  background: #f4f8f9;
}

.admin-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.admin-login-panel {
  width: min(440px, 100%);
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 42, 55, 0.14);
}

.admin-login-panel h1 {
  max-width: none;
  margin-bottom: 22px;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.admin-login-form {
  display: grid;
  gap: 14px;
}

.admin-login-form label {
  display: grid;
  gap: 7px;
  color: #31444f;
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-login-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(21, 32, 42, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 248, 249, 0.94);
  backdrop-filter: blur(18px);
}

.admin-header > div {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.admin-logo {
  width: 148px;
  height: auto;
}

.admin-header h1 {
  max-width: none;
  font-size: clamp(1.45rem, 3vw, 2.5rem);
  line-height: 1;
}

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

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-stats article,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 48px rgba(15, 42, 55, 0.08);
}

.admin-stats article {
  padding: 18px;
}

.admin-stats span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-stats strong {
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.admin-panel {
  padding: clamp(18px, 3vw, 28px);
}

.admin-panel + .admin-panel {
  margin-top: 18px;
}

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

.admin-section-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.1;
}

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

.funnel-list {
  display: grid;
  gap: 12px;
}

.funnel-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(21, 32, 42, 0.1);
  border-radius: 8px;
  background: #f9fbfb;
}

.funnel-row.is-empty {
  opacity: 0.55;
}

.funnel-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #31444f;
  font-size: 0.94rem;
}

.funnel-row-head span {
  white-space: nowrap;
  font-weight: 900;
}

.funnel-bar {
  height: 16px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(21, 32, 42, 0.1);
}

.funnel-bar span {
  display: block;
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.funnel-row p,
.admin-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-note {
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-form label,
.editor-card label {
  display: grid;
  gap: 7px;
  color: #31444f;
  font-size: 0.88rem;
  font-weight: 800;
}

.admin-form input,
.editor-card input,
.editor-card textarea,
.editor-card select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(21, 32, 42, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

.editor-card textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.45;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.editor-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(21, 32, 42, 0.12);
  border-radius: 8px;
  background: #f9fbfb;
}

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

.editor-card h3 {
  margin: 0;
  font-size: 1rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(163, 60, 50, 0.22);
  border-radius: 8px;
  color: var(--danger);
  background: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

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

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 34px;
  align-items: end;
  gap: 10px;
}

.small-button {
  justify-self: start;
  min-height: 40px;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(163, 60, 50, 0.25);
}

.submission-table-wrap {
  overflow-x: auto;
}

.submission-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.submission-table th,
.submission-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(21, 32, 42, 0.1);
  text-align: left;
  vertical-align: top;
}

.submission-table th {
  color: #31444f;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.save-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--success);
  box-shadow: 0 16px 42px rgba(22, 116, 87, 0.28);
  font-weight: 900;
}

@media (max-width: 760px) {
  .quiz-hero {
    min-height: auto;
  }

  .quiz-hero::after {
    background:
      linear-gradient(180deg, rgba(244, 250, 255, 0.9) 0%, rgba(244, 250, 255, 0.98) 46%, rgba(244, 250, 255, 0.88) 100%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(18, 37, 45, 0.12));
  }

  .hero-content {
    width: calc(100% - 24px);
    padding: 28px 0 34px;
    margin: 0 auto;
  }

  h1 {
    max-width: 9ch;
  }

  .intro {
    margin-bottom: 18px;
  }

  .status-bar {
    grid-template-columns: auto 1fr;
  }

  #scoreText {
    grid-column: 1 / -1;
  }

  .quiz-actions,
  .result-actions {
    flex-direction: column-reverse;
  }

  .result-panel {
    max-height: none;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .admin-header,
  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-header > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .admin-logo {
    width: 132px;
  }

  .admin-nav,
  .admin-actions {
    width: 100%;
  }

  .admin-stats,
  .admin-form,
  .answer-grid,
  .option-row {
    grid-template-columns: 1fr;
  }

  .option-row {
    align-items: stretch;
  }

  .icon-button {
    justify-self: end;
  }
}
