:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #ebe9e3;
  --ink: #111114;
  --muted: #5e5d66;
  --line: rgba(17, 17, 20, 0.1);
  --accent: #ff5a36;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 90, 54, 0.12);
  --invert: #111114;
  --invert-ink: #f4f3ef;
  --danger: #d6331f;
  --ok: #1f8a5b;
  --focus: #ff5a36;
  --island: rgba(255, 255, 255, 0.72);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 24px 48px -28px rgba(17, 17, 20, 0.28);
  --radius: 28px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --surface: #151518;
    --surface-2: #1d1d21;
    --ink: #f4f3ef;
    --muted: #9b9aa3;
    --line: rgba(244, 243, 239, 0.1);
    --accent: #ff6a48;
    --accent-ink: #160805;
    --accent-soft: rgba(255, 106, 72, 0.14);
    --invert: #f4f3ef;
    --invert-ink: #111114;
    --danger: #ff7a66;
    --ok: #4fd39a;
    --island: rgba(21, 21, 24, 0.72);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 24px 48px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

/* ---------- island nav ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 16px 0;
}

.island {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: var(--island);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 800 21px/1 var(--sans);
  letter-spacing: -0.04em;
  text-decoration: none;
}
.logo { width: 32px; height: 20px; overflow: visible; }
.logo path { fill: none; stroke-width: 3; stroke-linecap: round; }
.logo .wave-a { stroke: var(--ink); }
.logo .wave-b { stroke: var(--accent); }
.brand:hover .logo path { animation: sway 1.2s ease-in-out; }
@keyframes sway {
  50% { transform: translateY(1px) scaleY(0.82); }
}
.logo path { transform-origin: center; transform-box: fill-box; }

#nav { display: flex; gap: 2px; }
#nav a {
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
#nav a:hover { color: var(--ink); }
#nav a[aria-current="page"] { background: var(--invert); color: var(--invert-ink); }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 16px 80px;
  outline: none;
}

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 16px 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* ---------- type ---------- */

h1, h2, h3 { font-family: var(--sans); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; }
h1 { font-size: clamp(44px, 7.4vw, 92px); margin: 18px 0 22px; }
h2 { font-size: clamp(30px, 4.2vw, 46px); margin: 0 0 10px; }
h3 { font-size: 22px; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }

.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 34em; margin: 0 0 30px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.accent { color: var(--accent); }

.mono-label, .eyebrow {
  font: 600 12px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 40px;
  align-items: center;
  min-height: min(76vh, 720px);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 600 13px/1 var(--mono);
  letter-spacing: 0.02em;
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 54, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(255, 90, 54, 0); }
}

.pool { margin: 22px 0 0; color: var(--muted); font-size: 15px; }
.pool b { color: var(--ink); font-variant-numeric: tabular-nums; }

.hero-visual {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 90, 54, 0.35), rgba(255, 90, 54, 0) 70%);
  filter: blur(20px);
}
.dial-card {
  position: relative;
  width: 66%;
  padding: 26px 26px 22px;
  border-radius: 36px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  display: grid;
  justify-items: center;
}
.dial-card .mono-label { justify-self: start; }
.dial-foot { display: flex; justify-content: space-between; width: 100%; margin-top: 18px; font-weight: 600; font-size: 14px; }

