/* Shared by the making-of and event pages. Light by default; theme.js switches data-theme. Green highlight. */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f9faf8;
  --text: #17201a;
  --muted: #5f6d64;
  --line: #dfe5e0;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-ink: #ffffff;
  --me-bg: #d9f7e3;
  --me-text: #0f2a19;
  --them-bg: #ffffff;
  --chip: #eaefeb;
  --code-bg: #eef2ef;
  --shadow: 0 1px 2px rgba(15, 30, 20, .06), 0 4px 14px rgba(15, 30, 20, .05);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1110;
  --surface: #171b19;
  --surface-2: #131715;
  --text: #e8ece9;
  --muted: #95a29b;
  --line: #27302b;
  --accent: #3ddc84;
  --accent-strong: #3ddc84;
  --accent-ink: #062b16;
  --me-bg: #1d4a30;
  --me-text: #e7f8ee;
  --them-bg: #1f2522;
  --chip: #1f2622;
  --code-bg: #0b0e0d;
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* Making-of: the start screen's arcade palette. Dark is the start screen itself (black, yellow title, white text);
   light inverts it (yellow paper, black ink). */
:root.pac {
  --bg: #ffe94d;
  --surface: #fff8c9;
  --surface-2: #fff1a0;
  --text: #111008;
  --muted: #5c5520;
  --line: #e0c728;
  --accent: #111008;
  --accent-strong: #111008;
  --accent-ink: #ffe600;
  --me-bg: #111008;
  --me-text: #ffe600;
  --them-bg: #fffbe3;
  --chip: #ffe14a;
  --code-bg: #fff1a0;
  --shadow: 0 1px 0 rgba(17, 16, 8, .18);
  --nudge: #a8961f;
}
:root.pac[data-theme="dark"] {
  --bg: #000000;
  --surface: #121109;
  --surface-2: #0a0a05;
  --text: #f4f1e0;
  --muted: #9a9478;
  --line: #2e2b16;
  --accent: #ffe600;
  --accent-strong: #ffe600;
  --accent-ink: #000000;
  --me-bg: #ffe600;
  --me-text: #000000;
  --them-bg: #17160c;
  --chip: #1d1b0e;
  --code-bg: #0a0a05;
  --shadow: none;
  --nudge: #5d5830;
}
.pac h1 { font-family: "Press Start 2P", "Courier New", monospace; font-size: clamp(20px, 5.4vw, 30px); line-height: 1.35;
  letter-spacing: 0; color: var(--accent-strong); }
.pac .stat .v { font-family: "Press Start 2P", "Courier New", monospace; font-size: clamp(14px, 4vw, 18px); letter-spacing: 0; margin-bottom: 6px; }
.pac .item::before { border-radius: 50%; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 0 16px env(safe-area-inset-bottom);
}
.wrap { max-width: 720px; margin-left: auto; margin-right: auto; }
a { color: var(--accent-strong); }
button { font: inherit; color: inherit; }

.theme-toggle { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 20; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-size: 18px; cursor: pointer; }

