/* Plethora AI Playground.
   Light theme in the karimbenammar.com family: white ground, clear blues, red for warnings.
   Dark theme available behind the toggle. Tokens on :root; dark overrides on [data-theme="dark"]. */

:root {
  /* Plethora: white ground, the karimbenammar.com blues, red for warnings. */
  --bg: #ffffff;
  --panel: #f6f9fd;
  --panel-2: #eaf2ff;
  --border: #dce7f5;
  --text: #1a2230;
  --muted: #5b6b7e;
  --accent: #2e6fb8;
  --accent-strong: #1f5a9e;
  --accent-soft: #7db3e8;
  --on-accent: #ffffff;
  --red: #e2574c;
  --max: 46rem;
}

[data-theme="dark"]. */

:root {
  /* THNK School of Leadership palette: off-white ground, THNK blue, THNK red, ink. */
  --bg: #f2f4f6;
  --panel: #ffffff;
  --panel-2: #e8f0fb;
  --border: #d3dbe4;
  --text: #26343f;
  --muted: #5a6875;
  --accent: #3f86e0;
  --accent-strong: #2c6fc6;
  --accent-soft: #93bcee;
  --on-accent: #ffffff;
  --red: #e5473d;
  --max: 46rem;
}

[data-theme="dark"] {
  --bg: #0b0e14;
  --panel: #131a26;
  --panel-2: #1a2333;
  --border: #22304a;
  --text: #e8eef7;
  --muted: #93a3b8;
  --accent: #7db3e8;
  --accent-strong: #4f9de8;
  --accent-soft: #2e6fb8;
  --on-accent: #0b0e14;
  --red: #ff5d5d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 1.15rem;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site {
  padding: 2.2rem 1.2rem 1.2rem;
  max-width: var(--max);
  margin: 0 auto;
  position: relative;
}
header.site .kicker {
  color: var(--accent);
  letter-spacing: 0.22em;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
}
header.site h1 {
  margin: 0.3rem 0 0.4rem;
  font-size: 2.1rem;
  line-height: 1.15;
}
header.site .tagline { color: var(--muted); margin: 0; }
header.site .back { font-size: 0.9rem; display: inline-block; margin-bottom: 1rem; }

.theme-btn {
  position: absolute;
  top: 1.2rem; right: 1.2rem;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font: inherit; font-size: 0.82rem;
  cursor: pointer;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-soft); }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.2rem 4rem;
}

h2 { font-size: 1.45rem; margin: 2.6rem 0 0.7rem; line-height: 1.2; color: var(--accent); }
h2 .stepno { color: var(--text); }
h3 { font-size: 1.12rem; margin: 1.8rem 0 0.5rem; }
p { margin: 0.8rem 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.4rem 0; }
ul, ol { margin: 0.8rem 0; padding-left: 1.4rem; }
li { margin: 0.35rem 0; }
blockquote {
  margin: 1rem 0; padding: 0.1rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  color: var(--text);
}
strong { color: var(--text); }
code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  font-size: 0.92em;
}

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.98rem; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
th { background: var(--panel); color: var(--accent); }
.tablewrap { overflow-x: auto; }

/* code blocks with copy button */
.codewrap { position: relative; margin: 1rem 0; }
.codewrap pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}
.codewrap pre code { background: none; border: none; padding: 0; font-size: inherit; }
.codewrap .copy {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--bg); color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 6px; padding: 0.25rem 0.7rem;
  font: inherit; font-size: 0.8rem; cursor: pointer;
}
.codewrap .copy:hover { border-color: var(--accent); }

