:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #647087;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --line: #dce3ee;
  --brand: #155eef;
  --brand-dark: #1048b8;
  --success: #147d64;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warning-bg: #fff8e6;
  --warning-line: #e8c765;
  --shadow: 0 12px 34px rgba(23, 32, 51, 0.08);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f9fc 0, #eef3f8 100%);
  line-height: 1.65;
}

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

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

a {
  color: var(--brand);
}

.container {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 227, 238, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.header-row {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.015em;
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.language-switch button {
  border: 0;
  border-radius: 7px;
  padding: 6px 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.language-switch button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.12);
}

.landing,
.survey-shell {
  padding-block: 52px 80px;
}

.hero {
  max-width: 700px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0 0 10px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.hero > p:last-child,
.survey-description {
  color: var(--muted);
  font-size: 1.06rem;
}

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

.questionnaire-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.questionnaire-card {
  min-height: 320px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

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

.card-tag {
  margin: 0 0 24px;
  font-size: 0.86rem;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 18px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button.primary {
  color: white;
  background: var(--brand);
}

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

.button.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.survey-shell {
  max-width: 900px;
}

.panel {
  padding: clamp(22px, 5vw, 44px);
}

.notice {
  border: 1px solid var(--warning-line);
  border-radius: 11px;
  padding: 12px 15px;
  background: var(--warning-bg);
}

.notice.error {
  color: var(--danger);
  border-color: #f1b7b2;
  background: var(--danger-bg);
}

.start-summary {
  color: var(--muted);
  font-size: 1.04rem;
}

.start-meta {
  margin: 18px 0;
}

.research-use-notice {
  margin: 24px 0;
  font-weight: 650;
}

.field {
  margin-bottom: 22px;
}

.field > label,
.field legend {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.field input[type="email"],
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #bcc7d8;
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--ink);
  background: white;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(21, 94, 239, 0.16);
  border-color: var(--brand);
}

.field-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row,
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 13px 0;
  cursor: pointer;
}

.check-row input,
.radio-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: var(--brand);
}

#start-form > .button {
  margin-top: 20px;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.survey-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.survey-heading h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.save-state {
  min-width: 110px;
  padding-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.progress-track {
  width: 100%;
  height: 7px;
  margin-top: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6f1;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 180ms ease;
}

.progress-text {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.question-card h2 {
  margin-bottom: 24px;
}

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

.comparison-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: var(--surface-soft);
}

.comparison-item h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.sequence-text {
  max-height: 390px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
}

.comparison-item video {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #0d1320;
}

.video-hint {
  margin: -12px 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.choice-box {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.other-field {
  margin: 8px 0 0 28px;
}

.survey-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.complete-panel {
  padding-block: 70px;
  text-align: center;
}

.complete-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--success);
  font-size: 2rem;
  font-weight: 800;
}

.complete-panel .button {
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

.button.compact {
  min-height: 38px;
  padding: 6px 13px;
}

.admin-login-shell {
  width: min(100% - 32px, 460px);
  min-height: 100vh;
  margin-inline: auto;
  display: grid;
  place-items: center;
  padding-block: 40px;
}

.admin-login-panel {
  width: 100%;
}

.admin-login-panel h1 {
  font-size: 2.2rem;
}

.admin-login-form {
  margin-top: 26px;
}

.admin-login-form .button {
  width: 100%;
}

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

.admin-container {
  width: min(100% - 32px, 1500px);
  margin-inline: auto;
  padding-block: 42px 72px;
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-heading h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.admin-notice {
  margin-bottom: 20px;
  border-color: #91d5c5;
  background: #effbf7;
  color: #0d624f;
}

.statistics-panel {
  margin-bottom: 24px;
  padding: 24px;
}

.statistics-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.statistics-heading h2,
.statistics-panel h3 {
  margin: 0;
}

.statistics-panel > h3 {
  margin: 24px 0 10px;
}

.statistics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.statistics-cards article {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.statistics-cards strong {
  color: var(--brand-dark);
  font-size: 1.45rem;
}

.statistics-cards span {
  color: var(--muted);
  font-size: 0.86rem;
}

.statistics-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(620px, 1.5fr);
  gap: 24px;
}

.statistics-grid h3 {
  margin-bottom: 10px;
}

.compact-table,
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.compact-table th,
.compact-table td,
.heatmap-table th,
.heatmap-table td {
  padding: 8px 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compact-table th,
.heatmap-table th {
  background: var(--surface-soft);
  color: var(--muted);
  white-space: nowrap;
}

.heatmap-wrap {
  overflow-x: auto;
}

.heatmap-table {
  min-width: 620px;
  table-layout: fixed;
}

.heatmap-table td {
  text-align: center;
  font-weight: 750;
}

.heatmap-table small {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.75;
}

.heat-diagonal,
.heat-empty {
  color: var(--muted);
  background: #f2f4f7;
}

.heat-0 { background: #fff1f0; }
.heat-1 { background: #ffe6e3; }
.heat-2 { background: #ffd6d1; }
.heat-3 { background: #ffc4bd; }
.heat-4 { background: #fff0cf; }
.heat-5 { background: #fff8e6; }
.heat-6 { background: #e7f7ee; }
.heat-7 { background: #d1efdf; }
.heat-8 { background: #b8e5cd; }
.heat-9 { background: #91d5b2; }
.heat-10 { background: #65c18c; }

.subgroup-details {
  margin-top: 20px;
}

.subgroup-details summary {
  margin-bottom: 10px;
  color: var(--brand);
  font-weight: 750;
  cursor: pointer;
}

.admin-filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 22px;
}

.admin-filters .field {
  min-width: 190px;
  margin: 0;
}

.admin-table-panel {
  padding: 0;
  overflow: hidden;
}

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

.admin-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 750;
  white-space: nowrap;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.excluded-row {
  background: #fff8f7;
}

.repeat-badge {
  display: block;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #825b00;
  background: var(--warning-bg);
  font-size: 0.72rem;
  font-weight: 700;
}

.admin-email {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.submitted {
  color: var(--success);
  background: #eaf8f3;
}

.status-badge.draft {
  color: #825b00;
  background: var(--warning-bg);
}

.response-details {
  min-width: 320px;
}

.response-details summary {
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.response-details code {
  overflow-wrap: anywhere;
}

.response-details h3 {
  margin: 18px 0 8px;
}

.answer-list {
  margin: 0;
  padding-left: 24px;
}

.answer-list li {
  margin-bottom: 7px;
}

.answer-reason {
  color: var(--muted);
  white-space: pre-wrap;
}

.admin-demographics {
  margin: 0;
}

.admin-demographics > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 4px 0;
}

.admin-demographics dt {
  color: var(--muted);
}

.admin-demographics dd {
  margin: 0;
}

.result-action-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.result-action-form label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.result-action-form input,
.result-action-form textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.result-action-form textarea {
  min-height: 78px;
  resize: vertical;
}

.danger-zone {
  border-color: #f1b7b2;
  background: var(--danger-bg);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.admin-empty {
  padding-block: 42px !important;
  color: var(--muted);
  text-align: center !important;
}

.admin-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}

.admin-pagination > :last-child {
  justify-self: end;
}

@media (max-width: 700px) {
  .questionnaire-grid,
  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .landing,
  .survey-shell {
    padding-block: 32px 56px;
  }

  .site-header {
    position: static;
  }

  .header-row {
    min-height: 76px;
  }

  .survey-heading {
    display: block;
  }

  .save-state {
    min-height: 25px;
    padding: 0;
    text-align: left;
  }

  .survey-actions .button {
    flex: 1;
  }

  .admin-heading,
  .admin-filters,
  .statistics-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .admin-heading .button,
  .admin-filters .button,
  .admin-filters .field {
    width: 100%;
  }
}
