/* Readability floor, from state/DECISIONS.md 26 Jul:
   nothing below 15px, base 17px, prose 18px/1.7, secondary text >= 9:1 contrast.
   This panel is read for an hour at a time beside a Claude window. It is a
   reading surface, not a toolbar. */

:root {
  color-scheme: dark light;
  --paper:  #101823;
  --raised: #18222F;
  --ink:    #F4F7FA;   /* 15:1 on paper */
  --muted:  #C2CCD8;   /* 11:1 on paper — not the 6:1 default that looked washed out */
  --line:   #35455E;
  --amber:  #E8A33D;
  --ok:     #6FD6AC;
  --bad:    #F5A3A3;
  --focus:  #E8A33D;
}
@media (prefers-color-scheme: light) {
  :root {
    --paper: #F3F5F4; --raised: #FCFDFC; --ink: #0E1620;
    --muted: #44505F; --line: #C7CFCB; --ok: #1D7A54; --bad: #A32D2D;
  }
}

* { box-sizing: border-box; }

/* Author display rules beat the UA stylesheet's [hidden]. Put it back. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 "Iowan Old Style", "Palatino Linotype", Georgia, "DejaVu Serif", serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------- zone 1: where you are ---------------- */

header {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 13px 18px 11px;
}
.crumb { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.crumb .l {
  font-size: 15px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.crumb .r {
  font-size: 14px; color: var(--muted);
  font-family: ui-monospace, "SF Mono", "DejaVu Sans Mono", monospace;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.track { height: 3px; background: var(--line); border-radius: 2px; margin-top: 9px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .4s ease; }
@media (prefers-reduced-motion: reduce) { .track i { transition: none; } }
.resume { margin: 9px 0 0; font-size: 15px; color: var(--muted); }
.resume:empty { display: none; }

/* ---------------- zone 2: the stream ---------------- */

main {
  flex: 1;
  padding: 20px 18px 40px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}
main:focus { outline: none; }

h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 4px 0 10px; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 26px 0 8px; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 22px 0 6px; }

#body p, #body li, .lede { font-size: 18px; line-height: 1.7; }
#body ul, #body ol { padding-left: 22px; }
#body li { margin: 5px 0; }
#body strong { font-weight: 600; }
#body blockquote {
  margin: 18px 0; padding: 2px 0 2px 15px;
  border-left: 3px solid var(--amber); color: var(--ink);
}
#body table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 16px; display: block; overflow-x: auto; }
#body th, #body td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); }
#body th { color: var(--muted); font-weight: 500; }
#body code {
  font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: .92em;
  background: var(--raised); padding: 1px 5px; border-radius: 4px;
}
#body img, #body svg { max-width: 100%; height: auto; }
#body hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

.objective {
  font-size: 16px; color: var(--muted); margin: 0 0 18px;
  padding-left: 14px; border-left: 2px solid var(--line);
}
.dated {
  font-size: 15px; color: var(--muted); margin: 0 0 18px;
  padding: 9px 13px; background: var(--raised); border-radius: 6px;
}

.card {
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; margin-bottom: 18px;
}
.lede { color: var(--ink); margin-top: 0; }
.note { font-size: 15px; color: var(--muted); margin: 12px 0 0; }
ul.plain { padding-left: 20px; margin: 12px 0; }
ul.plain li { margin: 7px 0; font-size: 16px; }

