:root {
  --bg: #eef4f7;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --line: rgba(13, 73, 98, 0.12);
  --text: #173145;
  --muted: #5c7181;
  --brand-deep: #0d4962;
  --brand: #15708d;
  --brand-soft: #d7eef3;
  --accent: #53c0cc;
  --success: #0f8b6a;
  --danger: #b84b5d;
  --warning: #b07618;
  --shadow: 0 28px 70px rgba(12, 44, 64, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(83, 192, 204, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(21, 112, 141, 0.18), transparent 24%),
    linear-gradient(180deg, #f8fcfd 0%, var(--bg) 100%);
  color: var(--text);
}

body {
  padding: 28px;
}

.shell {
  max-width: 1360px;
  margin: 0 auto;
}

.feedback {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  width: min(420px, calc(100vw - 32px));
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.feedback-invite,
.feedback-form {
  margin: 0;
}

.feedback-invite button {
  border-radius: 999px;
  padding: 14px 20px;
  box-shadow: 0 18px 40px rgba(12, 44, 64, 0.2);
}

.feedback-form {
  width: 100%;
  max-height: min(72vh, 640px);
  overflow: auto;
  background: var(--surface-strong);
}

.feedback-note {
  margin: 0;
  color: var(--muted);
}

.feedback-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 8px;
}

.feedback-field {
  display: block;
  margin-top: 16px;
}

.feedback-field textarea {
  width: 100%;
  margin-top: 8px;
}

.feedback-status {
  margin: 16px 0 0;
  font-weight: 700;
}

.feedback-status.success {
  color: var(--success);
}

.feedback-status.error {
  color: var(--danger);
}

.app-footer {
  margin-top: 28px;
  padding-bottom: 72px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.terms-panel {
  max-width: 820px;
  margin: 0 auto;
}

.terms-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terms-panel h2,
.terms-panel h3 {
  margin: 1.4rem 0 0.55rem;
}

.terms-panel h2 {
  margin-top: 0;
}

.terms-panel p {
  margin: 0 0 0.75rem;
  line-height: 1.55;
}

.terms-declare {
  align-items: flex-start;
  margin-top: 12px;
}

.terms-declare strong {
  display: block;
  margin-bottom: 4px;
}

.terms-error {
  margin-top: 16px;
  color: var(--danger);
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero:has(#references[hidden]) {
  grid-template-columns: 1fr;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.77rem;
}

.brand-logo {
  display: block;
  width: min(100px, 52vw);
  height: auto;
  margin-bottom: 18px;
}

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

h1 {
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  margin-bottom: 16px;
  max-width: 12ch;
}

.score-card {
  margin: 18px 0 8px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
}

.score-card h2,
.score-card p {
  margin: 0 0 8px;
}

.score-card p:last-child {
  margin-bottom: 0;
}

.thermo {
  --pos: 0%;
  --ink: #173145;
  margin: 18px 0 4px;
  padding: 16px 16px 14px;
  border-radius: 22px;
  color: white;
  background:
    radial-gradient(90% 80% at 0% 0%, rgba(226, 59, 102, 0.28), transparent 46%),
    radial-gradient(80% 90% at 100% 100%, rgba(61, 203, 134, 0.22), transparent 42%),
    linear-gradient(165deg, #0d4962 0%, #102838 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 18px 36px rgba(13, 73, 98, 0.16);
}

.thermo-axis,
.thermo-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.thermo-stage {
  position: relative;
  padding-top: 72px;
}

.thermo-track {
  position: relative;
  display: flex;
  height: 64px;
  overflow: hidden;
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    inset 0 10px 16px rgba(255, 255, 255, 0.22),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.thermo-band {
  height: 100%;
}

.band-short {
  width: 43.625%;
  background: linear-gradient(180deg, #ffc3d2 0%, #f19bb4 38%, #e23b66 100%);
}

.band-mid {
  width: 9.25%;
  background: linear-gradient(180deg, #fff0ae 0%, #f5e399 40%, #e5bd12 100%);
}

.band-long {
  width: 47.125%;
  background: linear-gradient(180deg, #dfffee 0%, #b7eed1 42%, #3dcb86 100%);
}

.thermo-sheen,
.thermo-rest,
.thermo-tick {
  position: absolute;
  pointer-events: none;
}

.thermo-sheen {
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 46%);
}

.thermo-rest {
  top: 0;
  bottom: 0;
  left: var(--pos);
  right: 0;
  background: rgba(16, 40, 56, 0.42);
  transition: left 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.thermo-tick {
  top: 8px;
  bottom: 8px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(23, 49, 69, 0.18);
}

.thermo-marker {
  position: absolute;
  top: 72px;
  left: var(--pos);
  width: 0;
  height: 64px;
  transition: left 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.thermo-pill {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  min-width: 92px;
  padding: 8px 12px 9px;
  border-radius: 14px;
  background: white;
  color: var(--ink);
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.thermo.is-start .thermo-pill {
  transform: none;
}

.thermo.is-end .thermo-pill {
  transform: translateX(-100%);
}

.thermo-pill strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.thermo-pill span {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.thermo-needle {
  position: absolute;
  top: -10px;
  bottom: 50%;
  left: 0;
  width: 2px;
  transform: translateX(-50%);
  background: white;
}

.thermo-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 7px var(--ink),
    0 0 22px var(--ink);
}

.thermo-axis {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.78);
}

.thermo-legend {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  font-weight: 800;
}

.thermo-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.swatch.short {
  background: #e23b66;
}

.swatch.mid {
  background: #e5bd12;
}

.swatch.long {
  background: #3dcb86;
}

@media (prefers-reduced-motion: reduce) {
  .thermo-rest,
  .thermo-marker {
    transition: none;
  }
}

.spider-link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 800;
}

.hero-copy {
  max-width: 56ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
}

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

.hero-card {
  border-radius: var(--radius-xl);
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(13, 73, 98, 0.96), rgba(21, 112, 141, 0.92)),
    var(--surface);
  color: white;
}

.hero-label {
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
}

.hero-list,
.clean-list,
.result-list {
  margin: 0;
  padding-left: 18px;
}

.hero-list li,
.clean-list li,
.result-list li {
  margin-bottom: 10px;
  line-height: 1.55;
}

.hero-card .hero-list {
  padding-left: 20px;
}

.hero-card .hero-list li {
  margin-bottom: 14px;
  font-size: 0.93rem;
  line-height: 1.5;
}

.hero-card a {
  color: rgba(255, 255, 255, 0.92);
}

.layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 24px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.section + .section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 6px;
  font-size: 1.18rem;
}

.section-head p,
.result-summary,
.info-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.fields {
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: end;
}

.grid + .grid,
.pill-grid + .grid {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 9px;
  font-size: 0.95rem;
  font-weight: 600;
}

label span {
  display: block;
}

input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid rgba(13, 73, 98, 0.14);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(83, 192, 204, 0.28);
  border-color: var(--brand);
}

.check,
.pill-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

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

.alert-check {
  background: rgba(184, 75, 93, 0.09);
  border-color: rgba(184, 75, 93, 0.22);
}

.required-check {
  align-items: flex-start;
  background: rgba(176, 118, 24, 0.1);
  border-color: rgba(176, 118, 24, 0.4);
}

.required-check input {
  margin-top: 3px;
}

.required-check:has(input:checked) {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
}

.course-note {
  display: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
}

.required-note {
  display: block;
  margin-top: 4px;
  color: var(--warning);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.required-check:has(input:checked) .required-note {
  color: var(--muted);
  font-weight: 500;
}

.age-field.is-invalid input,
.check.is-invalid,
[data-field].is-invalid > select,
[data-field].is-invalid > input,
[data-field].is-invalid .pill-check {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(184, 75, 93, 0.18);
}

[data-field="sex"] > span {
  font-weight: 600;
}

.form-errors {
  margin: 18px 0 0;
  padding: 14px 16px 14px 34px;
  border: 1px solid rgba(184, 75, 93, 0.35);
  border-radius: var(--radius-md);
  background: rgba(184, 75, 93, 0.08);
  color: var(--danger);
  font-weight: 700;
}

.form-errors li + li {
  margin-top: 6px;
}

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

.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.primary {
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: white;
  box-shadow: 0 16px 28px rgba(13, 73, 98, 0.22);
}

.secondary,
.ghost {
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-deep);
  border: 1px solid rgba(13, 73, 98, 0.12);
}

.result-panel {
  position: sticky;
  top: 28px;
  align-self: start;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 18px;
}

.result-badge.pending {
  background: rgba(176, 118, 24, 0.12);
  color: var(--warning);
}

.result-badge.success {
  background: rgba(15, 139, 106, 0.12);
  color: var(--success);
}

.result-badge.danger {
  background: rgba(184, 75, 93, 0.12);
  color: var(--danger);
}

.result-badge.caution {
  background: rgba(13, 73, 98, 0.12);
  color: var(--brand-deep);
}

.result-block + .result-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.result-list.muted li {
  color: var(--muted);
}

.info-panel {
  margin-top: 24px;
}

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

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

@media (max-width: 1080px) {
  .hero,
  .layout,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  .feedback {
    right: 16px;
    bottom: 16px;
  }

  .app-footer {
    padding-bottom: 104px;
  }

  .panel,
  .hero-card {
    padding: 18px;
    border-radius: 22px;
  }

  .grid.two,
  .grid.fields,
  .pill-grid,
  .actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .course-note:not([hidden]) {
    display: block;
  }

  h1 {
    max-width: none;
  }
}
