:root {
  --bg-top: #f3f6f3;
  --bg-bottom: #dce7df;
  --surface: #fffdf8;
  --surface-muted: #f4f7f3;
  --ink: #172126;
  --ink-soft: #3d4a52;
  --line: #ccd9d1;
  --accent: #1b5f6d;
  --accent-strong: #124450;
  --accent-soft: #dfeff2;
  --ok: #1d6b44;
  --danger: #9e2f2f;
  --shadow: 0 20px 45px rgba(20, 40, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  line-height: 1.6;
  position: relative;
}

.page-glow {
  position: fixed;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(10px);
}

.page-glow-a {
  top: -12rem;
  right: -8rem;
  background: radial-gradient(circle, rgba(27, 95, 109, 0.22) 0%, rgba(27, 95, 109, 0) 70%);
}

.page-glow-b {
  bottom: -14rem;
  left: -10rem;
  background: radial-gradient(circle, rgba(103, 148, 119, 0.24) 0%, rgba(103, 148, 119, 0) 72%);
}

.layout {
  width: min(980px, calc(100% - 2rem));
  margin: 2.2rem auto 3rem;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  padding: 1rem 1rem 1.6rem;
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.76rem;
}

.hero h1 {
  margin: 0.35rem auto 0;
  max-width: 32ch;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.8rem, 3.3vw, 2.65rem);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0.7rem auto 0;
  max-width: 62ch;
  color: var(--ink-soft);
}

.progress-block {
  width: min(560px, 100%);
  margin: 1.35rem auto 0;
}

.progress-text {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-align: left;
}

.progress-bar {
  width: 100%;
  height: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

#progressFill {
  display: block;
  width: 11%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #4f8d8f 100%);
  border-radius: inherit;
  transition: width 220ms ease;
}

.step {
  display: none;
  background: var(--surface);
  border: 1px solid rgba(204, 217, 209, 0.95);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2vw, 1.7rem);
}

.step.active {
  display: block;
  animation: reveal 360ms ease both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step > h2 {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
}

.step > p {
  margin-top: 0.5rem;
  color: var(--ink-soft);
}

.question {
  margin-top: 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
}

.question h3,
.question legend {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.question legend {
  padding: 0 0.25rem;
}

.question p {
  margin: 0.45rem 0 0;
}

.start-panel {
  text-align: center;
  background: linear-gradient(160deg, #f8fbff 0%, #ecf5f7 100%);
}

.option-list {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.58rem;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.option-row:hover {
  border-color: #9cb4aa;
  background: #f8fcfb;
  transform: translateY(-1px);
}

.option-row.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(27, 95, 109, 0.2);
}

.option-row input {
  accent-color: var(--accent);
}

.check-row {
  margin-top: 0.65rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.check-row input {
  margin-top: 0.22rem;
  accent-color: var(--accent);
}

.text-row {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.text-row input,
textarea,
input[type="text"] {
  width: 100%;
  font-family: inherit;
  font-size: 0.97rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 0.56rem 0.62rem;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input[type="text"]:focus,
textarea:focus {
  outline: 2px solid rgba(27, 95, 109, 0.2);
  border-color: var(--accent);
}

audio {
  width: 100%;
  margin-top: 0.62rem;
}

.dynamic-container {
  display: grid;
  gap: 0.9rem;
}

.stimulus-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 0.9rem;
}

.stimulus-card > h3 {
  margin: 0;
  font-size: 1rem;
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.pair-grid article {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
}

.pair-grid h3 {
  margin: 0;
  font-size: 1rem;
}

.scale-grid {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.38rem;
}

.scale-edge {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.scale-right {
  text-align: right;
}

.scale-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.scale-options label {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  min-height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.scale-options label:hover {
  border-color: #9cb4aa;
  background: #f8fcfb;
}

.scale-options label.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(27, 95, 109, 0.2);
}

.scale-options label.is-selected span {
  color: var(--accent-strong);
}

.scale-options input {
  position: absolute;
  opacity: 0;
}

.scale-options span {
  font-weight: 600;
  color: #304149;
}

.actions {
  margin-top: 1.05rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 0.63rem 1.04rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(18, 68, 80, 0.16);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent) 0%, #2f7c88 100%);
  color: #ffffff;
}

.btn-secondary {
  background: #edf4ef;
  color: #13333a;
  border: 1px solid #bad0c4;
}

.btn-large {
  padding: 0.86rem 1.5rem;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.status-text {
  margin: 0.62rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.status-text.ok {
  color: var(--ok);
  font-weight: 600;
}

.status-text.error {
  color: var(--danger);
  font-weight: 600;
}

.listen-gate-note {
  margin: 0.72rem 0 0;
  padding: 0.48rem 0.58rem;
  border: 1px solid #c7d7cd;
  border-radius: 10px;
  background: #f6fbf7;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.listen-gate-note.ok {
  border-color: rgba(29, 107, 68, 0.35);
  background: #eff8f1;
  color: var(--ok);
  font-weight: 600;
}

.validation-message {
  min-height: 1.3em;
  margin: 0.6rem 0 0;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.94rem;
}

.question.invalid,
.stimulus-card.invalid,
.audio-card.invalid {
  border-color: rgba(158, 47, 47, 0.64);
  box-shadow: 0 0 0 2px rgba(158, 47, 47, 0.11);
}

.gate-locked {
  border-style: dashed;
}

.gate-locked .option-row,
.gate-locked .scale-options label,
.gate-locked textarea,
.gate-locked input[type="text"] {
  opacity: 0.65;
}

.gate-locked .option-row,
.gate-locked .scale-options label {
  cursor: not-allowed;
}

.other-inline {
  margin-top: 0.62rem;
}

.fallback-panel {
  margin-top: 0.9rem;
  border: 1px solid rgba(158, 47, 47, 0.4);
  background: #fff4f4;
  border-radius: 12px;
  padding: 0.85rem;
}

@media (max-width: 820px) {
  .layout {
    width: min(980px, calc(100% - 1rem));
    margin-top: 1.25rem;
  }

  .step {
    border-radius: 16px;
    padding: 0.9rem;
  }

  .pair-grid {
    grid-template-columns: 1fr;
  }

  .scale-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scale-edge,
  .scale-right {
    text-align: left;
  }

  .actions {
    justify-content: stretch;
  }

  .btn {
    width: 100%;
  }
}