/* tool-layer inserts — durable intent, perishable visual */
.tool {
  border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: 14px 16px; margin: 18px 0; background: var(--raised);
}
.tool .intent { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.tool .detail { font-size: 16px; color: var(--muted); margin: 0; }
.tool ol { margin: 10px 0 0; padding-left: 20px; }
.tool ol li { font-size: 16px; margin: 7px 0; }
.tool .captured { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* interactive blocks */
.block { border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 22px 0; background: var(--raised); }
.block h2 { margin-top: 0; }
.q { margin: 18px 0; }
.q .stem { font-size: 17px; font-weight: 600; margin-bottom: 9px; }
.q .why { font-size: 15px; color: var(--muted); margin: 0 0 9px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer; font-size: 16px; background: transparent;
  color: inherit; text-align: left; width: 100%; font-family: inherit;
}
.opt:hover { border-color: var(--muted); }
.opt[aria-pressed="true"] { border-color: var(--amber); background: rgba(232,163,61,.10); }
.opt.correct { border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); }
.feedback { font-size: 16px; margin-top: 9px; padding-left: 13px; border-left: 2px solid var(--line); color: var(--muted); }
.feedback.ok { border-color: var(--ok); }
.feedback.no { border-color: var(--bad); }

/* verdicts from marking */
.verdict { margin-top: 14px; }
.crit { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.crit .mark { font-weight: 700; width: 1.4em; flex: none; }
.crit.met .mark { color: var(--ok); }
.crit.unmet .mark { color: var(--bad); }
.crit .quote { display: block; color: var(--muted); font-size: 15px; margin-top: 4px; font-style: italic; }

/* conversation turns */
.turn { margin: 20px 0; }
.turn .who {
  display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  margin-bottom: 5px;
}
.turn.me { border-left: 3px solid var(--amber); padding-left: 13px; }
.turn .text { font-size: 18px; line-height: 1.7; white-space: pre-wrap; }

/* composer */
.composer { display: flex; gap: 9px; align-items: flex-end; margin-top: 22px; }
.composer textarea {
  flex: 1; resize: vertical; min-height: 56px; padding: 11px 13px;
  font-family: inherit; font-size: 17px; line-height: 1.5;
  color: var(--ink); background: var(--raised);
  border: 1px solid var(--line); border-radius: 7px;
}
.composer-buttons { display: flex; flex-direction: column; gap: 7px; }

/* ---------------- zone 3: the task strip ---------------- */

footer {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--raised);
  border-top: 1px solid var(--line);
  padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
}
.taskhead { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.tasktext { font-size: 15px; color: var(--muted); margin-bottom: 11px; }
.tasktext:empty { display: none; }

/* ---------------- controls ---------------- */

button {
  font-family: inherit; font-size: 17px; font-weight: 600;
  padding: 13px 18px; border: none; border-radius: 7px; cursor: pointer;
  background: var(--ink); color: var(--paper); width: 100%;
}
button:hover { opacity: .9; }
button:disabled { opacity: .45; cursor: default; }
button.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); font-weight: 500;
}
.composer button { width: auto; padding: 11px 16px; font-size: 16px; }
#action-alt { margin-top: 8px; }

input, textarea {
  font-family: inherit; font-size: 17px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; padding: 12px 13px; width: 100%;
}
label { display: block; font-size: 15px; color: var(--muted); margin: 0 0 6px; }
form > * + * { margin-top: 12px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  background: var(--amber); color: #101823;
  padding: 12px 18px; font-size: 16px; font-weight: 600; text-align: center;
}

/* Mobile is read-and-review only (§2). Say so rather than degrading silently.
   Detect a TOUCH device, not a narrow window — the panel is designed to be ~500px
   wide beside a Claude window, and a width breakpoint calls that a phone. */
@media (pointer: coarse) and (max-width: 620px) {
  body::before {
    content: "Read-and-review on a phone. Submitting work needs a computer.";
    display: block; padding: 10px 18px; font-size: 15px;
    background: var(--raised); color: var(--muted);
    border-bottom: 1px solid var(--line);
  }
}

/* Evidence: folder first, paste behind a disclosure. */
.evidence { margin-top: 18px; }
.evidence .connected { font-size: 17px; margin: 0 0 10px; }
.evidence button.connect {
  width: 100%; font-family: inherit; font-size: 17px; font-weight: 600;
  padding: 14px 18px; border: none; border-radius: 8px;
  background: var(--ink); color: var(--paper); cursor: pointer;
}
.evidence button.connect:hover { opacity: .9; }
.paste-fallback { margin-top: 14px; }
.paste-fallback > summary {
  cursor: pointer; font-size: 16px; color: var(--muted); padding: 4px 0;
}
.paste-fallback > summary:hover { color: var(--ink); }
.paste-fallback textarea { margin-top: 10px; }