.float-chip {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--invert);
  color: var(--invert-ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: float 6s ease-in-out infinite;
}
.float-chip b { font-size: 22px; letter-spacing: -0.03em; }
.float-chip span { opacity: 0.7; }
.float-chip.c1 { top: 44%; left: 0; }
.float-chip.c2 { bottom: 26%; right: 0; animation-delay: -2s; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.float-chip.c3 { top: 9%; right: 4%; animation-delay: -4s; background: var(--accent); color: var(--accent-ink); }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------- score ring ---------- */

.ring {
  --size: 108px;
  --track: var(--surface-2);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0);
  display: grid;
  place-content: center;
  text-align: center;
  position: relative;
  flex-shrink: 0;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
}
.ring > * { position: relative; }
.ring strong { font-size: 24px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring span { font: 600 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 4px; }
.ring.xl { --size: min(62vw, 240px); }
.ring.xl::before { inset: 18px; }
.ring.xl strong { font-size: clamp(44px, 9vw, 64px); }
.ring.xl span { font-size: 11px; }
.ring.sm { --size: 68px; }
.ring.sm::before { inset: 6px; }
.ring.sm strong { font-size: 16px; }

/* ---------- bento ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
}
.tile {
  border-radius: var(--radius);
  padding: 26px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  min-height: 240px;
}
.tile p:last-child { margin-bottom: 0; }
.tile > p:not(.mono-label):not(.giant) { color: var(--muted); margin-top: auto; }
.t-five { grid-column: span 2; background: var(--invert); color: var(--invert-ink); }
.t-five .mono-label { color: inherit; opacity: 0.6; }
.t-five > p:not(.mono-label):not(.giant) { color: inherit; opacity: 0.75; }
.giant { font-size: 148px; font-weight: 800; letter-spacing: -0.07em; line-height: 0.85; margin: 8px 0 18px; color: var(--accent); }
.t-dist { grid-column: span 4; }
.dist { display: flex; align-items: flex-end; gap: 6px; height: 96px; margin: 4px 0 18px; }
.dist i { flex: 1; height: calc(var(--h) * 2.4%); min-height: 6px; border-radius: 6px 6px 3px 3px; background: var(--surface-2); }
.dist i.hot { background: var(--accent); }
.t-dist h3 { margin-bottom: 6px; }
.t-dist > p:last-child { margin-top: 0; }
.t-lock { grid-column: span 3; background: var(--surface-2); box-shadow: none; }
.cipher {
  font: 500 clamp(16px, 2vw, 21px)/1.4 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink);
  word-break: break-all;
  margin: 6px 0 20px;
}
.t-limits { grid-column: span 3; }
.tags { list-style: none; padding: 0; margin: 4px 0 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { padding: 8px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.t-tired {
  grid-column: span 6;
  min-height: 0;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
}
.t-tired h3 { font-size: clamp(24px, 3vw, 34px); max-width: 18em; margin-bottom: 10px; }
.t-tired p:not(.mono-label) { color: var(--muted); max-width: 40em; margin: 0; }
.t-tired .btn { flex-shrink: 0; }

/* ---------- buttons ---------- */

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

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  min-height: 48px;
  font: 700 16px/1.2 var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--invert);
  color: var(--invert-ink);
  transition: transform 160ms cubic-bezier(.3, .7, .4, 1.4), background 160ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.link { background: none; color: var(--muted); padding: 14px 4px; text-decoration: underline; text-underline-offset: 3px; }
.hero .actions .btn:not(.ghost), .match .actions .btn, .step-nav .btn[type="submit"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- survey ---------- */

.survey { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 56px; align-items: start; }

.rail {
  position: sticky;
  top: 96px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 0 0 18px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width 400ms cubic-bezier(.3, .7, .4, 1); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 12px; font-size: 14px; color: var(--muted); }
.steps .idx { font: 600 11px/1 var(--mono); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex-shrink: 0; }
.steps li.done { color: var(--ink); }
.steps li.done .idx { background: var(--accent-soft); color: var(--accent); }
.steps li.current { background: var(--invert); color: var(--invert-ink); font-weight: 700; }
.steps li.current .idx { background: var(--accent); color: var(--accent-ink); }

.survey-main { max-width: 720px; }
.survey-main > .lead { margin-bottom: 36px; }

.question {
  border: 0;
  margin: 0 0 14px;
  padding: 22px;
  min-width: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 160ms ease;
}
.question:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink); }
.question > legend, .question > label.q-label { display: block; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; margin: 0 0 4px; padding: 0; float: left; width: 100%; }
.question > legend + *, .question > label.q-label + * { clear: both; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.question.invalid { box-shadow: inset 0 0 0 1.5px var(--danger); }
.question.invalid > legend, .question.invalid > label.q-label { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; clear: both; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.chip:hover span { box-shadow: inset 0 0 0 1.5px var(--line); }
.chip input:checked + span { background: var(--invert); color: var(--invert-ink); font-weight: 650; }
.chip input:active + span { transform: scale(0.97); }
.chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Likert: one segmented track instead of five loose buttons */
.likert .chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.likert .chip span { display: flex; justify-content: center; text-align: center; height: 100%; padding: 10px 6px; border-radius: 12px; font-size: 13px; background: transparent; }
.likert .chip input:checked + span { background: var(--accent); color: var(--accent-ink); }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  max-width: 440px;
  margin-top: 12px;
  padding: 13px 16px;
  min-height: 48px;
  border-radius: 14px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font: 500 16px/1.4 var(--sans);
  clear: both;
  display: block;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; }
textarea { max-width: none; resize: vertical; min-height: 104px; font: 14px/1.5 var(--mono); }
.range-row { display: flex; gap: 12px; align-items: center; max-width: 440px; clear: both; }
.range-row input { max-width: 130px; display: inline-block; }

.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

.error-banner { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); padding: 14px 18px; border-radius: 16px; margin: 16px 0; font-weight: 600; }

