:root {
  color-scheme: light;
  --ink: #29232d;
  --muted: #6f6672;
  --cream: #fffaf5;
  --paper: rgba(255, 252, 248, 0.94);
  --purple: #6f4a7e;
  --purple-deep: #4f315c;
  --purple-soft: #f0e7f2;
  --wood: #9d6f4c;
  --line: rgba(79, 49, 92, 0.16);
  --shadow: 0 24px 70px rgba(35, 22, 17, 0.3);
  --screen-heading-size: clamp(22px, 5.7vw, 27px);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  background: #302622;
}

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

.room {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #d9c4b2 0%, #efe4d7 52%, #cdb29b 100%);
}

.room::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(31,24,28,.08), rgba(31,24,28,.24));
}

.app-shell {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(90deg, rgba(31,22,19,.12), transparent 52%);
}

.quiz-card {
  width: min(100%, 520px);
  height: min(680px, calc(100svh - 28px));
  min-height: min(560px, calc(100svh - 28px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: clamp(18px, 4.2vw, 30px);
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 26px;
  background: var(--paper);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.brand-row, .progress-meta, .controls { display: flex; align-items: center; justify-content: space-between; }

.wordmark { color: var(--ink); text-decoration: none; line-height: 1.05; }
.brand-name { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; }
.brand-place { display: block; margin-top: 5px; color: var(--muted); font-family: "Newsreader", serif; font-size: 13px; }

.time-pill {
  padding: 7px 11px;
  border: 1px solid rgba(109,76,125,.2);
  border-radius: 999px;
  color: var(--purple-deep);
  background: var(--purple-soft);
  font-size: 12px;
  font-weight: 600;
}

.progress-wrap { display: grid; gap: 7px; }
.progress-meta { color: var(--muted); font-size: 11px; font-weight: 500; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #e8dfd4; }
.progress-bar { width: 25%; height: 100%; border-radius: inherit; background: var(--purple); transition: width .35s ease; }

.screen {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: rise .28s ease both;
}

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

h1 {
  margin: 0;
  max-width: 430px;
  font-family: "Newsreader", Georgia, serif;
  font-size: var(--screen-heading-size);
  line-height: 1.03;
  letter-spacing: -.02em;
}

.supporting {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.choices {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 2px;
  scrollbar-width: thin;
}

.question-screen .choices {
  overflow-y: visible;
  gap: 5px;
}

.question-screen h1 {
  font-size: var(--screen-heading-size);
  line-height: 1.04;
}

.question-screen .supporting { margin: 5px 0 8px; }

.question-screen .choice {
  min-height: 40px;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.24;
}

.question-screen .choice-check {
  flex-basis: 22px;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 13px;
}

.priority-screen .choices { grid-template-columns: 1fr; }

.priority-screen .choice {
  min-height: 48px;
  gap: 7px;
  padding: 5px 7px;
  font-size: 12px;
}

.priority-screen .choice-check {
  flex-basis: 20px;
  width: 20px;
  height: 20px;
}

.choices.concern-grid { grid-template-columns: 1fr 1fr; }

.selection-count {
  align-self: flex-start;
  margin: -5px 0 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--purple-deep);
  background: var(--purple-soft);
  font-size: 11px;
  font-weight: 600;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255,255,255,.75);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.choice:hover { border-color: rgba(109,76,125,.45); transform: translateY(-1px); }
.choice:focus-visible { outline: 3px solid rgba(109,76,125,.22); outline-offset: 2px; }
.choice.selected { border-color: var(--purple); background: var(--purple-soft); box-shadow: inset 0 0 0 1px var(--purple); }

.choice-check {
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(111,74,126,.28);
  border-radius: 8px;
  color: var(--purple);
  background: rgba(255,255,255,.72);
  font-size: 15px;
  font-weight: 700;
}

.choice.selected .choice-check { color: #fff; border-color: var(--purple); background: var(--purple); }

.choice-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 29px; height: 29px;
  border-radius: 9px;
  color: var(--purple-deep);
  background: #f1e8f2;
  font-size: 15px;
}

.choice.selected .choice-icon { color: white; background: var(--purple); }

.controls { gap: 10px; padding-top: 1px; }
.button {
  min-height: 49px;
  padding: 0 20px;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.button:active { transform: scale(.98); }
.button-ghost { border: 1px solid var(--line); color: var(--muted); background: transparent; }
.button-primary { flex: 1; border: 1px solid var(--purple); color: white; background: var(--purple); box-shadow: 0 8px 18px rgba(89,59,103,.2); }
.button-primary:hover { background: var(--purple-deep); }
.button:disabled { cursor: default; opacity: .38; box-shadow: none; }

.result-screen { overflow-y: auto; padding-right: 4px; }
.result-heading { display: grid; gap: 5px; }
.result-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  color: white;
  background: var(--purple);
  font-family: "Newsreader", serif;
  font-size: 23px;
}

.result-heading h1 { font-size: var(--screen-heading-size); }
.result-lead {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: "Newsreader", Georgia, serif;
  font-size: 16px;
  line-height: 1.35;
}

.result-block {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.result-block h2 { margin: 0 0 4px; color: var(--purple-deep); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.result-block p { margin: 0; color: #4d4650; font-family: "Newsreader", Georgia, serif; font-size: 15px; line-height: 1.42; }
.result-block strong { color: var(--purple-deep); font-weight: 600; }
.direction-block { padding: 11px 13px; border: 0; border-left: 3px solid var(--purple); border-radius: 4px 12px 12px 4px; background: var(--purple-soft); }

.pattern-summary {
  margin: 12px 0 0;
  color: #f0e4d1;
  font-family: "Newsreader", serif;
  font-size: 16px;
  line-height: 1.42;
}

.insight {
  margin: 11px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--purple);
  border-radius: 4px 12px 12px 4px;
  color: #eadcc6;
  background: var(--purple-soft);
  font-family: "Newsreader", serif;
  font-size: 16px;
  line-height: 1.36;
}

.summary-list { display: grid; gap: 6px; margin: 0 0 12px; }
.answer-details {
  margin: 0 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.answer-details summary {
  padding: 10px 1px;
  color: var(--purple-deep);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.answer-details ul { margin: 0 0 10px; padding-left: 19px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.answer-details .summary-list { margin-top: 2px; }
.summary-item {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.35;
}
.summary-item dt { color: var(--muted); }
.summary-item dd { margin: 0; font-weight: 600; text-align: right; }

.result-actions { display: grid; gap: 8px; margin-top: 13px; }

.consultation-link {
  display: grid;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 9px 18px;
  border-radius: 14px;
  color: white;
  background: var(--purple);
  box-shadow: 0 8px 18px rgba(89,59,103,.2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.consultation-link small { display: block; margin-top: 2px; opacity: .82; font-size: 10px; font-weight: 500; }

.benefit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(109,76,125,.28);
  border-radius: 14px;
  color: var(--purple-deep);
  background: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.privacy-note { margin: 8px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

@media (max-height: 610px) {
  :root { --screen-heading-size: 22px; }
  .quiz-card { gap: 9px; padding-top: 15px; padding-bottom: 15px; border-radius: 20px; }
  .brand-place { display: none; }
  .supporting { margin: 4px 0 7px; font-size: 12px; }
  .choice { min-height: 44px; padding: 7px 10px; }
  .choice-icon { width: 26px; height: 26px; }
  .button { min-height: 44px; }
  .insight { margin: 7px 0; padding: 9px 12px; font-size: 14px; }
  .result-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .pattern-summary { margin-top: 8px; font-size: 14px; }
  .answer-details summary { padding: 7px 1px; }
}

@media (min-width: 740px) {
  :root { --screen-heading-size: clamp(22px, 2.35vw, 24px); }
  .quiz-card {
    width: min(100%, 820px);
    height: 680px;
    min-height: 680px;
  }
  h1 { max-width: none; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
