:root {
  --ink: #17211f;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --muted: #66706d;
  --line: #d9d5ca;
  --blue: #3b67d8;
  --gold: #ca8a2e;
  --green: #2f7d66;
  --red: #ad4e48;
  --shadow: 0 20px 60px rgba(24, 35, 32, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(59, 103, 216, .09), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

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

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 33, 31, .15);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--ink); border-radius: 50%; font-size: 12px; }
nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
nav a { font-size: 14px; text-decoration: none; color: #3d4946; }
nav a:hover { color: var(--blue); }
.nav-user { display: flex; align-items: center; gap: 10px; }
#nav-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.nav-logout { min-height: 32px; padding: 0 12px; font-size: 13px; }
.usage-pill { padding: 4px 10px; border-radius: 100px; background: #e7eee9; color: var(--muted); font-size: 11px; font-weight: 700; }
.usage-pill.usage-empty { background: #fce8e7; color: var(--red); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { max-width: 920px; margin: 0 auto; padding: 90px 0 105px; text-align: center; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .18em; color: var(--blue); }
h1 { margin: 20px 0 22px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(48px, 7vw, 84px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 690px; margin: 0 auto 38px; font-size: 19px; color: var(--muted); }

.question-card { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 25px; box-shadow: var(--shadow); }
label, legend { font-weight: 700; font-size: 14px; }
textarea, input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 9px;
  color: var(--ink);
  background: rgba(255,255,255,.68);
  border: 1px solid #cfcabf;
  border-radius: 10px;
  padding: 14px 15px;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.question-card textarea { border: 0; padding: 10px 0; font-family: Georgia, 'Times New Roman', serif; font-size: 25px; line-height: 1.42; background: transparent; outline: 0; }
textarea:focus, input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 103, 216, .12); }
.question-card textarea:focus { box-shadow: none; }
.form-footer, .submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.privacy-note { margin: 13px 0 0; color: var(--muted); font-size: 12px; }

button { border: 0; cursor: pointer; }
.primary { display: inline-flex; align-items: center; gap: 18px; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 7px; color: #fff; background: var(--ink); font-weight: 730; }
.primary:hover { background: var(--blue); }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink); font-weight: 700; }

.hidden { display: none !important; }
.loading-panel { display: flex; align-items: center; gap: 20px; max-width: 620px; margin: -55px auto 80px; padding: 22px 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.loading-panel span { display: block; color: var(--muted); font-size: 13px; }
.spinner { width: 28px; height: 28px; flex: none; border: 3px solid #d8d4c9; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-section, .history-section { padding: 80px 0; border-top: 1px solid rgba(23, 33, 31, .14); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 30px; }
.section-heading.narrow { margin-bottom: 12px; }
h2 { margin: 7px 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(35px, 4vw, 50px); line-height: 1.06; font-weight: 500; letter-spacing: -.035em; }
.meta-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 100px; color: var(--muted); font-size: 12px; }
.answer-card { position: relative; overflow: hidden; padding: 36px 40px; margin-bottom: 22px; color: #fff; border-radius: 14px; background: var(--ink); }
.answer-card::after { content: '“'; position: absolute; right: 28px; top: -36px; color: rgba(255,255,255,.07); font-family: Georgia, serif; font-size: 200px; }
.card-kicker { color: #9db5ff; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.answer-text { position: relative; z-index: 1; max-width: 900px; margin: 15px 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: 22px; white-space: pre-wrap; }

.analysis-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.analysis-card { position: relative; min-height: 330px; padding: 27px; border: 1px solid var(--line); border-top: 4px solid; border-radius: 11px; background: var(--card); }
.accent-blue { border-top-color: var(--blue); }
.accent-gold { border-top-color: var(--gold); }
.accent-green { border-top-color: var(--green); }
.card-number { float: right; color: #b6bbb8; font-family: Georgia, serif; font-size: 30px; }
.analysis-card h3 { margin: 3px 0 18px; max-width: 80%; font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.analysis-card p, .analysis-card li, .analysis-card dd { font-size: 14px; }
.analysis-card details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 15px; }
summary { cursor: pointer; color: var(--blue); font-weight: 720; font-size: 12px; }
.analysis-card ul { padding-left: 18px; color: var(--muted); }
dl { margin: 22px 0 0; }
dt { margin-top: 13px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
dd { margin: 3px 0 0; }

.evaluation-panel { margin-top: 70px; padding: 50px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.evaluation-intro { max-width: 650px; margin: 0 0 35px; color: var(--muted); }
.two-column { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.ratings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 30px 0; }
fieldset { min-width: 0; margin: 0; border: 0; padding: 0; }
.rating { padding: 19px; border: 1px solid var(--line); border-radius: 10px; }
.rating legend { min-height: 44px; padding: 0; line-height: 1.35; }
.rating-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 12px; }
.rating-options label { position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-size: 13px; }
.rating-options input, .chip-options input { position: absolute; opacity: 0; pointer-events: none; }
.rating-options label:has(input:checked) { color: white; border-color: var(--blue); background: var(--blue); }
.rating-scale { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 10px; }
.effects { margin: 0 0 30px; }
.effects legend span { color: var(--muted); font-weight: 400; }
.chip-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-options label { position: relative; padding: 8px 13px; border: 1px solid var(--line); border-radius: 100px; color: var(--muted); cursor: pointer; font-size: 12px; }
.chip-options label:has(input:checked) { color: var(--ink); border-color: var(--green); background: #e4f0eb; }
.optional-fields { margin-bottom: 30px; }
.submit-row p { margin: 0; color: var(--green); font-weight: 700; }

.history-section { padding-bottom: 100px; }
.history-content { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 16px; text-align: left; color: var(--muted); background: #ece9e1; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: top; }
tr[data-id] { cursor: pointer; }
tr[data-id]:hover td { background: #f5f7f2; }
.score { display: inline-grid; place-items: center; min-width: 28px; height: 24px; border-radius: 5px; background: #e7eee9; font-weight: 800; }
.unrated { color: var(--muted); }
.muted { padding: 20px; color: var(--muted); }
.action-cell { white-space: nowrap; }
.variation-btn { min-height: 30px; padding: 0 10px; font-size: 12px; }
.variation-badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: #e4eaf8; color: var(--blue); font-size: 11px; font-weight: 800; vertical-align: middle; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(23, 33, 31, .65); backdrop-filter: blur(5px); }
.modal-card { width: min(460px, 100%); padding: 36px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.modal-card h2 { font-size: 34px; }
.modal-card p { color: var(--muted); }
.modal-card button { width: 100%; margin-top: 18px; }
.toast { position: fixed; z-index: 30; right: 25px; bottom: 25px; max-width: 420px; padding: 15px 18px; color: #fff; background: var(--red); border-radius: 8px; box-shadow: var(--shadow); }

/* ── Site footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid rgba(23,33,31,.12); margin-top: 40px; padding: 28px 0; }
.footer-inner { width: min(1180px, calc(100% - 40px)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.footer-nav { display: flex; gap: 22px; }
.footer-nav a { text-decoration: none; color: var(--muted); }
.footer-nav a:hover { color: var(--blue); }
@media (max-width: 500px) { .footer-inner { flex-direction: column; text-align: center; } }

@media (max-width: 850px) {
  .analysis-grid, .ratings { grid-template-columns: 1fr; }
  .analysis-card { min-height: 0; }
  .evaluation-panel { padding: 30px 22px; }
}
@media (max-width: 620px) {
  .site-header { height: auto; padding: 20px 0; align-items: flex-start; }
  nav { flex-direction: column; align-items: flex-end; gap: 5px; }
  nav a { font-size: 12px; }
  .hero { padding: 60px 0 80px; }
  h1 { font-size: 49px; }
  .lede { font-size: 16px; }
  .question-card textarea { font-size: 20px; }
  .form-footer, .section-heading, .submit-row { align-items: stretch; flex-direction: column; }
  .primary { width: 100%; }
  .two-column { grid-template-columns: 1fr; }
  .answer-card { padding: 28px 24px; }
  .answer-text { font-size: 19px; }
  .meta-pill { align-self: flex-start; }
}

/* ── Interpret section (Step 2) ──────────────────────────────────────────── */
.interpret-section { padding: 80px 0; border-top: 1px solid rgba(23, 33, 31, .14); }
.interpret-intro { max-width: 680px; margin: 0 0 36px; color: var(--muted); font-size: 16px; }

.interpret-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 28px; }
.interpret-card { min-width: 0; margin: 0; padding: 27px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); box-shadow: var(--shadow); }
.interpret-card legend { display: block; font-family: Georgia, 'Times New Roman', serif; font-size: 20px; font-weight: 500; margin-bottom: 18px; padding: 0; color: var(--ink); line-height: 1.2; }

.radio-options { display: flex; flex-direction: column; gap: 9px; }
.radio-options label { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 400; line-height: 1.5; transition: border-color .15s, background .15s; }
.radio-options label:hover { border-color: #a8b4b0; background: rgba(0,0,0,.02); }
.radio-options label:has(input:checked) { border-color: var(--blue); background: rgba(59, 103, 216, .07); }
.radio-options input[type="radio"] { margin-top: 3px; flex: none; accent-color: var(--blue); width: 15px; height: 15px; }

.reword-block { margin-bottom: 28px; }
.reword-block label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 9px; }
.optional { font-weight: 400; color: var(--muted); }

.interpret-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .interpret-grid { grid-template-columns: 1fr; }
  .interpret-footer { flex-direction: column-reverse; align-items: stretch; }
  .interpret-footer .secondary, .interpret-footer .primary { width: 100%; text-align: center; }
}

/* ── Step 5: What next? ──────────────────────────────────────────────────── */
.step5-panel { margin-top: 52px; padding-top: 52px; border-top: 1px solid rgba(23, 33, 31, .14); }
.step5-intro { max-width: 620px; margin: 0 0 30px; color: var(--muted); font-size: 16px; }
.step5-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, box-shadow .18s, transform .12s;
}
.choice-card:hover { border-color: #a8b4b0; box-shadow: 0 28px 70px rgba(24,35,32,.13); transform: translateY(-2px); }

.choice-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.choice-letter-a { background: var(--green); }
.choice-letter-b { background: var(--blue); }
.choice-letter-c { background: var(--gold); }

.choice-body { display: flex; flex-direction: column; gap: 5px; }
.choice-body strong { font-size: 15px; font-weight: 760; color: var(--ink); }
.choice-body span { font-size: 13px; color: var(--muted); line-height: 1.45; }

@media (max-width: 780px) {
  .step5-choices { grid-template-columns: 1fr; }
  .choice-card { flex-direction: row; }
}
