/* Warm monochrome, editorial. Colour only where it carries meaning:
   pale yellow = "ask me", pale green = the participant's own question. */
:root {
  --canvas: #f7f6f3;
  --surface: #ffffff;
  --ink: #2f3437;
  --ink-strong: #111111;
  --muted: #66655f;
  --faint: #a5a29c;
  --rule: #eaeaea;
  --rule-strong: #d9d7d2;
  --ask-bg: #fbf3db;
  --ask-ink: #956400;
  --own-bg: #edf3ec;
  --own-ink: #346538;
  --blue-bg: #e1f3fe;
  --blue-ink: #1f6c9f;
  --red-bg: #fdebec;
  --red-ink: #9f2f2d;
  --serif: "Newsreader", "Lyon Text", Georgia, serif;
  --sans: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body { font: 18px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(214, 196, 160, 0.10), transparent 70%);
}

/* top bar */
#topbar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(247, 246, 243, 0.86); backdrop-filter: saturate(140%) blur(8px); -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
#topbar .bar { max-width: 760px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
#study-name { font-family: var(--serif); font-size: 15px; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#progress { font: 13px/1 var(--mono); color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
#progressbar { height: 3px; background: var(--rule); }
#progressbar span { display: block; height: 100%; width: 0; background: var(--ink-strong); transition: width 600ms var(--ease); }

main { max-width: 760px; margin: 0 auto; padding: 48px 20px 120px; }
main > * { animation: rise 520ms var(--ease) both; }
main > *:nth-child(2) { animation-delay: 40ms; }
main > *:nth-child(3) { animation-delay: 80ms; }
main > *:nth-child(4) { animation-delay: 120ms; }
main > *:nth-child(n+5) { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main > * { animation: none; } }

h1 { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.12; letter-spacing: -0.02em; color: var(--ink-strong); margin: 4px 0 14px; }
h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -0.01em; color: var(--ink-strong); margin: 40px 0 10px; }
p { margin: 0 0 12px; }
b { color: var(--ink-strong); font-weight: 600; }
.muted { color: var(--muted); }
.lede { color: var(--muted); font-size: 18px; margin-bottom: 24px; max-width: 62ch; }
.small { font-size: 15px; }
.step-label { font: 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 24px 28px; margin: 14px 0; }
.card + .card { margin-top: 12px; }
ul.tight { margin: 6px 0 4px; padding-left: 20px; }
ul.tight li { margin: 6px 0; }

/* the request being annotated */
.prompt-box {
  font-family: var(--serif); font-size: 25px; line-height: 1.45; color: var(--ink-strong);
  border-left: 2px solid var(--ink-strong); padding: 4px 0 4px 20px; margin: 10px 0 34px; white-space: pre-wrap;
}
.prompt-box img { display: block; max-width: 100%; max-height: 360px; margin-top: 14px; border-radius: 8px; border: 1px solid var(--rule); }
.prompt-small { font-size: 19px; color: var(--ink); margin: 0 0 26px; padding: 2px 0 2px 16px; border-left-color: var(--rule-strong); }

/* buttons */
button { font: inherit; cursor: pointer; color: inherit; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-strong);
  border-radius: 6px; padding: 13px 24px; font-size: 17px; font-weight: 500;
  transition: background 160ms, border-color 160ms, transform 120ms;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.btn.primary:hover { background: #333; border-color: #333; }
.btn:disabled, .btn.primary:disabled { background: #e7e5e0; border-color: #e7e5e0; color: var(--faint); cursor: not-allowed; transform: none; }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 36px; flex-wrap: wrap; align-items: center; }

/* 1-5 scales */
.q-label { font-weight: 500; color: var(--ink-strong); margin: 0 0 10px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 6px; }
.scale label {
  text-align: center; border: 1px solid var(--rule); border-radius: 6px; padding: 16px 0; background: var(--surface);
  cursor: pointer; font: 17px/1 var(--mono); color: var(--ink); transition: border-color 160ms, background 160ms;
}
.scale label:hover { border-color: var(--faint); }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label.on { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); margin-bottom: 28px; }

/* text inputs */
input[type=text], textarea, select {
  font: inherit; font-size: 17.5px; width: 100%; border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 11px 13px; background: var(--surface); color: var(--ink-strong); transition: border-color 160ms, box-shadow 160ms;
}
input[type=text]::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 56px; resize: vertical; }
input[type=text]:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink-strong); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06); }
input:disabled, textarea:disabled { background: #f3f2ef; color: var(--faint); }
.field { margin: 0 0 20px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 500; color: var(--ink-strong); margin-bottom: 8px; }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0 0; font-size: 16.5px; color: var(--ink); cursor: pointer; }
.check input, .choices input { accent-color: var(--ink-strong); width: 16px; height: 16px; margin: 0; }
.choices label { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 17px; cursor: pointer; }
.choices > label:first-child { font-size: 16px; padding: 0 0 6px; cursor: default; }

