/* CHAFF app + docs: same tokens as the landing (chaff.css). Warm black page, raised panels, gold only for "yours". */
.app { padding: 64px 0 110px; }
.app-head { display: grid; grid-template-columns: 1fr minmax(260px, 460px); gap: 20px 60px; align-items: end; margin-bottom: 44px; }
.app-head .eyebrow { grid-column: 1 / -1; margin-bottom: -6px; }
.app-head h1 { font-size: clamp(3.2rem, 7vw, 6.2rem); letter-spacing: -.035em; line-height: .9; font-weight: 500; }
.app-head p { color: var(--mute); font-size: 16.5px; }
.app-grid { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(180deg, #14110e, #0f0d0b); }
.ask { padding: 24px; display: grid; gap: 12px; }
.ask > label, .modes legend { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); display: flex; justify-content: space-between; }
.ask output { color: var(--gold-hi); font-weight: 600; }
.ask .field { border-radius: 8px; }
.linkbtn { background: none; border: 0; padding: 0; text-align: left; font: 500 13.5px var(--body); text-decoration: underline; text-decoration-color: rgba(233, 170, 60, .5); text-underline-offset: 4px; color: var(--gold-hi); justify-self: start; }
.linkbtn:hover { text-decoration-color: var(--gold); }
.modes { border: 0; display: grid; gap: 8px; margin-top: 8px; }
.modes legend { margin-bottom: 8px; }
.mode { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--bg); transition: border-color .2s, background .2s; }
.mode:hover { border-color: var(--line-2); }
.mode:has(input:checked) { border-color: rgba(233, 170, 60, .55); background: linear-gradient(90deg, rgba(233, 170, 60, .09), rgba(233, 170, 60, .02)); }
.mode input { accent-color: var(--gold); margin-top: 3px; }
.mode b { display: block; font-weight: 500; color: var(--ink); }
.mode small { display: block; color: var(--mute); font-size: 13px; line-height: 1.45; margin-top: 2px; }
input[type="range"] { accent-color: var(--gold); width: 100%; }
.keyrow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-top: 4px; color: var(--ink-2); }
.keyrow code { background: var(--bg-4); color: var(--gold-hi); padding: 3px 8px; border-radius: 4px; margin-left: 6px; border: 1px solid var(--line); }
.hint { color: var(--dim); font-size: 13px; margin-top: -6px; }
.btn.wide { justify-content: center; width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: progress; }
.msg { font-size: 13.5px; min-height: 2.6em; color: var(--mute); }
.msg.bad { color: var(--bad); }