/* Header */
.hero { padding: 44px 0 4px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent-strong); font-weight: 700; }
h1 { font-size: clamp(30px, 8vw, 44px); line-height: 1.08; margin: 8px 0 12px; letter-spacing: -.025em; padding-right: 48px; }
.lede { color: var(--muted); font-size: 17px; max-width: 58ch; margin-bottom: 18px; }
.lede p { margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  color: var(--accent-strong); text-decoration: none; border: 1px solid var(--line); background: var(--surface);
  padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.stat .v { font-size: clamp(20px, 6vw, 26px); font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .k { font-size: 13.5px; color: var(--text); font-weight: 600; line-height: 1.3; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.stat .v { color: var(--accent-strong); }

.explainer { margin-top: 12px; font-size: 14px; color: var(--muted); }
.explainer summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.explainer ul { padding-left: 18px; margin: 6px 0 0; }
.explainer li { margin: 6px 0; }
.explainer b { color: var(--text); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 12px; margin-top: 28px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 12px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

main { margin-top: 8px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* Timeline */
.day { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 14px 0 8px; margin: 0;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.list { position: relative; margin: 0 0 6px; padding: 0; list-style: none; }
.list::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.item { position: relative; padding-left: 30px; margin-bottom: 8px; }
.item::before { content: ""; position: absolute; left: 4px; top: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.item.manual::before { background: var(--bg); border: 2px solid var(--muted); width: 8px; height: 8px; }
.item details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.item.manual details { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.item summary { list-style: none; cursor: pointer; padding: 10px 14px 11px; display: block; }
.item summary::-webkit-details-marker { display: none; }
.kicker { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.item:not(.manual) .kicker { color: var(--accent-strong); }
.kicker .tok { flex: none; white-space: nowrap; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .line { display: block; font-weight: 560; }
.more-dots { color: var(--muted); font-weight: 700; }
/* Open: the row's sentence becomes the first chat message, so it isn't shown twice. */
.item:not(.manual) details[open] .line { display: none; }
/* Prompts are tagged by intent: a real ask shows in full, a nudge (merge conflicts, "defaults") is a small grey row. */
.item.intent .line { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 7;
  -webkit-box-orient: vertical; overflow: hidden; }
.item.intent details { border-left: 4px solid var(--accent); }
.item.nudge { margin-bottom: 4px; }
.item.nudge::before { width: 8px; height: 8px; left: 6px; top: 12px; background: var(--nudge, var(--muted)); }
.item.nudge details { background: none; border: 1px dashed var(--line); box-shadow: none; }
.item.nudge summary { padding: 5px 12px 6px; }
.item.nudge .kicker { color: var(--muted) !important; font-size: 10.5px; margin-bottom: 0; }
.item.nudge .line { font-weight: 400; font-size: 14px; color: var(--muted); }
.tag { display: inline-block; vertical-align: 1px; white-space: nowrap; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 10px;
  letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); }
.only-intent { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); margin-right: auto; cursor: pointer; }
.only-intent input { width: 18px; height: 18px; accent-color: var(--accent); }
body.hide-nudges .item.nudge { display: none; }
.item .body { padding: 2px 12px 14px; }
.item.manual .body { padding: 0 14px 14px; }

/* Chat */
.chat { display: flex; flex-direction: column; }
.msg { display: flex; flex-direction: column; margin: 6px 0; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; align-items: flex-start; }
.msg-note { font-size: 12px; color: var(--muted); margin: 0 6px 3px; font-weight: 600; }
.bubble { border-radius: 18px; padding: 9px 13px; max-width: 100%; }
.bubble.me { background: var(--me-bg); color: var(--me-text); border-bottom-right-radius: 5px; }
.bubble.them { background: var(--them-bg); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.clamp { cursor: pointer; }
.bubble.clamp .text { max-height: 12em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.attach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg.me .attach { justify-content: flex-end; }
.attach img { display: block; width: 132px; height: auto; max-height: 260px; object-fit: cover; object-position: top;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.steps { align-self: center; margin: 6px 0; font-size: 13px; color: var(--muted); max-width: 100%; }
.steps summary { cursor: pointer; text-align: center; list-style: none; padding: 3px 12px; border-radius: 999px; background: var(--chip); }
.steps summary::-webkit-details-marker { display: none; }
.steps[open] summary { margin-bottom: 6px; }
.steps .md { border-left: 2px solid var(--line); padding: 2px 0 2px 10px; margin: 6px 0 6px 4px; }
.steps-line { align-self: center; font-size: 13px; color: var(--muted); font-style: italic; margin: 6px 0; }
.turn-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center; }
.chip { background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip b { color: var(--text); font-weight: 600; }
.chip.model { color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.chip.fine { background: none; padding: 3px 4px; }
.commits { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13.5px; }
.commits li { margin: 4px 0; }
.commits a { color: var(--text); }
.commits code { color: var(--muted); font-size: 12.5px; }
.open-thread { align-self: center; margin-top: 12px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--accent-strong); }

/* Markdown */
.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 .6em; }
.md p:last-child, .md ul:last-child { margin-bottom: 0; }
.md ul { padding-left: 20px; margin: 0 0 .6em; }
.md code { background: var(--code-bg); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.md pre { background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 13px; white-space: pre-wrap; }
.md pre code { background: none; padding: 0; }
.md h4 { margin: .8em 0 .4em; font-size: 1em; }

/* Conversations list */
.convo-card { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; margin-top: 12px; cursor: pointer; box-shadow: var(--shadow); }
.convo-card .k { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-strong); }
.convo-card .t { font-weight: 700; font-size: 17px; margin: 2px 0 4px; }
.convo-card .first { color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.convo-card .m { font-size: 12.5px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }

/* Conversation dialog */
dialog#thread { border: 0; padding: 0; width: 100%; max-width: 720px; height: 100%; max-height: 100%; margin: auto;
  background: var(--bg); color: var(--text); }
@media (min-width: 760px) { dialog#thread { height: 90vh; border-radius: 18px; } }
dialog#thread::backdrop { background: rgba(0, 0, 0, .45); }
.thread-head { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.thread-head h2 { margin: 2px 0 0; font-size: 19px; line-height: 1.25; }
.close { border: 1px solid var(--line); background: var(--surface); border-radius: 50%; width: 40px; height: 40px; flex: none; cursor: pointer; font-size: 16px; }
.thread-body { display: flex; flex-direction: column; padding: 8px 14px calc(32px + env(safe-area-inset-bottom)); }
.turn-sep { align-self: center; scroll-margin-top: 100px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 4px; }
.turn-sep.target { color: var(--accent-strong); }

.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 32px 0 48px; }

.order-row { display: flex; justify-content: flex-end; margin-top: 8px; }
#order { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 13px;
  font-weight: 600; color: var(--muted); cursor: pointer; }

/* Before → after pairs for art a commit changed. */
.art-diff { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.art-diff figure { margin: 0; padding: 8px; background: #000; border-radius: 10px; display: grid;
  grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; gap: 4px; }
.art-diff a { display: flex; justify-content: center; min-width: 0; }
.art-diff img { display: block; height: 48px; width: auto; max-width: 100%; object-fit: contain; image-rendering: pixelated; }
.art-diff .arrow, .art-diff .none { color: #9aa; font-size: 13px; }
.art-diff figcaption { grid-column: 1 / -1; text-align: center; color: #cdd; font-size: 12px; word-break: break-all; }
.shot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.shot-pair figure { margin: 0; }
.shot-pair img { display: block; width: 100%; border-radius: 10px; }
.shot-pair figcaption { text-align: center; color: var(--muted); font-size: 12px; margin-top: 4px; }