/* ordering screen */
.zone-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 8px 0 10px; }
.zone-head .title { font: 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-strong); }
.zone-head .hint { font-size: 13px; color: var(--muted); text-align: right; }
.ask-list.empty {
  border: 1px dashed var(--rule-strong); border-radius: 8px; padding: 22px; text-align: center; color: var(--muted); font-size: 14.5px; background: rgba(255,255,255,0.5);
}
.qcard {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--rule); border-radius: 8px;
  padding: 10px 12px 10px 16px; margin: 0 0 6px; background: var(--surface); font-size: 17px; line-height: 1.4;
  transition: border-color 160ms, box-shadow 200ms, transform 120ms;
}
.qcard .qtext { flex: 1; color: var(--ink-strong); }
.qcard .num { font: 15px/1 var(--mono); color: var(--ask-ink); min-width: 1.2em; }
.qcard.asked { background: var(--ask-bg); border-color: #efe2bb; cursor: grab; }
.qcard.own .num { color: var(--own-ink); }
.qcard.own.asked { background: var(--own-bg); border-color: #d5e3d3; }
.tag {
  display: inline-block; margin-left: 8px; vertical-align: 2px; padding: 2px 8px; border-radius: 9999px;
  font: 10.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .06em; background: var(--own-bg); color: var(--own-ink);
}
.qcard.own.asked .tag { background: #fff; }
.ctrl { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 1px solid transparent; background: transparent; border-radius: 6px; color: var(--muted); transition: background 140ms, color 140ms;
}
.icon-btn:hover:not(:disabled) { background: rgba(0,0,0,0.05); color: var(--ink-strong); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn svg { width: 16px; height: 16px; }
.pool .qcard { cursor: pointer; }
.pool .qcard:hover { border-color: var(--rule-strong); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.pool .qcard:active { transform: scale(0.995); }
.pool .qcard:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 2px; }
.add-icon { width: 22px; height: 22px; border: 1px solid var(--rule-strong); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.add-icon svg { width: 12px; height: 12px; }
.pool .qcard:hover .add-icon { border-color: var(--ink-strong); color: var(--ink-strong); }
.cutline { display: flex; align-items: center; gap: 14px; margin: 26px 0 18px; }
.cutline::before, .cutline::after { content: ""; flex: 1; border-top: 1px dashed var(--faint); }
.cutline span { font: 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.match { margin-top: 28px; }
.match .field > label { font-weight: 400; color: var(--ink); }

/* answers */
.answer-q { font-weight: 500; color: var(--ink-strong); margin-bottom: 10px; line-height: 1.5; }
.answer-q .num { font: 12px/1 var(--mono); color: var(--muted); margin-right: 8px; }

/* compare */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.resp { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 22px; white-space: pre-wrap; font-size: 15px; line-height: 1.62; max-height: 480px; overflow: auto; }
.resp h3 { margin: 0 0 12px; font: 11.5px/1 var(--mono); letter-spacing: .08em; color: var(--muted); }
@media (max-width: 680px) { .compare { grid-template-columns: 1fr; } }
.pref { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 18px; }
.pref label { text-align: center; border: 1px solid var(--rule); border-radius: 6px; padding: 11px 6px; background: var(--surface); cursor: pointer; font-size: 13.5px; line-height: 1.3; transition: border-color 160ms; }
.pref label:hover { border-color: var(--faint); }
.pref input { position: absolute; opacity: 0; pointer-events: none; }
.pref label.on { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
@media (max-width: 680px) { .pref { grid-template-columns: 1fr; } }
.loading { display: flex; gap: 6px; margin: 36px 0; }
.loading span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-strong); animation: blink 1.2s infinite ease-in-out both; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }
.error { color: var(--red-ink); }

/* test mode */
#test-banner {
  position: fixed; bottom: 14px; left: 14px; background: var(--ink-strong); color: #fff; opacity: .85;
  padding: 8px 14px; font: 12px/1.3 var(--mono); border-radius: 6px; letter-spacing: .02em; white-space: nowrap;
}
.example { border: 1px solid var(--rule); border-radius: 10px; padding: 24px 28px; background: var(--surface); }
.timing { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 8px; }
.timing th, .timing td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--rule); }
.timing th { font: 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 400; }
.timing td.n { font-family: var(--mono); text-align: right; }
.timing th.n { text-align: right; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 20px; }
.stat .v { font-family: var(--serif); font-size: 30px; color: var(--ink-strong); line-height: 1.1; }
.stat .k { font: 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }
@media (max-width: 560px) {
  main { padding-top: 32px; }
  h1 { font-size: 28px; }
  .card, .example { padding: 20px; }
  .stat-row { grid-template-columns: 1fr; }
  .zone-head .hint { display: none; }
}
.actions .hint { margin-right: auto; font-size: 16px; color: var(--muted); }
.skip-wrap { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--rule); }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); font-size: 16px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong); }
.linklike:hover { color: var(--ink-strong); }
.skip-panel .actions { margin-top: 12px; }

