/* openai/math follow-ons. Palette shared with the explorers (web/kit.css). */
:root {
  --bg: #f7f5f0; --panel: #ffffff; --ink: #1d1c1a; --muted: #6b675f; --line: #e3ded3; --soft: #efebe2;
  --accent: #b4441f; --accent2: #1f6f8b; --good: #2e7d4f; --warn: #a86a0a; --bad: #b3261e; --code: #f1ede4;
  --s1: #2e7d4f; --s2: #1f6f8b; --s3: #7a5aa6; --s4: #a86a0a; --s5: #6b675f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f; --panel: #1e1d18; --ink: #ece8de; --muted: #a39d90; --line: #34322b; --soft: #24231d;
    --accent: #e0774f; --accent2: #5fb3cf; --code: #26241e; --good: #5fbf85; --warn: #d9a441;
    --s1: #5fbf85; --s2: #5fb3cf; --s3: #b59be0; --s4: #d9a441; --s5: #a39d90;
  }
}
:root[data-theme="dark"] {
  --bg: #15140f; --panel: #1e1d18; --ink: #ece8de; --muted: #a39d90; --line: #34322b; --soft: #24231d;
  --accent: #e0774f; --accent2: #5fb3cf; --code: #26241e; --good: #5fbf85; --warn: #d9a441;
  --s1: #5fbf85; --s2: #5fb3cf; --s3: #b59be0; --s4: #d9a441; --s5: #a39d90;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent2); }
code, pre { font-family: var(--mono); font-size: .86em; }
:not(pre) > code { background: var(--code); padding: .05em .3em; border-radius: 4px; }
img { max-width: 100%; }
button, .btn { font: 500 .9rem var(--sans); border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: .45rem .8rem; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; gap: .4rem;
  align-items: center; }
button:hover, .btn:hover { border-color: var(--accent2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; }
textarea { width: 100%; min-height: 7rem; resize: vertical; }
label { display: block; font-size: .9rem; color: var(--muted); margin: .7rem 0 .25rem; }

header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  flex-wrap: wrap; }
.brand { font: 600 1.05rem var(--mono); color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
header.top nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
header.top nav a { padding: .3rem .65rem; border-radius: 7px; text-decoration: none; color: var(--ink); font-size: .93rem; }
header.top nav a.on { background: var(--soft); }
#who { font-size: .85rem; color: var(--muted); }
main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 70px; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 18px 20px 40px; text-align: center; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h2 { font-size: 1.45rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.12rem; margin: 1.4rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* home */
.hero { padding: 18px 0 6px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .6rem; }
.hero p { font: 1.12rem/1.6 var(--serif); max-width: 820px; margin: 0 0 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0 6px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.stat b { display: block; font: 600 1.7rem var(--serif); color: var(--accent); }
.stat span { font-size: .88rem; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none;
  color: var(--ink); display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent2); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--soft); object-fit: contain; width: 100%; display: block; }
.card .body { padding: 10px 13px 13px; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card .num { font: 600 .78rem var(--mono); color: var(--accent); }
.card .t { font: 600 1rem/1.3 var(--serif); }
.card .d { font-size: .86rem; color: var(--muted); }
.vcard .thumb { object-fit: cover; }
/* videos page: subject-area chips and groups */
.areas { display: flex; flex-wrap: wrap; gap: 6px; margin: 1rem 0 .2rem; }
.achip { font-size: .84rem; padding: .28rem .7rem; border-radius: 999px; }
.achip .n { margin-left: .45em; color: var(--muted); font: 500 .78rem var(--mono); }
.achip[aria-pressed="true"] { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.achip[aria-pressed="true"] .n { color: inherit; opacity: .8; }
.vgroup h2 { display: flex; align-items: baseline; gap: .55rem; font-size: 1.2rem; margin: 1.7rem 0 .75rem; }
.vgroup h2 .n { font: 500 .82rem var(--mono); color: var(--muted); }
@media (max-width: 640px) {
  .areas { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 0 16px 6px; scrollbar-width: thin; }
  .achip { flex: none; }
}
.vcard .play { position: relative; }
.vcard .play::after { content: "▶"; position: absolute; left: 12px; bottom: 10px; color: #fff; background: rgba(0,0,0,.55);
  border-radius: 999px; width: 34px; height: 34px; display: grid; place-items: center; font-size: .9rem; }
.hl { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.hl a { display: block; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--s1);
  border-radius: 10px; padding: 11px 14px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.hl a:hover { border-color: var(--accent2); border-left-color: var(--s1); }
.hl b { font-family: var(--serif); font-size: 1rem; }
.hl .when { float: right; font-size: .78rem; color: var(--muted); }
.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.feed li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: .93rem; }
/* home: the problem search, section heads with a "see all" link, and the dated activity feed */
.search { display: flex; gap: 8px; max-width: 720px; margin: 1.1rem 0 .4rem; }
.search input { flex: 1 1 auto; font-size: 1.05rem; padding: .62rem .8rem; border-radius: 10px; }
.search button { padding: .6rem 1.2rem; font-size: 1rem; border-radius: 10px; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.8rem; }
.head-row h2 { margin: 0 0 .7rem; }
.head-row a { font-size: .92rem; }
.activity li { display: flex; gap: .9rem; align-items: baseline; }
.activity .when { flex: none; width: 6.6rem; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .activity li { flex-direction: column; gap: .2rem; } .activity .when { width: auto; } }

/* chips */
.chip { display: inline-block; font: 600 .74rem var(--sans); padding: .14rem .5rem; border-radius: 999px; border: 1px solid currentColor;
  white-space: nowrap; letter-spacing: .01em; }
.s1 { color: var(--s1); } .s2 { color: var(--s2); } .s3 { color: var(--s3); } .s4 { color: var(--s4); } .s5 { color: var(--s5); }
.chip.tier { color: var(--muted); }
.chip.vid { color: var(--accent); }
.chip.pending { color: var(--warn); } .chip.accepted { color: var(--good); } .chip.rejected { color: var(--bad); }

/* problem list */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin: 10px 0 16px; }
.filters input[type=search] { flex: 1 1 260px; }
.filters label { margin: 0; display: inline-flex; gap: .3rem; align-items: center; color: var(--ink); }

/* problem page */
.pnav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.pn { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink); text-decoration: none; }
.pn small { color: var(--muted); font-size: .74rem; }
.pn span { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn b { font: 600 .84rem var(--mono); color: var(--accent); }
.pn.r { text-align: right; }
.pn.v { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.pn.off { opacity: .45; }
a.pn:hover { border-color: var(--accent2); }
.phead { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.phead .num { font: 600 1rem var(--mono); color: var(--accent); }
.phead h1 { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2.2rem); flex: 1 1 400px; }
.source { color: var(--muted); font-size: .9rem; margin: .4rem 0 1rem; }
.source p { margin: .2rem 0; }
.video { background: #0d1117; border-radius: 14px; overflow: hidden; margin: 14px 0 6px; }
.video video, .video canvas { width: 100%; display: block; aspect-ratio: 16 / 9; background: #0d1117; }
.vbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: 8px 4px; font-size: .9rem; }
.prose { font: 1.04rem/1.65 var(--serif); max-width: 860px; }
.prose table { border-collapse: collapse; font: .88rem/1.45 var(--sans); margin: .6rem 0; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .3rem .55rem; text-align: left; vertical-align: top; }
.prose pre { background: var(--code); padding: .7rem .9rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; line-height: 1.45; }
.prose img { display: block; margin: .6rem 0; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.prose .deadlink { border-bottom: 1px dotted var(--muted); }
.imp { border-left: 4px solid var(--s5); background: var(--panel); border-radius: 0 10px 10px 0; padding: 10px 14px; margin: .6rem 0;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.imp.s1 { border-left-color: var(--s1); } .imp.s2 { border-left-color: var(--s2); } .imp.s3 { border-left-color: var(--s3); }
.imp.s4 { border-left-color: var(--s4); }
.imp .chip { margin-right: .4rem; }
.imp div { color: var(--ink); font-size: .95rem; margin-top: .35rem; }
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.figs a { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: block; }
.figs img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; }
.figs figcaption { font: .74rem var(--mono); color: #6b675f; padding: 4px 8px; border-top: 1px solid #e3ded3; background: #faf8f3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer iframe { width: 100%; height: 860px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.pair { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin: 12px 0; overflow: hidden; }
.pair .ph { display: flex; gap: .7rem; flex-wrap: wrap; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--line);
  font-size: .88rem; background: var(--soft); }
.pair .cols { display: grid; grid-template-columns: 1fr 1fr; }
.pair .col { min-width: 0; }
.pair .col + .col { border-left: 1px solid var(--line); }
.pair .lab { font: 600 .74rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 7px 12px 0; }
.pair pre { margin: 0; padding: 6px 12px 12px; overflow-x: auto; font-size: .8rem; line-height: 1.5; }
.ratio { font: 600 .8rem var(--mono); }
.kw { color: var(--accent); font-weight: 600; }
.tac { color: var(--accent2); }
.cm { color: var(--muted); font-style: italic; }
.thm { color: var(--good); font-weight: 600; }
details.sat { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 8px 0; }
details.sat summary { padding: 8px 12px; cursor: pointer; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
details.sat pre { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); max-height: 640px; overflow: auto; font-size: .8rem; }
.checkout { margin: 0; padding: 10px 12px; border-top: 1px dashed var(--line); font: .8rem/1.45 var(--mono); white-space: pre-wrap;
  max-height: 360px; overflow: auto; }
.checkout .ok { color: var(--good); } .checkout .bad { color: var(--bad); }
details.more { margin-top: 2rem; }
details.more > summary { cursor: pointer; font: 600 1.1rem var(--serif); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 12px 0; }
.admin { border: 2px dashed var(--accent); }
.admin h3 { margin-top: 0; }
.followon { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; margin: 8px 0; }
.followon h4 { margin: 0 0 .3rem; font: 600 1rem var(--serif); }
.followon p { margin: .3rem 0; white-space: pre-wrap; font-size: .93rem; }
.note { font-size: .88rem; color: var(--muted); }
.ok { color: var(--good); } .err { color: var(--bad); }
.hp { position: absolute; left: -5000px; }
table.list { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: .4rem .5rem; text-align: left; vertical-align: top; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: grid; place-items: center; z-index: 50; padding: 20px; }
.lightbox img { max-height: 92vh; max-width: 96vw; background: #fff; border-radius: 8px; }
@media (max-width: 760px) {
  .pnav { grid-template-columns: 1fr 1fr; }
  .pair .cols { grid-template-columns: 1fr; }
  .pair .col + .col { border-left: 0; border-top: 1px solid var(--line); }
  .explorer iframe { height: 720px; }
  header.top { padding: 8px 12px; flex-wrap: wrap; row-gap: .3rem; }
  header.top nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  header.top nav a { flex: none; padding: .28rem .55rem; }
  #who { margin-left: auto; }
}

/* the video queue (admin) */
.qtable td { vertical-align: middle; }
.qtable .qn { cursor: grab; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.qtable tr.over td { border-top: 2px solid var(--accent); }
.qtable tr.live td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.qtable .qbtns { white-space: nowrap; }
.qtable .qbtns button { padding: .15rem .45rem; margin: 0 .1rem; }
details.qi summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
details.qi .prose { font-size: .9rem; margin: .4rem 0; }
@media (max-width: 640px) { .qtable th:nth-child(3), .qtable td:nth-child(3) { display: none; } }
.passes { color: var(--ink); margin: .2rem 0 .8rem; line-height: 1.6; }
.passes .pass { white-space: nowrap; }