/* picker bar */
.picker {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 1.4rem 0;
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; align-items: center;
  position: sticky; top: 0; z-index: 5;
}
.picker .group { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.picker .label { color: var(--muted); font-size: 0.85rem; margin-right: 0.2rem; }
.picker button {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.3rem 0.85rem; font: inherit; font-size: 0.88rem; cursor: pointer;
}
.picker button.active {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700;
}

/* variant blocks */
.variant[hidden] { display: none; }
.variant {
  border-left: 3px solid var(--accent-soft);
  padding-left: 1rem;
  margin: 1rem 0;
}
.variant .vtag {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); font-weight: 700;
  margin-bottom: 0.1rem;
}

/* checkpoints */
.check {
  display: flex; gap: 0.7rem; align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin: 1.3rem 0;
  cursor: pointer;
}
.check input { margin-top: 0.3rem; width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.check.done { border-color: var(--accent-soft); background: var(--panel-2); }
.check.done span { color: var(--muted); }
.check .checklabel::before {
  content: "Checkpoint";
  display: block;
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}

/* depth expanders */
details.depth {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.2rem 1rem;
  margin: 1rem 0;
}
details.depth summary {
  cursor: pointer; padding: 0.6rem 0; color: var(--accent); font-weight: 700;
  list-style: none;
}
details.depth summary::before { content: "+ "; }
details.depth[open] summary::before { content: "− "; }

/* "if you get stuck" boxes: the go-meta thread */
.meta {
  background: var(--panel-2);
  border: 1px dashed var(--accent-strong);
  border-radius: 10px;
  padding: 0.7rem 1.1rem 0.4rem;
  margin: 1.2rem 0;
  font-size: 0.97rem;
}
.meta .mlabel {
  display: block;
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
  margin-bottom: 0.1rem;
}

/* asides */
.note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.2rem 1rem;
  margin: 1rem 0;
  font-size: 0.98rem;
}

/* progress */
.progress { color: var(--muted); font-size: 0.88rem; margin-left: auto; }
.progress b { color: var(--accent); }

