:root {
  --mist: #f1efec;
  --milk: #fbf9f6;
  --blush: #f3e6e4;
  --rose-line: #c9b5b2;
  --graphite: #343131;
  --muted: #77706d;
  --white: #fffefd;
  --shadow: 0 24px 70px rgba(66, 57, 54, .09);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--mist); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--graphite);
  background:
    radial-gradient(circle at 86% 7%, rgba(243,230,228,.92), transparent 28rem),
    linear-gradient(145deg, #f7f5f2 0%, var(--mist) 58%, #ebe8e4 100%);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E");
}

button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.journal-shell {
  position: relative;
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 28px 22px calc(38px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 55px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: stretch;
  gap: 13px;
  font-size: .75rem;
  line-height: 1.38;
  letter-spacing: .22em;
  font-weight: 650;
}

.brand small { font-size: .68rem; font-weight: 450; letter-spacing: .2em; }
.brand-line { display: block; width: 1px; background: var(--graphite); }

.text-button {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 7px 0;
  color: var(--muted);
  background: transparent;
  font-size: .82rem;
  cursor: pointer;
}
.text-button:hover, .text-button:focus-visible { color: var(--graphite); border-color: currentColor; outline: 0; }

.progress-wrap { margin: 6px 0 18px; }
.progress-copy { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 7px; color: var(--muted); font-size: .76rem; }
.progress-track { height: 2px; overflow: hidden; background: rgba(52,49,49,.13); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--graphite); transition: width .35s ease; }

.paper {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  padding: clamp(34px, 7vw, 64px);
  border: 1px solid rgba(82,72,69,.12);
  border-radius: 3px;
  background: rgba(255,254,253,.9);
  box-shadow: var(--shadow);
}

.paper::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 78px;
  height: 78px;
  border-left: 1px solid rgba(201,181,178,.35);
  background: linear-gradient(135deg, rgba(243,230,228,.12) 50%, rgba(243,230,228,.55) 50%);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  pointer-events: none;
}

.screen { animation: pageIn .35s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.cover {
  min-height: 455px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 590px;
}

.eyebrow {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .2em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  text-wrap: balance;
}

h1 { max-width: 11ch; font-size: clamp(3rem, 10vw, 5.5rem); letter-spacing: -.045em; }
h2 { max-width: 15ch; font-size: clamp(2.25rem, 7vw, 3.65rem); letter-spacing: -.035em; }

.rule { width: 64px; height: 1px; margin: 27px 0; background: var(--graphite); }
.lead { max-width: 590px; margin: 0; font-size: 1.08rem; }
.meta { margin-top: 28px; color: var(--muted); font-size: .83rem; }

.step-head { display: grid; grid-template-columns: 52px 1fr; gap: 18px; align-items: start; margin-bottom: 25px; }
.step-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rose-line);
  border-radius: 50%;
  color: #6e5e5c;
  background: var(--blush);
}
.step-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.copy { max-width: 620px; }
.copy p { margin: 0 0 16px; }
.copy p:last-child { margin-bottom: 0; }

.note {
  margin: 22px 0 28px;
  padding: 18px 20px;
  border-left: 2px solid var(--rose-line);
  background: var(--blush);
  color: #574f4d;
  font-size: .94rem;
}
.note strong { display: block; margin-bottom: 4px; color: var(--graphite); }

