/* Curious app shell. Same Swiss-grid voice as the courses: black type, one red, heavy rules, no radius. */
:root {
  --bg: #f4f4f2; --surface: #fff; --fg: #111; --muted: #55585c; --line: #111; --hair: #c9c9c4;
  --accent: #d81e1e; --soft: #e9e9e5; --ok: #1b6e3a;
  --body: "Archivo", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #141414; --surface: #1c1c1c; --fg: #f2f2ef; --muted: #a3a3a0; --line: #f2f2ef; --hair: #3a3a38;
  --accent: #ff4d4d; --soft: #242423; --ok: #5ad58a; color-scheme: dark;
} }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--body); }
a { color: var(--accent); }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; font-size: 17px; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 0; }
.actions form { margin: 0; }
.actions a { color: var(--fg); text-decoration: none; font-weight: 600; padding: 8px 0; }
.actions a:hover { color: var(--accent); }
.actions a[aria-current="page"] { text-decoration: underline 2px var(--accent); text-underline-offset: 6px; }
.me { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.me .short { display: none; }
@media (max-width: 479px) { .me .who { display: none; } .me .short { display: inline; } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.shell { max-width: 880px; margin: 0 auto; padding: 32px 16px 80px; }
.eyebrow, .stats dt { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { margin: 0 0 4px; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 24px; }
.note { color: var(--muted); font-size: 14px; }
.flash { max-width: 880px; margin: 16px auto 0; padding: 0 16px; font-size: 14px; }
.flash.alert { color: var(--accent); } .flash.notice { color: var(--ok); }
pre { background: var(--surface); border: 1px solid var(--hair); padding: 12px; overflow: auto; }

.courses, .history .attempts { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--line); }
/* The claim's 303 lands on #course-<slug>: keep the title clear of the 67 px sticky top bar. */
.course { border-bottom: 1px solid var(--hair); scroll-margin-top: 80px; }
.course > a { display: grid; gap: 4px; padding: 18px 0; color: var(--fg); text-decoration: none; }
.course > a:hover .t { color: var(--accent); }
.course .t { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.course .s { color: var(--muted); }
.course .d, .course .p { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.course .bar { display: block; height: 8px; background: var(--soft); margin-top: 6px; overflow: hidden; }
.course .bar i { display: block; height: 100%; background: var(--accent); }
.course.done .bar i { background: var(--ok); }
.course .go { color: var(--accent); font-weight: 600; }
.course :is(.p, .links) .seg { display: inline-block; }
/* The card's link row: the card link's sibling (S03; S04-S08 add items). */
.course .links { margin: -12px 0 0; padding: 0 0 14px; font-size: 13px; color: var(--muted); }
/* 40 px tap target; the negative margin keeps the line box. */
.course .links a { display: inline-block; padding: 10px 0; margin: -6px 0; font-weight: 600; }
/* "PDF" is one short word: widen its hit box to 40 px without moving it (S05). */
.course .links a[href$=".pdf"] { padding-inline: 8px; margin-inline: -8px; }
/* The suggested next course (L5 S05): a line under a completed card on /me, a strip above the catalog. */
.course .next { margin: 0; padding: 0 0 14px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.course .next > span, .course .next > a { display: block; }
.course .next .lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
/* 40 px tap target; the negative margin keeps the line box and position: relative paints the link over the block after it. */
.course .next a { position: relative; padding: 10px 0; margin: -6px 0; font-weight: 600; font-size: 15px; line-height: 1.4; }
section.next { margin: 0 0 24px; padding: 12px 0 14px; border-top: 2px solid var(--line); border-bottom: 1px solid var(--hair); overflow-wrap: anywhere; }
section.next .eyebrow { margin: 0; }
section.next p { margin: 0; }
section.next .t { font-weight: 700; font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; }
section.next .t a { display: block; position: relative; padding: 10px 0; margin: -6px 0; color: var(--fg); text-decoration: none; }
section.next .t a:hover { color: var(--accent); }
section.next .why { font-size: 14px; }
section.next .after { font-size: 13px; color: var(--muted); }

/* Quizzes and briefs (S08): one row per attempt; the time never breaks inside itself. */
.history .attempts li { display: flex; flex-wrap: wrap; column-gap: 16px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.history .attempts time { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: 13px; }
/* The questions an attempt missed (L4 S02): a line of its own under the score and time. */
.history .attempts .missed { flex-basis: 100%; font-size: 14px; }
/* A module's brief under its attempts (L4 S04): the TA's text on the surface with an accent rule, capped at the courses' 72ch while the box stays full width; a line under the heading names the attempt it was written on. S05 links #brief-m<n>, kept clear of the sticky top bar. */
.history .brief { margin: 12px 0 8px; padding: 12px 16px 14px; background: var(--surface); border-left: 3px solid var(--accent); overflow-wrap: anywhere; scroll-margin-top: 80px; }
.history .brief > * { max-width: 72ch; }
.history .brief h3 { margin: 0; font-size: 16px; }
.history .brief .for { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.history .brief time { white-space: nowrap; }
.history .brief p, .history .brief ul { margin: 8px 0 0; }
.history .brief ul { padding-left: 20px; }
.history .brief code { font-size: 14px; background: var(--soft); padding: 0 3px; }

/* /me: the stat row and the last 7 days. */
h2.eyebrow { margin-top: 32px; }
#recap .note { margin: 0 0 8px; padding-top: 10px; border-top: 2px solid var(--line); }
.stats { display: grid; margin: 0 0 32px; border-top: 2px solid var(--line); }
.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.stats dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats div { display: block; border-bottom: 0; padding: 12px 16px 14px 0; }
  .stats div + div { padding-left: 16px; border-left: 1px solid var(--hair); }
  .stats dd { font-size: 24px; text-align: left; }
}
.week { list-style: none; margin: 0 0 40px; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px;
  font-size: 12px; line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; }
.week .col { display: flex; align-items: flex-end; height: 96px; margin-bottom: 6px; box-shadow: inset 0 -1px var(--hair); }
.week .col i { width: 100%; background: var(--accent); }
.week .on .col { box-shadow: inset 0 -4px var(--accent); }
.week time { display: block; font-weight: 600; }
.week [aria-current] time { color: var(--fg); }

/* Notifications on /me (L5 S02). /me#notifications is S04's push path: a landing clears the 67 px sticky top bar. The switch buttons get a real 40 px box (no negative margin), so the two targets never overlap; the Sign out button is not under #notifications. */
#notifications { scroll-margin-top: 80px; }
#notifications h3.eyebrow { margin-top: 24px; }
.switches { border-top: 2px solid var(--line); }
.switch { padding: 10px 0 2px; border-bottom: 1px solid var(--hair); }
.switch .note { margin: 0 0 4px; }
#notifications button.link { min-height: 40px; }
/* What was sent: the courses' list rhythm. The TA's words and a long token wrap inside the row; the paragraph keeps the courses' 72ch. */
.sent { list-style: none; margin: 0 0 8px; padding: 0; border-top: 2px solid var(--line); }
.sent li { padding: 10px 0; border-bottom: 1px solid var(--hair); overflow-wrap: anywhere; }
.sent p { margin: 0; }
.sent .what { font-weight: 700; }
.sent .meta { font-size: 13px; color: var(--muted); }
.sent .meta time { white-space: nowrap; }
.sent .detail { margin-top: 8px; max-width: 72ch; }

.auth, .claim form { max-width: 380px; }
.auth form, .claim form { display: grid; gap: 6px; }
:is(.auth, .claim) label { font-size: 13px; color: var(--muted); margin-top: 10px; }
/* Not the submit (it is a .btn); min-width 0, since Rails sets size= from maxlength. */
:is(.auth, .claim) input:not([type=submit]) { font: inherit; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); min-width: 0; }
/* Rails wraps a refused field in a div; keep its label and input grid items. */
.field_with_errors { display: contents; }
:is(.auth, .claim) .field_with_errors input { border-color: var(--accent); }
.btn { margin-top: 16px; font: inherit; font-weight: 600; padding: 10px 16px; background: var(--fg); color: var(--bg); border: 0; cursor: pointer; }
.btn:hover { background: var(--accent); color: var(--bg); }
.errors { color: var(--accent); font-size: 14px; padding-left: 18px; }
/* The withdraw page (S06): a name of up to 100 letters with no space still fits a phone. */
.claim .issued { overflow-wrap: anywhere; }
/* The way back under the claim and withdraw forms: a 40 px tap target, as the card's links. */
.claim > p.note a { display: inline-block; padding: 10px 0; margin: -6px 0; }

/* The verify page (S04): its own layout; every rule sits under body.verify, so none reaches an app page. */
body.verify .topbar { position: static; }
body.verify .cert { max-width: 600px; border-top: 2px solid var(--line); padding-top: 14px; }
body.verify .cert h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
body.verify .cert .course-title { margin: 0 0 16px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
/* The self-reported caveat qualifies every fact above it: full colour, not the muted .note. */
body.verify .cert .caveat { margin: 24px 0 0; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 14px; }
/* End of the verify page (S04). */