/* password gate */
.gate {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.gate .box {
  max-width: 24rem; width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem;
}
.gate .kicker {
  color: var(--accent); letter-spacing: 0.22em; font-weight: 700;
  font-size: 0.78rem; text-transform: uppercase;
}
.gate h2 { margin: 0.3rem 0 0.6rem; color: var(--text); }
.gate p { color: var(--muted); font-size: 0.95rem; }
.gate input {
  width: 100%; margin: 0.6rem 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.8rem; font: inherit;
}
.gate button {
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 8px;
  padding: 0.55rem 1.2rem; font: inherit; font-weight: 700; cursor: pointer;
}
.gate .wrong { color: var(--red); font-size: 0.9rem; min-height: 1.2em; margin: 0.3rem 0 0; }

/* ------- shell (index) ------- */
.hero {
  max-width: var(--max); margin: 0 auto; padding: 3.5rem 1.2rem 1rem;
  position: relative;
}
.hero .kicker { color: var(--accent); letter-spacing: 0.25em; font-weight: 700; font-size: 0.85rem; }
.hero h1 { font-size: 2.7rem; margin: 0.4rem 0 0.6rem; line-height: 1.1; }
.hero .tagline { font-size: 1.25rem; color: var(--text); margin: 0 0 1rem; }
.hero .tagline em { color: var(--accent); font-style: normal; font-weight: 700; }
.hero .theme-btn { top: 1.4rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1.6rem 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.2rem 1rem;
  display: flex; flex-direction: column;
}
.card .sess { color: var(--accent); font-size: 0.78rem; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 700; }
.card h3 { margin: 0.35rem 0 0.5rem; font-size: 1.2rem; }
.card p { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.96rem; flex: 1; }
.card .go {
  align-self: flex-start;
  background: var(--accent); color: var(--on-accent); font-weight: 700;
  border-radius: 8px; padding: 0.45rem 1rem;
}
.card .go:hover { text-decoration: none; filter: brightness(1.08); }
.card .soon {
  align-self: flex-start;
  color: var(--muted); border: 1px dashed var(--border);
  border-radius: 8px; padding: 0.45rem 1rem; font-size: 0.9rem;
}
.card.open { border-color: var(--accent-soft); }

.cliplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; margin: 1rem 0; }
.clip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.92rem;
}
.clip .n { color: var(--accent); font-weight: 700; margin-right: 0.4rem; }
.clip .soonbadge { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.clip .newbadge { display: block; color: var(--red); font-size: 0.78rem; margin-top: 0.15rem; }
.clip.q { border-left: 3px solid var(--accent); }
.clip.q .qmark { color: var(--accent); font-weight: 700; }

footer.site {
  max-width: var(--max); margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
  color: var(--muted); font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

/* ------- two ways in ------- */
main.wide { max-width: 72rem; }

.entry {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem 1.6rem;
  margin: 1rem 0 2rem;
}
.entry h2 { margin: 0 0 0.4rem; }
.entry p { margin: 0 0 1rem; color: var(--muted); }
.entry-btns { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.entry-btn {
  flex: 1 1 14rem;
  background: var(--bg); color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  font: inherit; font-size: 1.05rem; font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.entry-btn small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }
.entry-btn:hover { background: var(--panel-2); }
.entry-btn.active { background: var(--accent); color: var(--on-accent); }
.entry-btn.active small { color: var(--on-accent); opacity: 0.85; }

.twoways { display: grid; gap: 2.2rem; align-items: start; }
@media (min-width: 900px) {
  .twoways { grid-template-columns: 5fr 4fr; }
  [data-entry="build"] .twoways { grid-template-columns: 4fr 5fr; }
}
[data-entry="build"] .way-lecture { order: 2; }
[data-entry="build"] .way-build { order: 1; }
.way > h2:first-child { margin-top: 0.5rem; }
.way .cards { grid-template-columns: 1fr; }

/* lecture as compact lists */
.lecl { list-style: none; padding: 0; margin: 0.4rem 0 1.6rem; }
.lecl li {
  padding: 0.42rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.97rem;
  display: flex; gap: 0.6rem; align-items: baseline;
}
.lecl .n { color: var(--accent); font-weight: 700; min-width: 1.4rem; text-align: right; }
.lecl .b { margin-left: auto; font-size: 0.78rem; white-space: nowrap; }
.lecl .b.soon { color: var(--muted); }
.lecl .b.new { color: var(--red); }

.tryit {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.97rem;
}
.tryit .q { font-weight: 700; color: var(--accent); }
.tryit p { margin: 0.4rem 0 0.6rem; color: var(--muted); font-size: 0.92rem; }
.simlinks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.simlink {
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.88rem;
  color: var(--accent);
}
.simlink:hover { background: var(--panel-2); text-decoration: none; }

/* ------- centaur meter ------- */
.meter {
  position: fixed;
  right: 1.2rem; bottom: 1.2rem;
  z-index: 20;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(20, 40, 80, 0.12);
  padding: 0.8rem 1rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.meter { cursor: pointer; }
.meter .figs { display: flex; gap: 0.4rem; align-items: flex-end; }
.meter .fig {
  position: relative;
  width: 56px; height: 63px;
}
.meter .fig .base, .meter .fig .fill {
  position: absolute; left: 0; bottom: 0;
  width: 56px; height: 63px;
  -webkit-mask-image: url(centaur.png);
  mask-image: url(centaur.png);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: bottom center; mask-position: bottom center;
  mask-mode: luminance;
  -webkit-mask-source-type: luminance;
}
.meter .fig .base { background: var(--border); }
.meter .fillwrap {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 0%;
  overflow: hidden;
  transition: height 0.7s ease;
}
.meter .fig.c1 .fill { background: #3f86e0; }
.meter .fig.c2 .fill { background: #e5473d; }
.meter .fig.c3 .fill { background: #26343f; }
.meter .mtext { line-height: 1.25; }
.meter .mtext b { display: block; font-size: 1.3rem; color: var(--accent); }
.meter .mtext span { color: var(--muted); font-size: 0.8rem; }

.meter.bump .fig.current { animation: stomp 0.7s ease; }
@keyframes stomp {
  0% { transform: none; }
  30% { transform: translateY(-5px) rotate(-4deg); }
  55% { transform: translateY(0) rotate(2deg); }
  75% { transform: translateY(-2px) rotate(0); }
  100% { transform: none; }
}
.meter .fig.dance { animation: dance 1.6s ease; }
@keyframes dance {
  0% { transform: none; }
  15% { transform: translateY(-7px) rotate(-6deg); }
  30% { transform: translateY(0) rotate(4deg); }
  45% { transform: translateY(-5px) rotate(-3deg); }
  60% { transform: translateY(0) rotate(3deg); }
  75% { transform: translateY(-2px) rotate(-1deg); }
  100% { transform: none; }
}

@media (max-width: 700px) {
  .meter { padding: 0.5rem 0.7rem; }
  .meter .fig, .meter .fig .base, .meter .fig .fill { width: 38px; height: 43px; }
  .meter .mtext b { font-size: 1.05rem; }
  .meter .mtext span { display: none; }
}

/* locked day tabs */
.daytabs button.locked {
  opacity: 0.45;
  border-style: dashed;
  cursor: not-allowed;
}

/* teacher day toggles */
.daytoggles { display: flex; gap: 0.4rem; align-items: center; }
.daytoggles .label { color: var(--muted); font-size: 0.82rem; }
.daytoggles button {
  background: var(--panel); color: var(--muted);
  border: 1px dashed var(--border); border-radius: 999px;
  padding: 0.25rem 0.8rem; font: inherit; font-size: 0.84rem; cursor: pointer;
}
.daytoggles button.open {
  background: var(--accent); color: var(--on-accent);
  border: 1px solid var(--accent); font-weight: 700;
}

@media (max-width: 600px) {
  .hero h1 { font-size: 2rem; }
  .picker { position: static; }
}

/* ================= sandbox studio ================= */

.studio-shell {
  display: grid;
  grid-template-columns: minmax(24rem, 5fr) minmax(24rem, 4fr);
  gap: 1.4rem;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1.2rem 3rem;
  align-items: start;
}
@media (max-width: 980px) {
  .studio-shell { grid-template-columns: 1fr; }
}

.topbar {
  max-width: 90rem;
  margin: 0 auto;
  padding: 1rem 1.2rem 0.6rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.topbar .kicker { color: var(--accent); letter-spacing: 0.18em; font-weight: 700; font-size: 0.78rem; text-transform: uppercase; }
.topbar .who { color: var(--muted); font-size: 0.9rem; margin-left: auto; }
.topbar .who a { color: var(--muted); text-decoration: underline; }
.topbar .who a:hover { color: var(--accent); }
.topbar .theme-btn { position: static; }
.daytabs { display: flex; gap: 0.4rem; }
.daytabs button {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.35rem 1rem; font: inherit; font-size: 0.9rem; cursor: pointer;
}
.daytabs button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

.guide {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.4rem 1.4rem 1.4rem;
}

/* right column */
.workbench {
  display: flex; flex-direction: column; gap: 1rem;
  position: sticky; top: 0.8rem;
  max-height: calc(100vh - 1.6rem);
  overflow-y: auto;
}
@media (max-width: 980px) { .workbench { position: static; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: center; gap: 0.6rem;
}
.panel h4 .spacer { margin-left: auto; }

/* file drawer */
.drawer .tree { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88rem; line-height: 1.7; }
.drawer .dir { color: var(--muted); }
.drawer .file {
  cursor: pointer; color: var(--text);
  border-radius: 5px; padding: 0 0.3rem;
}
.drawer .file:hover { background: var(--panel-2); color: var(--accent); }
.drawer .file.flash { animation: fileflash 1.6s ease; }
@keyframes fileflash {
  0% { background: var(--accent); color: var(--on-accent); }
  100% { background: transparent; }
}
.drawer .actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.smallbtn {
  background: var(--bg); color: var(--accent);
  border: 1px solid var(--accent-soft); border-radius: 7px;
  padding: 0.3rem 0.8rem; font: inherit; font-size: 0.84rem; cursor: pointer;
}
.smallbtn:hover { background: var(--panel-2); }
.smallbtn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

/* team tabs */
.teamtabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.teamtabs button {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.25rem 0.9rem; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.teamtabs button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

/* chat */
.chatbox { display: flex; flex-direction: column; min-height: 20rem; }
.chatlog {
  flex: 1;
  overflow-y: auto;
  max-height: 26rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.4rem 0.2rem;
}
.msg { max-width: 92%; border-radius: 12px; padding: 0.55rem 0.85rem; font-size: 0.95rem; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.msg.user a { color: var(--on-accent); text-decoration: underline; }
.msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); }
.msg.bot pre {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.6rem; overflow-x: auto; font-size: 0.84rem; margin: 0.5rem 0;
}
.msg .saverow { margin-top: 0.4rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.msg.sys { align-self: center; color: var(--muted); font-size: 0.82rem; background: none; }
.chatrow { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.chatrow textarea {
  flex: 1; resize: none; height: 3.2rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.8rem; font: inherit; font-size: 0.95rem;
}
.chatrow button {
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 10px; padding: 0 1.1rem;
  font: inherit; font-weight: 700; cursor: pointer;
}
.chatrow button:disabled { opacity: 0.5; cursor: default; }
.chatactions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; align-items: center; }
.budget { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.budget .bar { width: 70px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.budget .bar i { display: block; height: 100%; background: var(--accent); }
.budget.warn .bar i { background: var(--red); }

/* questions */
.qlist { display: flex; flex-direction: column; gap: 0.45rem; max-height: 14rem; overflow-y: auto; }
.qitem {
  display: flex; gap: 0.6rem; align-items: baseline;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0.4rem;
}
.qitem .who { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.qitem .plus { margin-left: auto; }
.qitem.answered { opacity: 0.5; text-decoration: line-through; }
.qask { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.qask input {
  flex: 1; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.45rem 0.7rem; font: inherit; font-size: 0.9rem;
}
.handbtn.raised { background: var(--red); color: #fff; border-color: var(--red); }

/* modal editor */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 20, 40, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal .box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  width: min(46rem, 100%); max-height: 90vh;
  display: flex; flex-direction: column; padding: 1.1rem;
}
.modal .box h3 { margin: 0 0 0.6rem; font-family: ui-monospace, Menlo, monospace; font-size: 1rem; }
.modal textarea {
  flex: 1; min-height: 16rem; resize: vertical;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0.8rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.86rem; line-height: 1.5;
}
.modal .row { display: flex; gap: 0.5rem; margin-top: 0.8rem; justify-content: flex-end; }

/* join screen */
.join {
  max-width: 26rem; margin: 4rem auto; padding: 0 1.2rem;
}
.join .box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.6rem;
}
.join input, .join select {
  width: 100%; margin: 0.4rem 0 0.9rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.8rem; font: inherit;
}
.join label { font-size: 0.85rem; color: var(--muted); }
.join button {
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 8px; padding: 0.6rem 1.3rem;
  font: inherit; font-weight: 700; cursor: pointer;
}
.join .fine { color: var(--muted); font-size: 0.82rem; margin-top: 0.9rem; }

/* ================= teacher dashboard ================= */
.dash { max-width: 90rem; margin: 0 auto; padding: 0 1.2rem 3rem; }
.dashgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.9rem; margin: 1rem 0; }
.scard {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 1rem; display: flex; gap: 0.8rem; align-items: center;
}
.scard .fig { position: relative; width: 44px; height: 50px; flex: none; }
.scard .fig .base, .scard .fig .fill {
  position: absolute; left: 0; bottom: 0; width: 44px; height: 50px;
  -webkit-mask-image: url(centaur.png); mask-image: url(centaur.png);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: bottom center; mask-position: bottom center;
  mask-mode: luminance; -webkit-mask-source-type: luminance;
}
.scard .fig .base { background: var(--border); }
.scard .fillwrap { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; overflow: hidden; transition: height 0.5s; }
.scard .fig .fill { background: var(--accent); }
.scard .info { min-width: 0; }
.scard .nm { font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.scard .hand { color: var(--red); font-size: 1rem; }
.scard .st { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .pc { color: var(--accent); font-weight: 700; }
.scard.stale { opacity: 0.45; }

.dash.wall .dashgrid { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.dash.wall .scard { flex-direction: column; text-align: center; padding: 1.2rem; }
.dash.wall .scard .fig, .dash.wall .scard .fig .base, .dash.wall .scard .fig .fill { width: 90px; height: 101px; }
.dash.wall .scard .st { display: none; }
.dash.wall .qpanel { display: none; }

.msg .saverow .smallnote { font-size: 0.8rem; color: var(--muted, #6a6f73); font-style: italic; }

.meta.lost { border-color: #e5473d; background: rgba(229,71,61,0.08); }
.meta.lost .smallbtn { margin-left: 0.5rem; }

.drawer .takehome { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.drawer .takehome span { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted, #6a6f73); margin-right: 0.2rem; }

/* ---- session 2: the builder ---- */
.topbar a.kicker { text-decoration: none; color: inherit; }
.buildframe-wrap { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; aspect-ratio: 4 / 3; margin: 0.4rem 0 0.6rem; }
.buildframe-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.buildempty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; color: var(--muted); font-size: 0.95rem; }
.buildlog { max-height: 9rem; }
.buildlink { margin-top: 0.5rem; font-size: 0.9rem; word-break: break-all; }
.buildlink a { color: var(--accent); }
@media (max-width: 980px) { .buildframe-wrap { aspect-ratio: 3 / 4; } }

/* ---- landing and lecture pages ---- */
.landing { max-width: 60rem; margin: 0 auto; padding: 2rem 1.2rem 4rem; }
.landing .hero { text-align: center; padding: 2rem 0 1rem; }
.landing .hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0.2rem 0 0.6rem; }
.landing .hero p { color: var(--muted); font-size: 1.15rem; max-width: 38rem; margin: 0 auto; }
.landing .kick { color: var(--accent); letter-spacing: 0.2em; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; }
.entry { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 2rem 0; }
@media (max-width: 720px) { .entry { grid-template-columns: 1fr; } }
.entry a { display: block; padding: 1.6rem 1.4rem; border: 2px solid var(--border); border-radius: 14px; background: var(--panel); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.entry a:hover { border-color: var(--accent); transform: translateY(-2px); }
.entry a b { display: block; font-size: 1.35rem; margin-bottom: 0.3rem; }
.entry a small { color: var(--muted); font-size: 0.98rem; }
.landing .fine { color: var(--muted); font-size: 0.9rem; text-align: center; }
.langbar { text-align: right; font-size: 0.9rem; padding: 0.6rem 0; }
.langbar a { color: var(--muted); margin-left: 0.8rem; text-decoration: none; }
.langbar a.on { color: var(--accent); font-weight: 700; }
.lecture h2 { margin: 2.4rem 0 0.4rem; font-size: 1.5rem; }
.lecture h2 small { display: block; color: var(--muted); font-weight: 400; font-size: 1rem; }
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.slide { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.slide img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.slide .body { padding: 0.8rem 0.9rem 0.9rem; flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.slide .body b { font-size: 1.02rem; }
.slide .body span { color: var(--muted); font-size: 0.92rem; }
.slide .vid { margin-top: auto; font-size: 0.78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.slide .vid i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--border); display: inline-block; }
.slide.door { border-color: var(--accent); }
.slide.door .body a.go { margin-top: auto; align-self: flex-start; background: var(--accent); color: var(--on-accent); padding: 0.45rem 0.9rem; border-radius: 8px; text-decoration: none; font-weight: 700; font-size: 0.9rem; }

[hidden] { display: none !important; }

/* ---- working indicator: a thin turning ring, not a beachball ---- */
@keyframes pp-spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: pp-spin 0.9s linear infinite; vertical-align: -0.2rem; margin-right: 0.45rem; }
.spin.big { width: 2.2rem; height: 2.2rem; border-width: 3px; margin: 0 0 0.8rem; }
.msg.sys.busy { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.buildbusy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,0.86); color: var(--accent); font-weight: 600; text-align: center; padding: 1rem; }
[data-theme="dark"] .buildbusy { background: rgba(11,14,20,0.86); }
.chatactions .smallbtn:disabled, #buildbtn:disabled, #sendbtn:disabled { opacity: 0.5; cursor: wait; }

/* ---- session 2 layout: the website across two thirds, the dialogue beside it, the guide underneath ---- */
.buildstage { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; padding: 1rem 1.2rem 0; align-items: stretch; max-width: 110rem; margin: 0 auto; }
.studio-shell.build-mode { max-width: 110rem; }
.buildstage .buildframe-wrap { aspect-ratio: auto; height: 72vh; margin: 0; }
.buildstage .buildstage-frame { display: flex; flex-direction: column; gap: 0.5rem; }
.buildstage .chatactions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.buildstage .chatactions .spacer { margin-left: auto; }
.buildstage-chat { display: flex; flex-direction: column; height: calc(72vh + 2.6rem); }
.buildstage-chat .buildlog { flex: 1; max-height: none; overflow: auto; }
.studio-shell.build-mode { grid-template-columns: 1fr; }
.studio-shell.build-mode .guide { max-width: none; width: 100%; }
.studio-shell.build-mode { padding-top: 0.6rem; }
@media (max-width: 980px) {
  .buildstage { grid-template-columns: 1fr; padding: 0.8rem 0.8rem 0; }
  .buildstage .buildframe-wrap { height: 60vh; }
  .buildstage-chat { height: auto; }
  .buildstage-chat .buildlog { max-height: 12rem; }
}

/* ---- the lecture as clips ---- */
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.clip { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.clip.door { border-color: var(--accent); }
.clip .poster { position: relative; display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: pointer; aspect-ratio: 16 / 9; }
.clip .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip .poster.still { cursor: default; }
.clip .playbtn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 3.4rem; height: 3.4rem; border-radius: 50%; background: rgba(46,111,184,0.92); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; padding-left: 0.25rem; box-shadow: 0 2px 12px rgba(0,0,0,0.35); }
.clip .poster:hover .playbtn { background: var(--accent-strong); }
.clip .soon { position: absolute; right: 0.6rem; bottom: 0.6rem; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 6px; }
.clip .frame { aspect-ratio: 16 / 9; background: #000; }
.clip .frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.clip .body { padding: 0.8rem 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.clip .body b { font-size: 1.02rem; }
.clip .body > span { color: var(--muted); font-size: 0.92rem; }
.clip .row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.2rem; }
.clip .row a.go { background: var(--accent); color: var(--on-accent); padding: 0.4rem 0.85rem; border-radius: 8px; text-decoration: none; font-weight: 700; font-size: 0.88rem; }
.clip .transcript { font-size: 0.95rem; line-height: 1.55; border-top: 1px solid var(--border); padding-top: 0.6rem; margin-top: 0.3rem; max-height: 22rem; overflow: auto; }
.clip .transcript p { margin: 0 0 0.7rem; }
.clip .transcript .note { color: var(--muted); font-style: italic; }