.example-list { margin: 7px 0 0; padding: 0; list-style: none; }
.example-list li { margin: 4px 0; }
.example-list li::before { content: "—"; margin-right: 8px; color: #a78c88; }

.field { display: block; margin: 28px 0 0; }
.field-label { display: block; margin-bottom: 10px; font-weight: 620; line-height: 1.4; }
.field-help { display: block; margin-top: -4px; margin-bottom: 10px; color: var(--muted); font-size: .82rem; font-weight: 400; }

textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid #d8cfcc;
  border-radius: 2px;
  padding: 15px 16px;
  color: var(--graphite);
  background: rgba(255,255,255,.82);
  line-height: 1.5;
  outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus { border-color: #a88f8c; box-shadow: 0 0 0 3px rgba(201,181,178,.2); }
textarea::placeholder { color: #aaa29f; }

.scale { margin-top: 30px; }
.scale-header { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; }
.scale-title { font-weight: 620; line-height: 1.4; }
.scale-value { min-width: 2.25rem; font-family: var(--serif); font-size: 1.85rem; text-align: right; }
.scale input { width: 100%; margin: 18px 0 8px; accent-color: #9f8581; }
.scale-ends { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .75rem; }

.letter-signoff { margin-top: 30px; font-family: var(--serif); font-size: 1.25rem; font-style: italic; }
.privacy {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 27px;
  padding-top: 22px;
  border-top: 1px solid #e0d9d6;
  color: var(--muted);
  font-size: .82rem;
}
.privacy svg { flex: 0 0 auto; width: 18px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.nav-actions { display: flex; justify-content: space-between; gap: 12px; padding: 20px 0 0; }
.button {
  min-height: 50px;
  border-radius: 2px;
  padding: 12px 24px;
  border: 1px solid var(--graphite);
  cursor: pointer;
  transition: transform .16s, background .16s, color .16s;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(159,133,129,.3); outline-offset: 2px; }
.button.primary { margin-left: auto; color: var(--white); background: var(--graphite); }
.button.primary:hover { background: #4b4644; }
.button.secondary { color: var(--graphite); background: transparent; }
.button.secondary[hidden] { display: none; }

.finish-actions { display: grid; gap: 12px; margin-top: 30px; }
.finish-actions .button { width: 100%; }
.finish-actions .secondary { background: var(--white); }
.closing-thought {
  margin: 34px 0 8px;
  padding: 24px 22px;
  border-left: 2px solid var(--rose-line);
  background: linear-gradient(135deg, rgba(243,230,228,.76), rgba(251,249,246,.92));
}
.closing-thought span,
.closing-thought strong { display: block; }
.closing-thought span { margin-bottom: 5px; color: var(--muted); font-size: .82rem; }
.closing-thought strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 400; line-height: 1.35; }
.personal-insight {
  scroll-margin-top: 20px;
  margin-top: 28px;
  padding: 24px;
  border: 1px solid #d8cfcc;
  background: linear-gradient(145deg, rgba(255,254,253,.98), rgba(243,230,228,.42));
}
.personal-insight[hidden] { display: none; }
.personal-insight .eyebrow { margin-bottom: 13px; }
.insight-text { margin: 0; font-family: var(--serif); font-size: 1.18rem; line-height: 1.55; }
.result-actions { display: grid; gap: 12px; margin-top: 24px; }
.result-actions .button { width: 100%; }
.result-actions .primary { margin-left: 0; }
.save-note { margin: 10px 0 0; color: var(--muted); font-size: .78rem; text-align: center; }
.metaphor-card {
  margin: 18px -12px 0;
  padding: 0 12px 4px;
  overflow: hidden;
}
.metaphor-card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: .62;
  mix-blend-mode: multiply;
  filter: saturate(.58) contrast(.92);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 9%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 9%, #000 86%, transparent 100%);
}
.metaphor-card figcaption { margin: -4px 8px 0; color: #645d5a; font-size: .88rem; line-height: 1.55; }
.metaphor-card figcaption strong { color: var(--graphite); font-weight: 600; }
.answer-summary {
  scroll-margin-top: 20px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #d8cfcc;
  background: var(--white);
}
.answer-summary[hidden] { display: none; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.answer-summary pre {
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid #e6dfdc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--graphite);
  background: #faf8f6;
  font: .88rem/1.55 var(--sans);
  user-select: text;
  -webkit-user-select: text;
}
.action-status { min-height: 1.5em; margin: 12px 0 0; color: #6f5d5a; font-size: .82rem; }
.invitation {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid #e0d9d6;
}
.invitation p { margin: 0 0 18px; }
.invitation .form-privacy {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-left: 2px solid var(--rose-line);
  color: #645d5a;
  background: rgba(243,230,228,.55);
  font-size: .84rem;
}
.meeting-button {
  display: block;
  width: 100%;
  border-color: #b59d99;
  color: var(--graphite);
  background: var(--blush);
  text-align: center;
  text-decoration: none;
}
.meeting-button:hover { background: #ead8d5; }
.meeting-fallback {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 12px auto 0;
  text-align: center;
}
.meeting-status { margin-top: 8px; text-align: center; }
.meeting-form {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #ded5d2;
  border-radius: 12px;
  background: #fff;
}
.meeting-form[hidden] { display: none; }
.meeting-form iframe {
  display: block;
  width: 100%;
  min-height: 760px;
  border: 0;
  background: #fff;
}
.fineprint { margin-top: 24px; color: var(--muted); font-size: .78rem; }
.redirect-paper { display: grid; min-height: min(650px, calc(100vh - 56px)); place-items: center; }
.redirect-paper .screen { width: 100%; max-width: 560px; }
.redirect-paper .meeting-button { margin-top: 28px; }

@media (max-width: 620px) {
  body { font-size: 16px; }
  .journal-shell { padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 10px; }
  .brand { font-size: .67rem; }
  .brand small { font-size: .61rem; }
  .paper { min-height: 545px; padding: 32px 24px; border-radius: 2px; }
  .paper::after { width: 55px; height: 55px; }
  .meeting-form iframe { min-height: 820px; }
  .step-head { grid-template-columns: 44px 1fr; gap: 13px; }
  .step-icon { width: 42px; height: 42px; }
  .progress-copy { font-size: .69rem; }
  .button { padding: 11px 18px; }
  .nav-actions { position: sticky; bottom: 0; z-index: 2; padding: 14px 0 calc(4px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--mist) 20%); }
}

@media print {
  body { background: white; }
  body::before, .topbar, .progress-wrap, .nav-actions { display: none !important; }
  .journal-shell { width: 100%; padding: 0; }
  .paper { min-height: 0; padding: 0; border: 0; box-shadow: none; }
  .paper::after { display: none; }
}

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