/* full ranking: click in order, then draw the line */
.rank-list { margin-bottom: 6px; }
.qcard.ranked { background: #f3f2ef; border-color: var(--rule); }
.qcard.ranked .num { color: var(--muted); }
.qcard.ranked .qtext { color: var(--ink); }
.pool-head { font-family: var(--serif); font-size: 21px; color: var(--ink-strong); margin: 26px 0 12px; }


.nudge { background: #fbf3db; border: 1px solid #efe2bb; color: #5c4400; border-radius: 10px; padding: 14px 18px; margin-top: 18px; font-size: 16.5px; }
/* screen 1: the optional "did the AI miss a question?" box */
.order-head { margin-top: 28px; }
.own-box { margin-top: 18px; }
.own-box .q-label { margin-top: 0; }
.own-row { display: flex; gap: 10px; }
.own-row input { flex: 1; min-width: 0; }
.own-row .btn { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.own-row .btn svg { width: 14px; height: 14px; }
.answer-q .tag { margin-left: 8px; }

/* UX pass: two columns on wide screens, so the cards stay in view while ranking */
body.wide main { max-width: 1180px; }
body.wide #topbar .bar { max-width: 1180px; }
body.wide main > .step-label, body.wide main > h1, body.wide main > .prompt-box, body.wide main > .lede, body.wide main > .kind-pill { max-width: 760px; }
.order-grid { display: flex; flex-direction: column-reverse; gap: 4px; }
@media (min-width: 1100px) {
  .order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
  .order-ranked { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; }
}
.order-pool .pool-head, .order-ranked .pool-head { margin: 8px 0 10px; font-size: 19px; }
.pool-head .count { font: 13px/1 var(--mono); color: var(--muted); }
.qcard.slot { border: 1px dashed var(--rule-strong); background: transparent; min-height: 46px; box-shadow: none; }
.rank-empty { border: 1px dashed var(--rule-strong); border-radius: 8px; padding: 18px; color: var(--muted); font-size: 15.5px; text-align: center; }
.mine { display: inline-block; margin-left: 8px; font: 11.5px/1.4 var(--mono); color: var(--muted); letter-spacing: .02em; }
.own-box { margin-top: 14px; }
.own-note { margin: 4px 0 0; }
.own-note .linklike { font-size: 15px; }
h1.compact { font-size: 26px; margin-bottom: 10px; }
.lede.compact { font-size: 16px; margin-bottom: 14px; }
.prompt-box.long { font-size: 21px; }
.kind-pill { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 9999px; background: var(--blue-bg); color: var(--blue-ink);
  font: 11.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.ex-gap { text-align: center; color: var(--muted); line-height: 1; margin: -2px 0 4px; }
/* screen 2 */
.answer-card { padding: 16px 20px; margin-bottom: 12px; }
.answer-card textarea { min-height: 44px; resize: none; overflow-y: auto; }
.answer-card textarea.dim { opacity: .55; }
.chips { display: flex; gap: 8px; margin-top: 8px; }
.chip { border: 1px solid var(--rule-strong); background: transparent; color: var(--muted); border-radius: 9999px; padding: 3px 12px; font-size: 14.5px; }
.chip:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.chip.on { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.kbd-hint { margin-top: 6px; text-align: right; }
label:has(input:focus-visible) { outline: 2px solid var(--ink-strong); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .linklike:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 2px; }

/* onboarding */
.glance { list-style: none; padding: 16px 20px; margin: 0 0 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.glance li { padding: 3px 0 3px 22px; position: relative; }
.glance li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-strong); }
.consent-text { font-size: 16px; }
.consent-text p { margin-bottom: 10px; }
.steps { padding-left: 1.3em; margin: 4px 0 18px; font-size: 19px; }
.steps li { margin: 0 0 10px; padding-left: 4px; }
.coach { background: var(--blue-bg); color: var(--blue-ink); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-size: 16px; }
.want-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.want-label { font-size: 15px; color: var(--ink); margin-right: 4px; }