.out { background: linear-gradient(180deg, #17130f, #0d0b09); }
.out-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.out-head h2 { font-size: 1.6rem; letter-spacing: -.01em; font-weight: 500; }
.out .meta { font: 11.5px var(--mono); color: var(--mute); }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 26px 24px; border-bottom: 1px solid var(--line);
  background: radial-gradient(60% 120% at 100% 0%, rgba(233, 170, 60, .1), transparent 70%); }
.total span { font: 10.5px var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: .12em; }
.total b { font: 400 clamp(2.6rem, 5vw, 4.2rem)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--gold-hi); }
.tbl-wrap { overflow-x: auto; }
.hold { width: 100%; border-collapse: collapse; font: 13px var(--mono); }
.hold th, .hold td { text-align: right; padding: 11px 24px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hold th:first-child { text-align: left; }
.hold thead th { font-weight: 500; font-size: 10.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .12em; }
.hold tbody th b { font-weight: 600; margin-right: 8px; color: var(--ink); }
.hold tbody th small { color: var(--mute); font-family: var(--body); }
.hold tr.zero td, .hold tr.zero th, .hold tr.zero th b { color: var(--dim); }
.hold .dim, .dim { color: var(--mute); text-align: left; white-space: normal; }

.seen { margin-top: 90px; }
.seen-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.seen-head h2 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 500; }
.toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.toggle button { border: 0; background: none; padding: 8px 15px; border-radius: 999px; font: 500 13.5px var(--body); color: var(--ink-2); transition: background .2s, color .2s; }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seen-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; }
.crowd { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font: 12.5px/1 var(--mono); }
.crowd:empty { min-height: 200px; border: 1px dashed var(--line-2); border-radius: 8px; }
.crowd li { position: relative; padding: 13px 12px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; overflow: hidden; transition: background .3s var(--ease), border-color .3s; }
.crowd li span, .crowd li i { color: var(--mute); }
.crowd li i { font-style: normal; }
.crowd li.me { background: linear-gradient(180deg, #f3c264, var(--gold)); border-color: #f0bb57; color: var(--gold-ink); }
.crowd li.me span, .crowd li.me i { color: #5a3f12; }
.crowd li em { position: absolute; right: 10px; top: 50%; translate: 0 -50%; font: 600 9.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; background: var(--gold-ink); color: var(--gold-hi); padding: 4px 7px; border-radius: 3px; font-style: normal; }
.sticky { margin-top: 18px; color: var(--mute); max-width: 60ch; }
.facts dl { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--line-2); }
.facts dt, .facts dd { padding: 13px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--mute); font-size: 14px; }
.facts dd { font: 500 13.5px var(--mono); text-align: right; color: var(--ink); }
.raw { margin-top: 20px; }
.raw summary { cursor: pointer; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.raw pre { margin-top: 10px; background: #070605; border: 1px solid var(--line); color: var(--ink-2); padding: 14px; border-radius: 8px; font: 11px/1.6 var(--mono); overflow-x: auto; white-space: pre; }
.your-url { margin-top: 90px; padding-top: 48px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.your-url h2 { font-size: clamp(2rem, 3.8vw, 3rem); font-weight: 500; }
.your-url p { color: var(--mute); }
.your-url .url { justify-content: space-between; padding: 10px 10px 10px 18px; border-radius: 999px; border-color: rgba(233, 170, 60, .35); }
.your-url .url code { min-width: 0; overflow-wrap: anywhere; }

/* docs */
.docs { padding: 64px 0 110px; display: grid; grid-template-columns: 220px 1fr; gap: 64px; }
.toc { position: sticky; top: 28px; align-self: start; display: grid; gap: 2px; font-size: 14px; border-left: 1px solid var(--line); }
.toc a { text-decoration: none; color: var(--mute); padding: 5px 0 5px 16px; margin-left: -1px; border-left: 1px solid transparent; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--gold-hi); border-color: var(--gold); }
.doc { min-width: 0; max-width: 820px; }
.doc > .eyebrow { margin-bottom: 18px; }
.doc h1 { font-size: clamp(3rem, 6.4vw, 5.4rem); letter-spacing: -.035em; line-height: .92; margin-bottom: 22px; font-weight: 500; }
.doc > p.lead { font-size: 18px; color: var(--ink-2); max-width: 60ch; }
.doc section { padding-top: 64px; }
.doc h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 16px; font-weight: 500; }
.doc h3 { margin: 28px 0 8px; font-size: 1.2rem; }
.doc p, .doc li { color: var(--ink-2); }
.doc p + p { margin-top: 12px; }
.doc a { color: var(--gold-hi); }
.doc ul, .doc ol { padding-left: 20px; display: grid; gap: 6px; margin-top: 10px; }
.doc li::marker { color: var(--gold); }
.doc pre { background: #070605; border: 1px solid var(--line); color: var(--ink-2); padding: 18px 20px; border-radius: 8px; overflow-x: auto; font: 12.5px/1.7 var(--mono); margin-top: 14px; }
.doc pre .c { color: var(--dim); }
.doc :not(pre) > code { background: var(--bg-4); color: var(--gold-hi); padding: 1px 6px; border-radius: 3px; overflow-wrap: anywhere; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.doc thead th { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); }
/* the diagram svg is drawn in print colours: present it as a cream plate */
.diagram { margin-top: 18px; border: 1px solid rgba(233, 170, 60, .3); border-radius: 10px; background: #efe8da; padding: 18px; overflow-x: auto; }
.diagram svg { width: 100%; min-width: 640px; height: auto; }

@media (max-width: 960px) {
  .app-head, .app-grid, .seen-grid { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; gap: 10px; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 4px 16px; border-left: 0; }
  .toc a { padding: 4px 0; border: 0; }
  .doc table { display: block; overflow-x: auto; }
}
@media (max-width: 520px) {
  .crowd { grid-template-columns: 1fr; }
  .crowd li i { font-size: 0; }
  .crowd li i::before { content: "…"; font-size: 12.5px; }
  .hold th, .hold td { padding: 10px 12px; }
  .hold tbody th small { display: none; }
  .your-url .url { border-radius: 12px; }
}
