/* Palette and chrome follow site/style.css and rating/style.css. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6b6a65;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --selected-bg: #e3eefb;
  --mark-bg: #fbe7a1;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --reading: Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #9a9991;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #6da7ec;
    --selected-bg: #17304d;
    --mark-bg: #5c4a12;
  }
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--page);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 24px 0; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 8px 0 12px; font-weight: 650; }
.lead { max-width: 68ch; color: var(--text-secondary); margin: 0 0 20px; font-size: 1rem; }
.hint { color: var(--text-muted); font-size: 0.9rem; max-width: 68ch; }

button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 16px;
  border: 1px solid var(--axis); background: var(--surface); color: var(--text-primary);
}
button.primary { background: var(--text-primary); color: var(--surface); border-color: var(--text-primary); font-weight: 600; }
button.secondary { background: transparent; }
button:disabled { opacity: 0.4; cursor: default; }
input[type="text"] {
  font: inherit; color: var(--text-primary); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px;
}

.who { margin: 0; text-align: right; color: var(--text-muted); font-size: 0.8rem; }
.profile-form fieldset { border: 0; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.profile-form legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.profile-form label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.profile-form .role { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0 0 18px; cursor: auto; }
.profile-form .role span { font-weight: 600; }
.profile-form .role input { width: min(420px, 100%); }
.profile-form fieldset.stack { flex-direction: column; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
a.link { color: var(--accent); }
.nowrap { white-space: nowrap; }
.summary { max-width: 68ch; margin: 0 0 20px; }
.summary h2 { font-size: 1.05rem; margin: 0 0 6px; font-weight: 650; }
.summary p { margin: 0 0 8px; }
.summary ul { margin: 0; padding-left: 1.2em; color: var(--text-secondary); }
.summary li { margin: 0 0 4px; }
.summary h2 { margin-top: 18px; }
.summary .score { font-size: 1.15rem; font-weight: 650; margin: 0 0 4px; }
.summary .hint { margin: 0 0 12px; }
.share { margin-top: 18px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.share p { margin: 0 0 8px; }
.share .actions { margin: 0; }
.parts { max-width: 68ch; margin: 0 0 20px; padding-left: 1.4em; color: var(--text-secondary); }
.parts li { margin: 0 0 6px; }
.parts b { color: var(--text-primary); }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--grid); margin-bottom: 12px;
  color: var(--text-secondary); font-size: 0.9rem;
}
.progress-text { font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }
.progress { flex: 1 1 120px; max-width: 320px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }

.brief { margin: 0 0 16px; color: var(--text-secondary); font-size: 0.92rem; max-width: 100ch; }
.brief p { margin: 0 0 2px; white-space: pre-line; }
.brief-label { font-weight: 600; }
.excerpt-note, .diff-note { color: var(--text-muted); }
mark { background: var(--mark-bg); color: inherit; border-radius: 2px; padding: 0 1px; }

.texts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.text-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 24px 8px;
}
.text-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.text-card h2 { font-size: 0.95rem; margin: 0 0 8px; font-weight: 650; color: var(--text-secondary); }
.text-body { font-family: var(--reading); font-size: 1.07rem; line-height: 1.62; }
.text-body p { margin: 0 0 0.9em; white-space: pre-line; }

.choice-bar {
  position: sticky; bottom: 0; z-index: 5;
  margin: 20px -24px 0; padding: 12px 24px 16px;
  background: var(--page); border-top: 1px solid var(--grid);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
}
.question { flex-basis: 100%; margin: 0; font-weight: 650; }
.choice-row { display: flex; gap: 8px; }
.choice {
  min-width: 104px; padding: 6px 10px; display: grid; justify-items: center; gap: 0;
  line-height: 1.25;
}
.choice b { font-size: 1.05rem; font-weight: 650; }
.choice small { font-size: 0.8rem; color: var(--text-secondary); }
.choice.same { min-width: 88px; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice.picked { background: var(--selected-bg); border-color: var(--accent); opacity: 1; }
.choice kbd { margin: 2px 0 0; }
.status { flex-basis: 100%; margin: 0; color: #b3261e; font-size: 0.9rem; }
.status:empty { display: none; }
kbd {
  font-family: var(--font); font-size: 0.75rem; font-weight: 400; color: var(--text-muted);
  border: 1px solid var(--axis); border-radius: 4px; padding: 0 5px; margin-left: 6px;
}
.note { flex: 1 1 360px; display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); font-size: 0.85rem; }
.note input { width: 100%; min-width: 0; }
.note-hint { color: var(--text-muted); }
/* Visitors answer with the buttons first; their optional note sits under them. */
.public .question { order: 1; }
.public .choice-row { order: 2; }
.public .note { order: 3; flex: 1 1 100%; max-width: 68ch; }
.public .status { order: 4; }

@media (max-width: 760px) {
  .wrap { padding: 16px 16px 0; }
  h1 { font-size: 1.4rem; }
  .texts { grid-template-columns: 1fr; gap: 14px; }
  .text-card { padding: 14px 16px 6px; }
  .choice-bar { position: static; margin: 16px -16px 0; padding: 12px 16px 24px; gap: 10px; border-top: 0; }
  .choice-row { width: 100%; gap: 6px; }
  .choice-row button { flex: 1; min-width: 0; padding: 10px 2px; }
  .choice small { font-size: 0.72rem; }
  kbd { display: none; }
  .note { flex-basis: 100%; }
  .profile-form label { padding: 4px 0; }
  button.primary { padding: 10px 20px; }
}