/* ---------- persona, tips, matches ---------- */

.persona {
  position: relative;
  overflow: hidden;
  background: var(--invert);
  color: var(--invert-ink);
  border-radius: 36px;
  padding: clamp(28px, 5vw, 48px);
  margin: 0 0 18px;
}
.persona::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent), transparent);
  opacity: 0.55;
  filter: blur(10px);
}
.persona > * { position: relative; }
.persona .eyebrow { color: inherit; opacity: 0.6; }
.persona h2 { font-size: clamp(36px, 6vw, 64px); margin: 0 0 12px; }
.persona p:last-child { margin: 0; opacity: 0.8; max-width: 32em; font-size: 18px; }

.tips {
  margin: 0 0 56px;
  padding: 26px 28px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.tips h3 { font-size: 20px; margin-bottom: 12px; color: var(--accent); }
.tips ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tips li { padding-left: 26px; position: relative; }
.tips li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.first-question { grid-column: 1 / -1; margin: 0; padding: 18px 20px; background: var(--surface-2); border-radius: 18px; }
.first-question p { margin: 6px 0 0; font-size: 19px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.35; }

.match {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px 24px;
  padding: 26px;
  margin-top: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.match h3 { font-size: 26px; letter-spacing: -0.03em; }
.match .meta { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.score { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.bars { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; }
.bar label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.bar label span:last-child { font: 600 12px var(--mono); color: var(--ink); }
.bar .track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar .fill { height: 100%; border-radius: 3px; background: var(--accent); }

.match .actions { grid-column: 1 / -1; }

.empty { padding: 48px 28px; color: var(--muted); border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); margin-top: 14px; }

.code-box {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  border-radius: 20px;
  padding: 18px;
  word-break: break-all;
  font: 13px/1.6 var(--mono);
  margin: 18px 0;
}

.fingerprint { font: 700 15px var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.secret { background: var(--surface-2); padding: 14px 18px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-weight: 600; }

.status { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 7px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status.accepted { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.status.declined { opacity: 0.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--invert);
  color: var(--invert-ink);
  padding: 14px 22px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
  animation: toast-in 260ms cubic-bezier(.3, .7, .4, 1.3);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 24px; }
  .hero-visual { max-width: 420px; width: 100%; justify-self: center; }
  .survey { grid-template-columns: 1fr; gap: 24px; }
  .rail { position: static; padding: 16px 18px; }
  .rail .progress { margin-bottom: 0; }
  .steps { display: none; }
  .t-five, .t-dist, .t-lock, .t-limits { grid-column: span 6; }
  .t-five { min-height: 0; }
  .giant { font-size: 104px; }
}

@media (max-width: 560px) {
  main { padding-top: 24px; }
  .island { padding-left: 14px; }
  #nav a { padding: 8px 10px; font-size: 13px; }
  .likert .chips { grid-template-columns: 1fr; }
  .likert .chip span { justify-content: flex-start; padding: 12px 14px; }
  .match { grid-template-columns: 1fr auto; padding: 20px; }
  .t-tired { flex-direction: column; align-items: flex-start; }
  .question { padding: 18px; }
  .float-chip { padding: 10px 12px; }
  .float-chip b { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- accounts ---------- */

.auth { max-width: 520px; margin: 0 auto; }
.auth .question input { max-width: none; }

.alt-login { margin-top: 28px; padding: 18px 22px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.alt-login summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.alt-login[open] summary { margin-bottom: 14px; }

.consent { display: flex; gap: 14px; align-items: flex-start; padding: 18px 22px; border-radius: 22px; background: var(--accent-soft); margin: 4px 0 14px; cursor: pointer; }
.consent input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.consent a { color: var(--accent); font-weight: 700; }

.panel { padding: 24px 26px; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); margin-top: 14px; }
.panel h3 { margin-bottom: 8px; }
.panel > p { margin: 0 0 16px; }
.panel .question { padding: 0; box-shadow: none; background: none; }
.panel .question:focus-within { box-shadow: none; }

.footer a { color: var(--ink); }
