/* ============================================================
   How has God wired me? — Innowake Asia
   Evening-ink ground, six stained-glass gifts, one brass light.
   ============================================================ */

:root {
  --ink:        #0E1626;
  --ink-lift:   #16223A;
  --ink-edge:   #223052;
  --vellum:     #F2EDE3;
  --muted:      #94A2BA;
  --muted-dim:  #6C7B96;
  --brass:      #DFB55C;
  --line:       rgba(242, 237, 227, 0.13);
  --line-soft:  rgba(242, 237, 227, 0.07);

  --pad: 22px;
  --radius: 15px;
  --ease: cubic-bezier(0.22, 0.68, 0.32, 1);

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--vellum);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Desktop: hold the phone column in the middle of a lit room. */
.frame {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(120% 70% at 50% -10%, #1A2743 0%, var(--ink) 62%);
  }
  .frame {
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
  }
}

.stage { display: block; }

/* ---------- screen scaffold ---------- */

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding:
    max(20px, env(safe-area-inset-top)) var(--pad)
    max(28px, env(safe-area-inset-bottom)) var(--pad);
}

.screen--scroll { min-height: 100dvh; height: auto; }

/* Keep each statement inside the phone's currently visible viewport. */
.screen--question {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.screen > .grow { flex: 1 1 auto; }

.fade-in { animation: fade 0.36s var(--ease) both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

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

.display {
  font-size: clamp(2.25rem, 11vw, 3.05rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0;
}

.lede {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  max-width: 34ch;
}

.h2 {
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}

.h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}

.small { font-size: 0.875rem; line-height: 1.5; color: var(--muted); margin: 0; }
.tiny  { font-size: 0.78125rem; line-height: 1.45; color: var(--muted-dim); margin: 0; }

.count {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted-dim);
}

/* ---------- cover ---------- */

.cover-threads {
  display: block;
  width: 100%;
  aspect-ratio: 320 / 126;
  max-height: 170px;
  margin: 2px 0 30px;
}

.thread {
  fill: none;
  stroke-width: 2.25;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: draw 1.5s var(--ease) forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.verse {
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--brass);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 300;
  font-style: italic;
  color: var(--vellum);
}

.verse cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--brass);
}

/* ---------- progress stitches ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 14px;
}

.stitches {
  display: flex;
  gap: 3px;
  margin-bottom: 30px;
}

.stitch {
  flex: 1 1 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line-soft);
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.stitch.is-done { background: var(--stitch-hue); }

.stitch.is-now {
  background: var(--brass);
  transform: scaleY(1.75);
}

/* ---------- statement + options ---------- */

.statement {
  font-size: clamp(1.5rem, 6.6vw, 1.9375rem);
  line-height: 1.24;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin: 0 0 34px;
  text-wrap: balance;
}

.options { display: flex; flex-direction: column; gap: 9px; }

/* Short phones need a denser rhythm so the final choice remains easy to tap. */
@media (max-height: 740px) {
  .screen--question {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .screen--question .topbar {
    min-height: 28px;
    margin-bottom: 8px;
  }

  .screen--question .stitches { margin-bottom: 18px; }

  .screen--question .statement {
    font-size: clamp(1.3rem, 5.8vw, 1.7rem);
    margin-bottom: 18px;
  }

  .screen--question .options {
    gap: 7px;
    margin-bottom: 8px;
  }

  .screen--question .opt {
    min-height: 54px;
    padding: 12px 14px;
  }
}

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(242, 237, 227, 0.022);
  color: var(--vellum);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.opt:hover { border-color: rgba(242, 237, 227, 0.28); }

.opt:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.opt[aria-pressed='true'] {
  border-color: var(--hue);
  background: var(--hue-soft);
}

/* the meter says how much of "like me" this option is */
.meter { display: flex; gap: 3px; flex: 0 0 auto; }

.meter i {
  display: block;
  width: 5px;
  height: 15px;
  border-radius: 2px;
  background: var(--line);
}

.meter i.on { background: var(--hue); }

.opt[aria-pressed='true'] .meter i { background: rgba(14, 22, 38, 0.28); }
.opt[aria-pressed='true'] .meter i.on { background: var(--hue); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 15px 22px;
  border: 0;
  border-radius: 13px;
  background: var(--brass);
  color: #16130A;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.18s var(--ease);
}

.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--vellum); outline-offset: 3px; }
.btn:disabled { opacity: 0.55; cursor: default; filter: none; }

.btn--quiet {
  background: transparent;
  color: var(--vellum);
  border: 1px solid var(--line);
}

.btn--quiet:hover { background: rgba(242, 237, 227, 0.05); filter: none; }

.linkbtn {
  border: 0;
  background: none;
  padding: 6px 2px;
  margin: -6px -2px;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.linkbtn:hover { color: var(--vellum); }
.linkbtn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }
.linkbtn[hidden] { display: none; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }

/* ---------- scale primer ---------- */

.scale-list { display: flex; flex-direction: column; margin: 28px 0 0; padding: 0; list-style: none; }

.scale-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 2px;
  border-bottom: 1px solid var(--line-soft);
  --hue: var(--brass);
}

.scale-row:first-child { border-top: 1px solid var(--line-soft); }
.scale-row span:first-of-type { flex: 1 1 auto; }

