/* Crux — one calm page. Paper, ink, and one warm accent. */
:root {
  --paper: #f6f2ea;
  --card: #fffdf8;
  --ink: #1e1b16;
  --muted: #6b6357;
  --line: #e3dccf;
  --accent: #b5482a;      /* the crux: where the two lines meet */
  --accent-soft: #f3e1d8;
  --a: #2f5d73;           /* person A */
  --b: #6a4c7c;           /* person B — same weight, different hue */
  --fact: #2f6b4f;
  --values: #8a5a14;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f; --card: #1f1c16; --ink: #efe9dd; --muted: #a59c8c; --line: #332e25;
    --accent: #e07a5a; --accent-soft: #3a241b; --a: #7fb0c8; --b: #b99ad0; --fact: #7cc4a0; --values: #e0b060;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--sans);
}
main { max-width: 640px; margin: 0 auto; padding: 28px 20px 64px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 7vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-bottom: 36px; }
.brand svg { width: 28px; height: 28px; }
.brand span { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }

.lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }

.steps { list-style: none; padding: 0; margin: 28px 0 32px; display: grid; gap: 14px; }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.steps b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: var(--serif); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
label { display: block; font-weight: 600; font-size: .95rem; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 label { margin-top: 0; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem var(--sans); border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; padding: 13px 22px; text-decoration: none; margin-top: 16px;
}
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.err { color: var(--accent); font-weight: 600; margin-top: 10px; min-height: 1.2em; }

.notes { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.notes p { font-size: .9rem; color: var(--muted); }

/* ---- Session page ---- */
.topic { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 18px; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.chat { display: grid; gap: 12px; margin: 18px 0; }
.msg { max-width: 88%; padding: 12px 15px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.me { justify-self: end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.composer { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0 14px; }
.composer textarea { min-height: 72px; }
.composer .bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.composer button { margin-top: 8px; }

.invite { background: var(--accent-soft); border-radius: var(--r); padding: 18px; margin-bottom: 18px; }
.invite code { display: block; font-size: .85rem; overflow-wrap: anywhere; background: var(--card); padding: 10px; border-radius: 8px; margin: 8px 0 0; }
.invite .btns { display: flex; gap: 10px; flex-wrap: wrap; }

.waiting { text-align: center; padding: 30px 10px; }
.pulse { width: 46px; height: 46px; margin: 0 auto 14px; }
.pulse circle { transform-origin: center; animation: p 2.2s ease-in-out infinite; }
@keyframes p { 50% { transform: scale(.7); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .pulse circle { animation: none; } }

/* ---- The map ---- */
.map h2:first-child { margin-top: 0; }
.who-a { color: var(--a); } .who-b { color: var(--b); }
.pos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pos .card { padding: 14px; }
.pos .card h3 { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.pos .a { border-top: 4px solid var(--a); } .pos .b { border-top: 4px solid var(--b); }
ul.agree { padding-left: 1.1em; } ul.agree li { margin-bottom: 6px; }
.crux { border: 2px solid var(--accent); border-radius: var(--r); padding: 16px; margin-bottom: 14px; background: var(--card); }
.crux .kind { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.crux .kind.fact { color: var(--fact); } .crux .kind.values { color: var(--values); }
.crux h3 { margin: 4px 0 10px; font-size: 1.2rem; }
.crux .sides { display: grid; gap: 8px; margin-bottom: 10px; }
.crux .try { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.misread { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin-bottom: 12px; }
.next { background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 18px; margin-top: 22px; }
.next h3 { color: var(--paper); }
table.side { width: 100%; border-collapse: collapse; }
table.side td, table.side th { vertical-align: top; padding: 10px 6px; border-top: 1px solid var(--line); text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
table.side th { font-size: .85rem; }
.legend { font-size: .9rem; color: var(--muted); }

@media (max-width: 480px) {
  .pos, .row2 { grid-template-columns: 1fr; }
  main { padding-top: 20px; }
}