.scale-row b {
  flex: 0 0 22px;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brass);
}

.scale-row span { font-size: 1rem; font-weight: 500; }

/* ---------- results ---------- */

.top-card {
  position: relative;
  padding: 20px 20px 20px 22px;
  border-radius: var(--radius);
  background: var(--ink-lift);
  overflow-y: auto;
}

.top-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--hue);
}

.top-card + .top-card { margin-top: 12px; }

.top-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.top-card-title { min-width: 0; }

.top-person {
  display: flex;
  flex: 0 0 88px;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.top-portrait,
.profile-portrait {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
  border: 2px solid var(--hue);
  background: var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.top-portrait {
  width: 88px;
  height: 88px;
}

.rank {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted-dim);
  margin: 0 0 6px;
}

.top-name {
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--hue);
  margin: 0;
}

.top-character { font-size: 0.9375rem; font-weight: 600; color: var(--vellum); margin: 9px 0 0; }

.top-score {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.top-looks { font-size: 0.9375rem; line-height: 1.5; color: var(--muted); margin: 16px 0 12px; }

.parallels { display: flex; flex-wrap: wrap; gap: 6px; }

.parallels span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

/* full six-score chart */

.chart { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }

.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }

.bar-name { font-size: 0.9375rem; font-weight: 600; }
.bar-name em { font-style: normal; font-weight: 400; color: var(--muted-dim); }

.bar-score { font-size: 0.875rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }

.bar-track {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 4px;
  background: var(--line-soft);
  overflow-y: auto;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--hue);
  transform-origin: left;
  animation: grow 0.7s var(--ease) both;
}

@keyframes grow { from { transform: scaleX(0); } }

/* section rhythm */

.section { margin-top: 40px; }
.section > * + * { margin-top: 14px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

/* ---------- reflect ---------- */

.reflect-field { display: block; margin-top: 22px; }

.reflect-prompt {
  display: block;
  font-size: 1.0625rem;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}

.reflect-input {
  display: block;
  width: 100%;
  min-height: 108px;
  overflow-y: auto;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(242, 237, 227, 0.022);
  color: var(--vellum);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}

.reflect-input::placeholder { color: var(--muted-dim); }

.reflect-input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
  border-color: transparent;
}

/* ---------- all six profiles ---------- */

.profiles-section { border-top: 1px solid var(--line-soft); }

.profiles-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 0;
  color: var(--vellum);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.profiles-disclosure > summary::-webkit-details-marker { display: none; }

.profiles-disclosure > summary:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 5px;
  border-radius: 4px;
}

.disclosure-icon {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: border-color 0.18s var(--ease), transform 0.3s var(--ease);
}

.disclosure-icon::before,
.disclosure-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--brass);
  transform: translate(-50%, -50%);
}

.disclosure-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.profiles-disclosure[open] .disclosure-icon { transform: rotate(45deg); }
.profiles-disclosure > summary:hover .disclosure-icon { border-color: rgba(242, 237, 227, 0.3); }

.profiles-content { padding: 2px 0 8px; }

.profiles-intro {
  max-width: 42ch;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.profile-list { display: flex; flex-direction: column; gap: 12px; }

.profile-card {
  position: relative;
  padding: 18px 18px 19px 21px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(242, 237, 227, 0.022);
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--hue);
}

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

.profile-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.profile-portrait {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
}

.profile-kicker,
.profile-label,
.profile-character span,
.profile-score span {
  margin: 0;
  color: var(--muted-dim);
  font-size: 0.6875rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.profile-title {
  margin: 3px 0 0;
  color: var(--hue);
  font-size: 1.25rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.profile-score { text-align: right; }
.profile-score span { display: block; }

.profile-score strong {
  display: block;
  margin-top: 3px;
  color: var(--vellum);
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.profile-score-track {
  height: 5px;
  margin-top: 13px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
}

.profile-score-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--hue);
  transform-origin: left;
  animation: grow 0.7s var(--ease) both;
}

.profile-character {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
}

.profile-character strong {
  color: var(--vellum);
  font-size: 0.875rem;
  line-height: 1.3;
  font-weight: 600;
  text-align: right;
}

.profile-detail { margin-top: 15px; }
.profile-detail .small { margin-top: 5px; }
.profile-detail .parallels { margin-top: 0; }

@media (max-width: 359px) {
  .top-card-head { gap: 12px; }
  .top-name { font-size: 1.7rem; }
  .top-person { flex-basis: 74px; }
  .top-portrait { width: 74px; height: 74px; }
  .profile-card-head { gap: 12px; }
  .profile-identity { gap: 9px; }
  .profile-portrait { flex-basis: 46px; width: 46px; height: 46px; }
}

/* ---------- footer / brand ---------- */

.brand {
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.brand-logo { width: 176px; height: auto; opacity: 0.92; }

.brand .brand-logo-link {
  display: block;
  border-bottom: 0;
  line-height: 0;
}

.brand .brand-logo-link:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 5px;
  border-radius: 4px;
}

.brand-line {
  margin: -4px 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--muted-dim);
}

.brand a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.brand a:hover { color: var(--vellum); }

.note {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted-dim);
  margin: 0;
  text-align: center;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 12px;
  background: var(--vellum);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  animation: rise 0.3s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .thread { stroke-dashoffset: 0; }
}
