:root {
  /* Project Hub colours: the page, and white for the part you work in */
  --bg: #ecf1f1;
  --card: #ffffff;
  --card-border: #dae3e3;
  --tx: #171e21;
  --tx-muted: #5d6a6b;
  --ac: #10b981;
  --ac-hover: #059669;
  /* green for text and links: darker, so it is easy to read on white */
  --ac-text: #047857;
  --pcb: #00979d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--tx);
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, .88);
  position: sticky;
  top: 0;
  z-index: 5;
}

/* "‹ Back" at the left of the top bar (every page but the home page) */
.nav-back { flex: none; padding: 7px 12px; border: 1px solid var(--card-border); border-radius: 10px; background: var(--card); color: var(--tx); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.nav-back:hover { border-color: var(--ac); color: var(--ac-text); }
.site-header .nav-back + .brand { margin-right: auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
}

.brand img {
  width: 54px;
  height: 34px;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(23, 30, 33, 0.117);
}

/* The main menu: bold names; the page you are on is a green pill; Account sits apart on the right */
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.nav a.back-lesson { color: #047857; border-color: var(--ac); }
.nav a {
  text-decoration: none;
  color: #2f3a3e;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
  transition: background .15s, color .15s, border-color .15s;
}
.nav a:hover { color: var(--tx); background: rgba(16, 185, 129, .1); }
.nav a.active { color: #042f2e; background: var(--ac); border-color: var(--ac); font-weight: 750; }
.nav a.nav-account { margin-left: 8px; border-color: var(--card-border); background: var(--card); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.nav-account:hover { border-color: var(--ac); background: var(--card); }
.nav a.nav-account.sign-in { color: var(--ac-text); border-color: var(--ac); }
.nav a.nav-account.active { background: var(--ac); border-color: var(--ac); }

a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: default; }

main {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 26px;
}

.hero img.board {
  width: 180px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(23, 30, 33, 0.133);
}

h1 { font-size: 32px; letter-spacing: -0.03em; }
.lede { color: var(--tx-muted); max-width: 62ch; margin-top: 6px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lab-progress { margin-bottom: 14px; }
.lab-progress .lede { margin: 8px 0 2px; font-size: 20px; color: var(--tx); font-weight: 700; }
.lab-bar { height: 12px; background: #ffffff; border-radius: 999px; overflow: hidden; border: 1px solid var(--card-border); }
.lab-bar span { display: block; height: 100%; background: var(--ac); width: 0; }
.lab-stats[hidden] { display: none; }
.lab-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; color: var(--tx-muted); }
.next-step { margin-top: 8px; font-weight: 650; }
.home-secondary { margin-top: 8px; }
.more-home { margin-top: 16px; }
.more-home > h2 { font-size: 18px; font-weight: 700; }
.home-secondary h2 { color: var(--tx-muted); font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.level-title { font-size: 22px; margin: 26px 0 4px; scroll-margin-top: 78px; }
.unit-kicker { color: var(--ac-text); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.card, .module, .panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
}

.card h2, .panel h2 { font-size: 16px; margin-bottom: 8px; }
.card ol, .stack { display: flex; flex-direction: column; gap: 8px; list-style: none; }

.card a.row, a.module-link, .stack a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .45);
  border: 1px solid transparent;
}

.card a.row:hover, a.module-link:hover, .stack a:hover { border-color: var(--ac); }

.section-title { font-size: 22px; margin: 28px 0 4px; }
.project-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.project-tools input[type="search"] {
  width: min(420px, 100%);
  min-width: 0;
  font: inherit;
  color: var(--tx);
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  font: inherit;
  color: var(--tx-muted);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.filter-btn.on { color: #042f2e; background: var(--ac); border-color: var(--ac); font-weight: 700; }

.group-title {
  margin: 18px 0 8px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tx-muted);
}
a.module { display: block; text-decoration: none; color: inherit; }
a.module:hover { border-color: var(--ac); }
.project-note { display: block; color: var(--tx-muted); font-size: 13px; font-weight: 400; }
/* "2 Gallery projects" on a ready project: the shared posts built on it */
.project-gallery { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(16, 185, 129, .45); color: #047857; font-size: 12px; font-weight: 600; cursor: pointer; }
.project-gallery:hover, .project-gallery:focus-visible { background: rgba(16, 185, 129, .15); outline: none; }

.tag {
  font-size: 11px;
  color: var(--tx-muted);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

.tag.live { color: #042f2e; background: var(--ac); border-color: var(--ac); }

.account-band {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.account-band p { color: var(--tx-muted); font-size: 14px; }

.btn {
  display: inline-block;
  text-decoration: none;
  background: var(--ac);
  color: #042f2e;
  font-weight: 700;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

.btn:hover { background: var(--ac-hover); color: white; }
.btn.ghost {
  background: transparent;
  color: var(--tx);
  border: 1px solid var(--card-border);
}

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 28px; }
.crumb { color: var(--tx-muted); font-size: 13px; margin-bottom: 6px; }
.crumb a { color: var(--tx-muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.module h3 { font-size: 16px; margin: 8px 0 4px; }
.module p { color: var(--tx-muted); font-size: 14px; min-height: 3.2em; }
.thumb {
  width: 100%;
  height: 92px;
  object-fit: cover;
  object-position: left center;
  border-radius: 8px;
  background: var(--pcb);
}
.thumb.part {
  object-fit: contain;
  background: #ffffff;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}

input[type="text"], input[type="email"], input[type="password"], select {
  font: inherit;
  color: var(--tx);
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 220px;
}

.form.stack-form { flex-direction: column; align-items: flex-start; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--tx-muted); font-size: 13px; }
.error { color: #fb7185; min-height: 1.2em; }
.notice { color: var(--tx-muted); margin: 8px 0; }
.price { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; }
.board-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.board-table th, .board-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--card-border); }
.board-table tr.you td { background: rgba(16, 185, 129, .12); }

.progress-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 14px;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: #ffffff;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ac);
}

.certs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
.cert {
  border: 1px dashed var(--card-border);
  border-radius: 12px;
  padding: 14px;
  color: var(--tx-muted);
}
.cert strong { display: block; color: var(--tx); margin-bottom: 4px; }

.panels { display: grid; gap: 12px; }

.xp-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.xp-pill {
  background: #e2f3f3;
  color: #047857;
  border: 1px solid var(--ac);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
}
.learn-card { margin-top: 8px; }
.learn-card h2 { margin-bottom: 6px; font-size: 24px; }
.cat-fig {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #f7f9f9;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.learn-top { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin: 8px 0 4px; }
.learn-fig {
  width: min(100%, 640px);
  height: 260px;
  object-fit: contain;
  background: #f7f9f9;
  border-radius: 12px;
  padding: 12px;
}
.story { color: var(--tx-muted); margin: 0 0 12px; }
.learn-top .btn { margin-top: 4px; }
.code-line {
  background: #0f172a;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "Fira Code", Consolas, monospace;
  font-size: 15px;
  overflow-x: auto;
  margin: 10px 0;
}
.choices, .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.choice, .chip, .slot {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--tx);
  padding: 8px 12px;
  cursor: pointer;
}
.choice { display: flex; flex-direction: column; align-items: flex-start; flex: 1 1 180px; text-align: left; }
.choice-note { display: block; margin-top: 4px; font-size: 13px; font-weight: 650; }
.choice.good .choice-note { color: #047857; }
.choice.bad .choice-note { color: #b91c1c; }
.choice:hover, .chip:hover { border-color: var(--ac); }
.choice.good, .slot.good { border-color: var(--ac); background: #ecfdf5; }
.choice.bad { border-color: #f87171; background: #fef2f2; }
.chip { font-family: Consolas, monospace; cursor: grab; }
.slot {
  display: inline-block;
  min-width: 88px;
  text-align: center;
  border-style: dashed;
  margin: 0 4px;
  vertical-align: middle;
}
.slot.over { border-color: var(--ac); }
.feedback { min-height: 1.4em; margin: 8px 0; font-weight: 650; }
.feedback.good { color: #047857; }
.feedback.bad { color: #b91c1c; }
.learn-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.step-dots { color: var(--tx-muted); font-size: 13px; }

.task-pill {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e2f3f3;
  color: #047857;
  font-size: 13px;
  font-weight: 700;
}
.blank-code {
  background: #0b1220;
  border-radius: 12px;
  padding: 14px;
  overflow-x: auto;
  font-family: Consolas, "Fira Code", monospace;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.order-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; min-height: 48px; }
.order-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #f7f9f9;
  font-family: Consolas, monospace;
  cursor: grab;
}
.order-line .nudge { margin-left: auto; display: flex; gap: 4px; }
.order-line .nudge button {
  font: inherit;
  font-size: 12px;
  color: var(--tx);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
}
.order-chip { text-align: left; }
.sketch-box {
  width: 100%;
  min-height: 240px;
  margin: 12px 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: #0b1220;
  color: #e2e8f0;
  font-family: Consolas, "Fira Code", monospace;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
}
.wired-list { margin: 8px 0 12px; padding-left: 18px; color: var(--tx-muted); }
.wire-bench { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.wire-add, .made-wires { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.wire-add select, .link-pill {
  font: inherit;
  color: var(--tx);
  background: #f7f9f9;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
}
.link-pill button {
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  font: inherit;
}
.congrats { font-size: 22px; margin: 8px 0 4px; }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti-layer i {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(640deg); }
}

@media (max-width: 800px) {
  .hero, .columns, .progress-row { grid-template-columns: 1fr; }
  .account-band { flex-direction: column; align-items: flex-start; }
  .learn-fig { height: 200px; }
}

/* Narrow screens: the menu takes its own row; on phones it scrolls sideways instead of wrapping. */
@media (max-width: 980px) {
  .nav { width: 100%; }
}
@media (max-width: 560px) {
  .site-header { padding: 10px 12px; gap: 8px; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; padding-bottom: 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; font-size: 14px; white-space: nowrap; flex: none; }
  .nav a.nav-account { margin-left: 4px; }
}

/* ===== Project rows (js/projects.js): picture, name and note, level, Open. The whole row is the link. ===== */
.stack a.project-row {
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--tx);
}
.stack a.project-row:hover { border-color: var(--ac); background: rgba(16, 185, 129, .08); }
.project-art {
  flex: none;
  width: 56px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(148, 163, 184, .12);
}
.project-art img { max-width: 48px; max-height: 38px; }
.project-main { flex: 1 1 auto; min-width: 0; }
.level {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
}
.level-1 { color: #047857; border-color: rgba(110, 231, 183, .45); }
.level-2 { color: #a16207; border-color: rgba(252, 211, 77, .45); }
.level-3 { color: #b91c1c; border-color: rgba(252, 165, 165, .45); }
.project-open {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: #042f2e;
  background: var(--ac);
  border-radius: 8px;
  padding: 6px 12px;
}
@media (max-width: 560px) {
  .project-open { display: none; }
  .project-art { width: 44px; height: 36px; }
}

/* ===== Learning hub (js/learn.js, mode "hub"): one "next lesson" card, then three plain links ===== */
.next-card { display: flex; align-items: center; gap: 24px; padding: 22px; }
.next-card h2 { font-size: 24px; margin: 2px 0 6px; }
.next-art { flex: none; width: 200px; max-height: 150px; object-fit: contain; border-radius: 12px; background: #f7f9f9; padding: 12px; }
.next-body { flex: 1 1 auto; min-width: 0; }
.next-body .btn { margin-top: 12px; font-size: 16px; padding: 10px 20px; }
.lv-bar { height: 8px; max-width: 360px; border-radius: 999px; background: rgba(148, 163, 184, .2); overflow: hidden; margin-top: 10px; }
.lv-bar > span { display: block; height: 100%; background: var(--ac); border-radius: 999px; }
.learn-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.learn-more a.module-link { flex-direction: column; justify-content: flex-start; padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 12px; color: var(--tx); }
@media (max-width: 640px) {
  .next-card { flex-direction: column; align-items: flex-start; }
  .next-art { width: 100%; }
}

/* Home: the topic and project links stay folded until asked for */
details.more-home > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more-home > summary::-webkit-details-marker { display: none; }
details.more-home > summary::after { content: '▾'; color: var(--tx-muted); transition: transform .15s; }
details.more-home:not([open]) > summary::after { transform: rotate(-90deg); }
details.more-home > summary h2 { margin: 0; }
details.more-home[open] > summary { margin-bottom: 12px; }
#lab-continue { margin-top: 10px; font-size: 16px; padding: 10px 20px; }

/* ===== Lesson step: a "Learn" box and a separate "Your turn" box ===== */
.learn-box { border-radius: 14px; padding: 16px 18px; margin: 14px 0; }
.learn-explain { background: rgba(56, 189, 248, .06); border: 1px solid rgba(56, 189, 248, .25); }
.learn-ask { background: rgba(16, 185, 129, .06); border: 1px solid rgba(16, 185, 129, .35); }
.box-head { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.learn-explain .box-head { color: #0369a1; }
.learn-ask .box-head { color: #047857; }
.learn-box .learn-top { flex-direction: row; align-items: flex-start; gap: 20px; margin: 0; }
.learn-box .learn-fig { flex: none; width: 260px; height: 190px; }
.learn-text { flex: 1 1 auto; min-width: 0; }
.learn-box .story { color: var(--tx); font-size: 17px; line-height: 1.65; margin: 0 0 12px; max-width: 62ch; }
.code-label { margin: 12px 0 4px; font-size: 12px; color: var(--tx-muted); font-weight: 700; }
.learn-box .code-line { margin-top: 0; }
.learn-ask > p > b { font-size: 18px; }
.learn-ask .choice { font-size: 16px; padding: 12px 14px; }
.learn-ready { margin: 6px 0 4px; }
.learn-ready .btn { font-size: 16px; padding: 10px 20px; }
[data-theme="light"] .learn-explain { background: #f0f9ff; }
[data-theme="light"] .learn-ask { background: #ecfdf5; }
[data-theme="light"] .learn-explain .box-head { color: #0369a1; }
[data-theme="light"] .learn-ask .box-head { color: #047857; }
@media (max-width: 720px) {
  .learn-box .learn-top { flex-direction: column; }
  .learn-box .learn-fig { width: 100%; height: 170px; }
  .learn-box .story { font-size: 16px; }
}

/* screenshots: full width above the explanation, so their labels can be read */
.learn-box .learn-top:has(.learn-fig.wide) { flex-direction: column; }
.learn-fig-link { display: block; width: 100%; max-width: 1000px; cursor: zoom-in; }
.learn-box .learn-fig.wide { width: 100%; height: auto; max-height: 560px; padding: 0; background: none; border: 1px solid var(--card-border); }

/* ===== Lesson lab (js/minilab.js): code on the left, the board on the right ===== */
.minilab { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; margin: 6px 0 4px; }
.ml-code { display: flex; flex-direction: column; min-width: 0; }
.ml-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ml-actions { display: flex; gap: 6px; }
.ml-actions .btn { padding: 7px 14px; font-size: 15px; }
.ml-editor {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  font-family: "Fira Code", Consolas, monospace;
  font-size: 15px;
  line-height: 1.55;
  color: #e2e8f0;
  background: #0b1220;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  tab-size: 2;
}
.ml-editor:focus { outline: 2px solid var(--ac); outline-offset: 1px; }
.ml-status { margin: 8px 0 0; min-height: 1.4em; font-weight: 650; color: var(--tx-muted); }
.ml-status.good { color: #6ee7b7; }
.ml-status.bad { color: #fca5a5; }
.ml-view { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ml-stage { display: flex; align-items: flex-end; justify-content: center; gap: 18px; flex-wrap: wrap; background: #e5e7eb; border-radius: 12px; padding: 14px; }
.ml-uno { position: relative; width: min(100%, 300px); }
.ml-uno img { display: block; width: 100%; height: auto; }
/* the L light sits on the pad drawn in arduino-uno.svg */
.ml-l { position: absolute; left: 41.3%; top: 31.25%; width: 3.2%; height: 3%; border-radius: 2px; background: #713f12; transform: translate(-50%, -50%); }
.ml-l.on { background: #fde047; box-shadow: 0 0 6px 3px rgba(253, 224, 71, .9), 0 0 18px 6px rgba(250, 204, 21, .55); }
.ml-leds { display: flex; gap: 14px; }
.ml-led { position: relative; display: flex; flex-direction: column; align-items: center; width: 70px; --level: 0; }
/* an off LED looks dull; a lit one glows, brighter for bigger analogWrite numbers */
.ml-led img { width: 46px; height: auto; position: relative; z-index: 1; filter: saturate(calc(.3 + var(--level) * .9)) brightness(calc(.6 + var(--level) * .7)); }
.ml-led-glow { position: absolute; top: -8px; left: 50%; width: 66px; height: 66px; transform: translateX(-50%); border-radius: 50%; background: var(--glow); filter: blur(14px); opacity: calc(var(--level) * 1); z-index: 0; pointer-events: none; }
.ml-led-tag { margin-top: 4px; font-size: 10px; line-height: 1.25; color: #334155; text-align: center; }
.ml-serial { border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; }
.ml-serial-head { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 13px; font-weight: 700; background: #1e293b; color: #e2e8f0; }
.ml-baud { font-weight: 400; color: #94a3b8; }
.ml-serial-out { margin: 0; height: 140px; overflow: auto; padding: 8px 10px; background: #020617; color: #4ade80; font-family: Consolas, monospace; font-size: 14px; white-space: pre-wrap; }
.ml-help { margin-top: 10px; }
.ml-help > summary { cursor: pointer; color: var(--tx-muted); font-weight: 650; }
.ml-help .code-line { margin-top: 6px; }
@media (max-width: 860px) {
  .minilab { grid-template-columns: 1fr; }
}

/* ===== Code with line numbers, and the line-by-line walkthrough ===== */
.code-numbered, .walk { background: #0b1220; border: 1px solid var(--card-border); border-radius: 10px; padding: 8px 0; overflow-x: auto; }
.cn-row, .walk-code { display: flex; align-items: baseline; font-family: "Fira Code", Consolas, monospace; font-size: 15px; line-height: 1.7; white-space: pre; color: #e2e8f0; }
.cn-row { padding: 0 14px 0 0; }
.cn-n { flex: none; width: 2.6em; padding-right: 12px; text-align: right; color: #64748b; user-select: none; }
.cn-row.hot { background: rgba(250, 204, 21, .16); box-shadow: inset 3px 0 0 #facc15; }
.cn-row.hot .cn-n { color: #a16207; font-weight: 700; }
.walk { padding: 4px 0; }
.walk-row { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 1.25fr); align-items: center; border-bottom: 1px solid rgba(148, 163, 184, .12); }
.walk-row:last-child { border-bottom: none; }
.walk-row.quiet .walk-code { opacity: .55; }
.walk-code { padding: 6px 12px 6px 0; }
.walk-note { padding: 8px 14px; font-size: 15px; line-height: 1.5; color: #e2e8f0; background: rgba(56, 189, 248, .07); align-self: stretch; display: flex; align-items: center; }
.walk-row.quiet .walk-note { background: none; }
.walk-row:not(.quiet):hover { background: rgba(250, 204, 21, .08); }
.walk-tip { margin: 10px 0 0; font-size: 15px; color: var(--tx); }
@media (max-width: 720px) {
  .walk-row { grid-template-columns: 1fr; }
  .walk-note { padding: 2px 14px 10px 3.2em; background: none; color: #93c5fd; }
}

/* ===== The topic path: completed, next, locked ===== */
.level-head { margin: 26px 0 12px; }
.level-head .lv-bar { max-width: 420px; margin-top: 6px; }
.level-head.complete .level-title { color: #a16207; }
.topic-card { position: relative; display: flex; flex-direction: column; }
.topic-card .topic-action { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topic-card .lv-bar { margin-top: 4px; }
.topic-num {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #434f54; background: #dae3e3; border: 2px solid #dae3e3;
}
.topic-card.is-done { border-color: rgba(16, 185, 129, .55); background: linear-gradient(180deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .03)); }
.topic-card.is-done .topic-num { background: #10b981; color: #042f2e; }
.topic-card.is-next { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }
.topic-card.is-next .topic-num { background: #38bdf8; color: #082f49; }
.topic-card.is-locked { opacity: .55; }
.topic-card.is-locked .cat-fig { filter: grayscale(1); }
.lock-note { font-size: 13px; color: var(--tx-muted); }
.done-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #042f2e; background: #34d399; }
.done-chip.soft { color: #047857; background: rgba(16, 185, 129, .15); }
.xp-row .done-chip { margin-left: auto; margin-right: 8px; }
/* topic or level finished */
.done-card { display: flex; align-items: center; gap: 14px; margin: 12px 0 4px; padding: 14px 18px; border-radius: 14px; border: 1px solid rgba(16, 185, 129, .5); background: linear-gradient(90deg, rgba(16, 185, 129, .18), rgba(56, 189, 248, .10)); }
.done-card .done-icon { font-size: 34px; line-height: 1; }
.done-card b { font-size: 19px; }
.done-card p { margin: 2px 0 0; color: var(--tx-muted); }
#next.pulse { animation: next-pulse 1.2s ease-in-out 4; }
@keyframes next-pulse { 50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, .35); } }
@media (prefers-reduced-motion: reduce) { #next.pulse { animation: none; } }
/* the learning home: the five levels in order */
.level-list { display: flex; flex-direction: column; gap: 8px; }
.level-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--card-border); border-radius: 12px; color: var(--tx); text-decoration: none; background: rgba(255, 255, 255, .45); }
.level-row:hover { border-color: var(--ac); }
.level-row .lv-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: #dae3e3; color: #fff; }
.level-row.now { border-color: #38bdf8; }
.level-row.now .lv-n { background: #38bdf8; color: #082f49; }
.level-row.done .lv-n { background: #10b981; color: #042f2e; }
.level-row .lv-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.level-row .lv-count { flex: none; color: var(--tx-muted); font-weight: 700; }

/* lesson number above each lesson name */
.topic-card .lesson-no { margin: 10px 0 0; min-height: 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #0369a1; }
.topic-card.is-done .lesson-no { color: #047857; }
.topic-card h3 { margin-top: 2px; }

/* ===== Lesson lab inputs: a push button and a knob / light slider ===== */
.ml-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.ml-control { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: 12px; background: #0b1220; }
.ml-control-label { font-size: 13px; line-height: 1.4; color: var(--tx-muted); }
.ml-control-label b { color: var(--tx); }
.ml-push { flex: none; width: 64px; height: 64px; padding: 0; border-radius: 12px; border: 3px solid #1f2937; background: #e5e7eb; cursor: pointer; touch-action: none; display: flex; align-items: center; justify-content: center; }
.ml-push-cap { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #4ade80, #15803d 70%); box-shadow: 0 4px 0 #14532d; transition: transform .05s, box-shadow .05s; }
.ml-push.down .ml-push-cap { transform: translateY(3px); box-shadow: 0 1px 0 #14532d; background: radial-gradient(circle at 35% 35%, #86efac, #16a34a 70%); }
.ml-push:focus-visible { outline: 3px solid var(--ac); outline-offset: 2px; }
.ml-knob { flex-direction: column; align-items: stretch; gap: 6px; }
.ml-range { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tx-muted); }
.ml-range input { flex: 1 1 auto; accent-color: #38bdf8; }
.ml-knob.light .ml-range input { accent-color: #facc15; }
.ml-value { font-family: Consolas, monospace; font-size: 13px; color: #7dd3fc; }

/* ===== Lesson lab outputs: buzzer, servo, relay lamp, LCD ===== */
.ml-part { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 84px; }
.ml-buzzer img { width: 48px; height: auto; }
.ml-note { font-size: 12px; font-weight: 800; color: #475569; }
.ml-buzzer.on .ml-note { color: #b45309; }
.ml-buzzer.on img { animation: ml-buzz .12s linear infinite; }
@keyframes ml-buzz { 50% { transform: translateX(1px) rotate(1deg); } }
.ml-sound { font-size: 11px; color: #475569; display: flex; align-items: center; gap: 3px; }
.ml-servo-body { position: relative; width: 70px; height: 46px; border-radius: 6px; background: #1e3a8a; border: 2px solid #172554; }
.ml-servo-arm { position: absolute; left: 50%; top: 50%; width: 8px; height: 40px; margin-left: -4px; border-radius: 4px; background: #f8fafc; border: 1px solid #94a3b8; transform-origin: 50% 0; transform: rotate(-90deg); transition: transform .25s ease-out; }
.ml-servo-hub { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #e2e8f0; border: 2px solid #64748b; }
.ml-angle { font-size: 12px; font-weight: 800; color: #1e3a8a; }
.ml-relay-box { padding: 6px 8px; border-radius: 5px; background: #2563eb; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.ml-bulb { font-size: 30px; filter: grayscale(1) brightness(.7); transition: filter .1s; }
.ml-relay.on .ml-bulb { filter: drop-shadow(0 0 10px #fde047) drop-shadow(0 0 4px #facc15); }
.ml-relay.on .ml-relay-box { background: #16a34a; }
.ml-lcd { align-self: stretch; padding: 10px 14px; border-radius: 8px; background: #1e3a8a; border: 6px solid #0f172a; }
.ml-lcd-row { margin: 0; font-family: Consolas, "Cascadia Mono", monospace; font-size: 20px; line-height: 1.3; letter-spacing: .14em; white-space: pre; color: #e0f2fe; background: rgba(255, 255, 255, .06); }

/* ===== Lesson lab: robot wheels, fan relay, sensor sliders ===== */
.ml-wheels { display: flex; align-items: center; gap: 6px; }
.ml-chassis { font-size: 30px; }
.ml-wheel { width: 22px; height: 34px; border-radius: 6px; background: repeating-linear-gradient(0deg, #1f2937 0 5px, #4b5563 5px 10px); border: 2px solid #111827; }
.ml-wheel.on { animation: ml-roll .35s linear infinite; }
@keyframes ml-roll { to { background-position: 0 -10px; } }
.ml-drive { font-size: 12px; font-weight: 800; color: #1e3a8a; }
.ml-relay.fan.on .ml-bulb { filter: none; display: inline-block; animation: ml-spin .6s linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.ml-slider .ml-range input { accent-color: #34d399; }
.ml-slider.temp .ml-range input { accent-color: #f97316; }

/* ===== Roles: the teacher / admin bar on lessons, the role chip, and the Admin page ===== */
.role-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(167, 139, 250, .5); background: rgba(167, 139, 250, .12); }
.role-bar.preview { border-color: rgba(250, 204, 21, .5); background: rgba(250, 204, 21, .10); }
.role-bar .btn { padding: 6px 12px; font-size: 14px; }
.topic-card.is-open .topic-num { background: #6d28d9; }
.role-chip { margin-left: 8px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #1e1b4b; background: #c4b5fd; align-self: center; }
.role-chip.admin { background: #fca5a5; color: #450a0a; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.admin-stats .stat { display: flex; flex-direction: column; align-items: flex-start; }
.admin-stats .stat b { font-size: 28px; }
.admin-stats .stat span { color: var(--tx-muted); font-size: 13px; }
.admin-views { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-views .btn { padding: 6px 12px; font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--card-border); border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--card-border); white-space: nowrap; }
.admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--tx-muted); background: rgba(255, 255, 255, .6); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table select { min-width: 0; padding: 4px 8px; }
.admin-table .lv-bar { width: 90px; height: 5px; margin-top: 4px; }

/* ===== Certificate page (certificate/, js/certificate.js) ===== */
.cert-status { margin: 0 0 14px; padding: 12px 16px; border-radius: 12px; font-size: 15px; line-height: 1.5; border: 1px solid; }
.cert-status.good { border-color: rgba(16, 185, 129, .55); background: rgba(16, 185, 129, .12); }
.cert-status.sample { border-color: rgba(250, 204, 21, .55); background: rgba(250, 204, 21, .10); }
.cert-status.bad { border-color: rgba(248, 113, 113, .55); background: rgba(248, 113, 113, .10); }
.cert-sheet { position: relative; overflow: hidden; aspect-ratio: 1.414 / 1; max-width: 1000px; margin: 0 auto 18px; padding: 18px; border-radius: 6px;
  background: radial-gradient(circle at 50% 40%, #fffef9, #f8f1df); color: #1f2937; box-shadow: 0 18px 40px rgba(23, 30, 33, 0.15); }
.cert-frame { position: relative; z-index: 1; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
  padding: 3.2% 6%; border: 3px solid #0f766e; outline: 2px solid #b8860b; outline-offset: -12px; }
.cert-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3em; color: #0f766e; font-size: clamp(11px, 1.4vw, 15px); }
.cert-brand img { width: clamp(34px, 5vw, 54px); height: auto; }
.cert-kicker { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(18px, 3.4vw, 36px); letter-spacing: .12em; text-transform: uppercase; color: #92400e; }
.cert-small { margin: 0; font-size: clamp(11px, 1.4vw, 15px); color: #4b5563; font-style: italic; }
.cert-name { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 5.2vw, 56px); font-weight: 700; color: #111827; border-bottom: 2px solid #b8860b; padding: 0 24px 4px; }
.cert-course { margin: 0; font-size: clamp(16px, 2.6vw, 28px); color: #0f766e; }
.cert-detail { margin: 0; max-width: 78%; font-size: clamp(10px, 1.3vw, 14px); line-height: 1.5; color: #374151; }
.cert-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin: 0; padding: 0; list-style: none; }
.cert-levels li { display: flex; align-items: center; gap: 5px; font-size: clamp(9px, 1.15vw, 12.5px); font-weight: 700; color: #134e4a; background: rgba(15, 118, 110, .09); border: 1px solid rgba(15, 118, 110, .3); border-radius: 999px; padding: 3px 10px; }
.cert-levels li b { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: #0f766e; color: #fff; font-size: .85em; }
.cert-foot { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.cert-field { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid #9ca3af; padding-top: 6px; font-size: clamp(10px, 1.3vw, 14px); }
.cert-field span { font-size: .8em; text-transform: uppercase; letter-spacing: .1em; color: #6b7280; }
.cert-id { font-family: Consolas, "Cascadia Mono", monospace; letter-spacing: .04em; }
.cert-seal { width: clamp(64px, 10vw, 104px); height: clamp(64px, 10vw, 104px); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fde68a, #d97706 70%, #92400e); color: #451a03; border: 3px double #78350f; box-shadow: 0 3px 8px rgba(120, 53, 15, .35); }
.cert-seal span { font-size: clamp(18px, 3vw, 30px); line-height: 1; }
.cert-seal small { font-size: clamp(6px, .8vw, 9px); font-weight: 800; letter-spacing: .1em; }
.cert-verify { margin: 0; font-size: clamp(8px, 1vw, 11px); color: #6b7280; word-break: break-all; }
.cert-watermark { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font: 900 clamp(60px, 14vw, 170px)/1 "Segoe UI", Arial, sans-serif; letter-spacing: .1em; color: rgba(220, 38, 38, .13); transform: rotate(-18deg); }
.cert-tools { max-width: 1000px; margin: 0 auto 14px; }
.cert-share { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cert-share label { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--tx-muted); }
.cert-share input { min-width: 0; width: 100%; box-sizing: border-box; font: 14px Consolas, monospace; color: var(--tx); background: #ffffff; border: 1px solid var(--card-border); border-radius: 8px; padding: 9px 10px; }
.cert-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.cert-lookup { max-width: 1000px; margin: 18px auto 0; }
.cert-lookup input { font-family: Consolas, monospace; text-transform: uppercase; }
.cert-cta { text-align: center; }
/* the student's certificate list on the account page */
.cert-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .45); margin-bottom: 8px; }
.cert-card.course { border-color: rgba(217, 119, 6, .6); background: linear-gradient(90deg, rgba(217, 119, 6, .16), rgba(15, 118, 110, .12)); }
.cert-card code { font-size: 13px; color: var(--tx-muted); }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff !important; }
  .site-header, .cert-status, .cert-tools, .cert-lookup, .cert-cta { display: none !important; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .cert-sheet { box-shadow: none; max-width: none; width: 100vw; height: 100vh; aspect-ratio: auto; margin: 0; border-radius: 0; }
}

/* the certificate card on the learning home */
.cert-promo { display: flex; align-items: center; gap: 16px; margin-top: 16px; border-color: rgba(217, 119, 6, .5); background: linear-gradient(90deg, rgba(217, 119, 6, .14), rgba(15, 118, 110, .10)); }
.cert-promo-icon { font-size: 40px; line-height: 1; }
.cert-promo p { margin: 4px 0 10px; color: var(--tx-muted); }
.certs > .cert-card { grid-column: 1 / -1; margin-bottom: 0; }

/* ===== Classes: teacher page (js/teach.js) ===== */
.teach-note { min-height: 1.2em; margin: 0 0 10px; font-weight: 650; }
.teach-note.good { color: #047857; }
.teach-note.bad { color: #b91c1c; }
.teach-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.class-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.class-tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--card-border); color: var(--tx); text-decoration: none; font-weight: 700; }
.class-tab.on { border-color: var(--ac); background: rgba(16, 185, 129, .14); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.class-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.class-head h2 { margin: 0 0 4px; font-size: 24px; }
.invite { flex: 1 1 380px; max-width: 560px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(56, 189, 248, .45); background: rgba(56, 189, 248, .08); }
.invite-row { display: flex; gap: 8px; }
.invite-row input { flex: 1 1 auto; min-width: 0; font: 13px Consolas, monospace; color: var(--tx); background: #ffffff; border: 1px solid var(--card-border); border-radius: 8px; padding: 8px 10px; }
.join-code { font-size: 15px; font-weight: 800; letter-spacing: .12em; color: var(--tx); }
.teach-tabs { margin: 14px 0; }
.empty-class { text-align: center; }
.join-box { margin-top: 18px; }
.join-card { max-width: 560px; margin: 0 auto; text-align: center; }
.grid-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 10px; font-size: 13px; color: var(--tx-muted); }
.class-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.class-grid th, .class-grid td { padding: 8px 10px; border-bottom: 1px solid var(--card-border); text-align: center; vertical-align: middle; }
.class-grid th { background: rgba(255, 255, 255, .7); font-weight: 600; min-width: 130px; max-width: 190px; }
.class-grid .sticky { position: sticky; left: 0; z-index: 1; text-align: left; background: #f7f9f9; min-width: 150px; }
.class-grid td.sticky b { display: block; }
.class-grid .totals td { font-weight: 700; color: var(--tx-muted); border-bottom: none; }
.a-head { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.a-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.3; }
.a-actions { display: flex; gap: 6px; }
.link-btn { padding: 1px 6px; font-size: 12px; border-radius: 6px; border: 1px solid var(--card-border); background: transparent; color: var(--tx-muted); cursor: pointer; }
.link-btn:hover { color: var(--tx); border-color: var(--ac); }
.link-btn.danger:hover { border-color: #f87171; color: #b91c1c; }
.cell { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 46px; padding: 3px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 2px solid transparent; }
.cell.done { color: #042f2e; background: #34d399; }
.cell.review { color: #1e1b4b; background: #c4b5fd; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; }
.cell.retry { color: #451a03; background: #fcd34d; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; }
.cell.progress { color: #e0f2fe; background: rgba(56, 189, 248, .25); }
.cell.none { color: var(--tx-muted); background: rgba(148, 163, 184, .12); }
.cell.late { border-color: #f87171; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .5); }
.lib-card.challenge { border-color: rgba(217, 119, 6, .5); }
.lib-card p { margin: 0; color: var(--tx-muted); font-size: 14px; flex: 1 1 auto; }
.lib-covers { font-size: 12px; font-weight: 700; color: #0369a1; }
.lib-due { font-size: 13px; color: var(--tx-muted); display: flex; align-items: center; gap: 6px; }
.lib-card input, .custom-form input, .custom-form select, .review-form select, .review-form textarea { font: inherit; color: var(--tx); background: #ffffff; border: 1px solid var(--card-border); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.custom-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.custom-form .filter-btn input { display: none; }
.kind-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.kind-row label { display: flex; align-items: center; gap: 6px; }
.kind-row .grow { flex: 1 1 300px; }
.kind-row .grow input { flex: 1 1 auto; }
.review-dlg { width: min(1100px, 96vw); max-height: 94vh; overflow: auto; color: var(--tx); background: #ffffff; border: 1px solid var(--card-border); border-radius: 14px; padding: 18px 20px; }
.review-dlg::backdrop { background: rgba(2, 6, 23, .7); }
.review-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.review-head h2 { margin: 0; }
.review-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.review-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--tx-muted); }
.review-form .grow { flex: 1 1 360px; }
.review-actions { display: flex; gap: 8px; }
/* ===== Student: "My assignments" on the learning home ===== */
.my-assign { margin: 4px 0 8px; }
.assign-card { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .5); }
.assign-card.st-retry { border-color: rgba(252, 211, 77, .7); }
.assign-card.st-done { border-color: rgba(52, 211, 153, .5); }
.assign-card.late:not(.st-done):not(.st-submitted) { border-color: rgba(248, 113, 113, .7); }
.assign-main { flex: 1 1 320px; display: flex; flex-direction: column; gap: 3px; }
.assign-main .lv-bar { max-width: 280px; margin-top: 4px; }
.assign-note { font-size: 14px; color: var(--tx); }
.assign-feedback { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: rgba(196, 181, 253, .12); }
.assign-mark { font-weight: 800; color: #a16207; }
.assign-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.assign-chip { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: rgba(148, 163, 184, .18); }
.st-done .assign-chip { background: #34d399; color: #042f2e; }
.st-retry .assign-chip { background: #fcd34d; color: #451a03; }
.st-submitted .assign-chip { background: #c4b5fd; color: #1e1b4b; }
.assign-pub { font-size: 13px; color: var(--tx-muted); }
.sent-note { margin-top: 0; }
/* ===== Published student projects ===== */
.work-head h1 { margin-bottom: 4px; }
.work-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.done-chip.teacher { background: #c4b5fd; color: #1e1b4b; }
.works-gallery:empty { display: none; }
.works-gallery { margin-bottom: 18px; }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.work-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .5); color: var(--tx); text-decoration: none; }
.work-card:hover { border-color: var(--ac); }

/* the sample certificate, shown directly where students read about certificates */
.cert-sample { display: block; width: 100%; max-width: 760px; height: auto; margin: 12px auto 0; border-radius: 6px; box-shadow: 0 14px 34px rgba(23, 30, 33, 0.15); }
.cert-promo { flex-wrap: wrap; }
.cert-promo > div { flex: 1 1 260px; }
.cert-promo > .cert-sample { flex: 1 1 100%; }
.certs > .cert-sample { grid-column: 1 / -1; }
.certs:has(.cert-sample) > .cert { grid-column: 1 / -1; }

/* ===== Projects: build cards, my builds, filters ===== */
.build-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.build-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; border: 1px solid rgba(16, 185, 129, .5); background: linear-gradient(135deg, rgba(16, 185, 129, .14), rgba(56, 189, 248, .08)); color: var(--tx); text-decoration: none; }
.build-card:hover { border-color: var(--ac); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.build-card img { width: 86px; height: auto; flex: none; }
.build-card > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.build-card b { font-size: 17px; }
.build-sub { color: var(--tx-muted); font-size: 14px; }
.build-card.continue { border-color: rgba(250, 204, 21, .5); background: rgba(250, 204, 21, .08); }
.build-icon { width: 86px; flex: none; text-align: center; font-size: 34px; }
.builds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.build-saved { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .5); }
.build-saved a { display: flex; flex-direction: column; gap: 2px; color: var(--tx); text-decoration: none; min-width: 0; }
.build-saved a:hover b { color: var(--ac-text); }
.builds-empty { margin-top: 10px; }
.filter-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.part-pick { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--tx-muted); }
.part-pick select { min-width: 190px; }
.set-banner { margin-left: 10px; font-size: 14px; color: var(--tx); }

/* ===== Home page ===== */
.home-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; padding: 26px 0 10px; }
.home-kicker { color: var(--ac-text); font-weight: 700; font-size: 14px; letter-spacing: .03em; margin-bottom: 10px; }
.home-hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.1; margin-bottom: 14px; }
.home-hero .lede { font-size: 18px; max-width: 34em; }
.btn.big { padding: 12px 22px; font-size: 17px; }
.home-hero-art { position: relative; padding: 26px; border-radius: 22px; background: radial-gradient(circle at 70% 30%, rgba(16, 185, 129, .22), transparent 60%), #ffffff; border: 1px solid var(--card-border); min-height: 300px; }
.hero-board { width: 74%; display: block; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .45)); }
.hero-led { position: absolute; top: 18px; right: 30px; width: 70px; }
.hero-led img { width: 100%; display: block; animation: led-blink 1s steps(1) infinite; }
.hero-led i { position: absolute; left: 50%; top: 34%; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; background: radial-gradient(circle, rgba(248, 113, 113, .75), transparent 65%); animation: led-glow 1s steps(1) infinite; pointer-events: none; }
@keyframes led-glow { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes led-blink { 0% { filter: brightness(1.25); } 50% { filter: brightness(.55); } }
.hero-code { position: absolute; right: 18px; bottom: 18px; margin: 0; padding: 12px 16px; border-radius: 12px; background: rgba(2, 6, 23, .9); border: 1px solid var(--card-border); font: 13px/1.5 ui-monospace, Consolas, monospace; color: #e2e8f0; }
.hero-code b { color: #38bdf8; font-weight: 600; }
.hero-code em { color: #fbbf24; font-style: normal; }
.home-progress { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; }
.home-progress[hidden] { display: none; }
.home-progress-main { flex: 1; min-width: 0; }
.home-progress-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.home-section { margin-top: 46px; }
.home-title { font-size: 26px; margin-bottom: 4px; }
.home-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.home-more { white-space: nowrap; font-weight: 600; }
.home-sub { font-size: 18px; margin: 22px 0 10px; }
/* headings that open their page: same look as the heading, underline on hover */
.title-link { color: inherit; text-decoration: none; }
.title-link span { color: var(--ac-text); transition: transform .15s; display: inline-block; }
.title-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.title-link:hover span { transform: translateX(3px); }
.title-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.home-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.home-step { position: relative; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--card-border); }
.home-step img { height: 64px; width: auto; display: block; margin: 4px 0 12px; }
.home-step b { font-size: 17px; }
.home-step p { color: var(--tx-muted); font-size: 15px; margin-top: 6px; }
.step-no { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ac); color: #04241a; font-weight: 800; }
.slider { position: relative; }
.slide-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 2px 10px; }
.slide-track::-webkit-scrollbar { display: none; }
.slide-card { flex: 0 0 250px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--card-border); color: var(--tx); text-decoration: none; transition: transform .15s, border-color .15s; }
.slide-card:hover { transform: translateY(-3px); border-color: var(--ac); }
.slide-card img { height: 100px; width: 100%; object-fit: contain; margin-bottom: 10px; background: linear-gradient(160deg, #f8fafc, #dbe3ee); border-radius: 12px; padding: 10px; }
.slide-card b { font-size: 17px; }
.slide-card p { color: var(--tx-muted); font-size: 14px; }
.slide-card.small { flex-basis: 210px; }
.slide-card.small img { height: 84px; }
.slide-card.work { min-height: 120px; }
.slide-btn { position: absolute; top: 50%; z-index: 2; width: 40px; height: 40px; margin-top: -24px; border-radius: 50%; border: 1px solid var(--card-border); background: rgba(255, 255, 255, .92); color: var(--tx); font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 6px 16px rgba(23, 30, 33, 0.133); }
.slide-btn:hover { border-color: var(--ac); color: var(--ac-text); }
.slide-btn.prev { left: -14px; }
.slide-btn.next { right: -14px; }
.slide-btn[hidden] { display: none; }
.home-empty { padding: 18px; border-radius: 14px; border: 1px dashed var(--card-border); color: var(--tx-muted); }
.home-cert { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.home-cert img { width: 100%; border-radius: 12px; box-shadow: 0 16px 40px rgba(23, 30, 33, 0.15); }
.home-teach { margin-top: 46px; }
@media (max-width: 820px) {
  .home-hero, .home-cert { grid-template-columns: 1fr; }
  .home-steps { grid-template-columns: 1fr; }
  .home-progress { flex-direction: column; align-items: stretch; }
  .home-progress-side { align-items: flex-start; }
  .slide-btn { display: none; }
}
.slide-card .project-stats { display: flex; gap: 14px; margin-top: auto; padding-top: 8px; color: var(--tx-muted); font-size: 13px; }
.slide-card .project-stats span { display: inline-flex; align-items: center; gap: 5px; }

/* ===== Home: live simulation with progress beside it ===== */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; padding-top: 6px; }
.home-live { min-width: 0; padding: 20px; border-radius: 20px; border: 1px solid var(--card-border); background: radial-gradient(circle at 85% 0%, rgba(16, 185, 129, .16), transparent 55%), #ffffff; }
.home-live h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; margin-bottom: 14px; }
.home-live-foot { margin-top: 10px; color: var(--tx-muted); font-size: 14px; }
.home-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }
.home-side .lab-progress { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.home-side-note { color: var(--tx-muted); font-size: 14px; }
.home-side #lab-level { font-weight: 700; margin-top: 4px; }
.btn.wide { display: block; text-align: center; margin-top: 6px; }
.side-cert { display: flex; flex-direction: column; gap: 10px; padding: 12px; color: var(--tx); text-decoration: none; }
.side-cert img { width: 100%; border-radius: 8px; }
.side-cert > span { display: flex; flex-direction: column; gap: 2px; }
.side-cert:hover { border-color: var(--ac); }
/* bigger Gallery cards */
.slide-card.big { flex-basis: 330px; }
.g-cover { display: flex; align-items: center; justify-content: center; gap: 18px; height: 170px; margin-bottom: 10px; border-radius: 12px; background: linear-gradient(160deg, #f8fafc, #dbe3ee); overflow: hidden; }
.g-cover img { height: 120px; width: auto; max-width: 46%; object-fit: contain; margin: 0; padding: 0; background: none; }
.g-cover img:only-child { max-width: 80%; }
.slide-card.big b { font-size: 18px; }
@media (max-width: 980px) {
  .home-top { grid-template-columns: 1fr; }
  .home-side { position: static; }
}
/* Home: every sliding card as big as the Gallery cards */
.slide-card, .slide-card.small { flex-basis: 330px; }
.slide-card > img, .slide-card.small > img { height: 170px; padding: 22px; }
.slide-card b, .slide-card.small b { font-size: 18px; }
.slide-card p { font-size: 15px; }

/* Home: the real simulator canvas, running LED Blink */
.home-sim { position: relative; display: block; height: 430px; border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); background: #dddddd; box-shadow: 0 14px 34px rgba(23, 30, 33, 0.117); }
.home-sim iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.home-sim:hover { border-color: var(--ac); box-shadow: 0 0 0 3px rgba(16, 185, 129, .35), 0 14px 34px rgba(23, 30, 33, 0.117); }
.home-sim-badge { position: absolute; top: 12px; left: 12px; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: #15803d; font-size: 13px; font-weight: 700; }
.home-sim-open { position: absolute; right: 12px; bottom: 12px; padding: 9px 16px; border-radius: 999px; background: var(--ac); color: #04241a; font-weight: 700; font-size: 15px; box-shadow: 0 6px 16px rgba(23, 30, 33, 0.1); }
.home-sim:hover .home-sim-open { filter: brightness(1.1); }
@media (max-width: 640px) { .home-sim { height: 300px; } }

/* Projects: the pictures of the parts a project uses, side by side */
.project-art { width: 112px; height: 48px; gap: 4px; padding: 0 4px; background: #eef2f7; }
.project-art img { max-width: 34px; max-height: 40px; object-fit: contain; }
.project-art.parts-1 img { max-width: 60px; }
.project-art.parts-2 img { max-width: 48px; }
@media (max-width: 560px) {
  .project-art { width: 84px; height: 40px; }
  .project-art img { max-width: 24px; max-height: 32px; }
  .project-art.parts-1 img { max-width: 44px; }
}

/* ===== Practice Arduino IDE (js/ide-sim.js), in the look of Arduino IDE 2 ===== */
.ide-wrap { margin: 8px 0 4px; }
.ide-steps { margin: 0 0 6px; padding-left: 22px; display: grid; gap: 4px; font-size: 15px; }
.ide-steps li { color: var(--tx-muted); }
.ide-steps li.now { color: var(--tx); font-weight: 700; }
.ide-steps li.done { color: #6ee7b7; }
.ide-steps li.done::marker { content: '✔  '; }
.ide-next { margin: 4px 0 10px; color: #fcd34d; font-weight: 600; }
.ide-stage { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
.ide-win { position: relative; border-radius: 10px; overflow: hidden; background: #fff; color: #1f2937; border: 1px solid #94a3b8; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.ide-title { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #f3f4f6; font-size: 13px; color: #374151; }
.ide-dots { display: flex; gap: 5px; }
.ide-dots i { width: 10px; height: 10px; border-radius: 50%; background: #d1d5db; }
.ide-dots i:first-child { background: #00979d; }
.ide-menubar { display: flex; gap: 16px; padding: 3px 12px; background: #fff; font-size: 13px; border-bottom: 1px solid #e5e7eb; }
.ide-menubar > span, .ide-tools { cursor: default; color: #111827; }
.ide-tools { background: none; border: none; padding: 0; font: inherit; cursor: pointer; border-radius: 3px; }
.ide-tools:hover { background: #e5e7eb; }
.ide-menu { position: relative; }
.ide-drop { position: absolute; left: 0; top: 100%; z-index: 20; min-width: 240px; padding: 4px 0; background: #fff; color: #111827; border: 1px solid #d1d5db; border-radius: 6px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.ide-drop button { display: flex; flex-direction: column; width: 100%; padding: 6px 14px; border: none; background: none; text-align: left; font: inherit; font-size: 13px; color: #111827; cursor: pointer; }
.ide-drop button small { color: #6b7280; font-size: 11px; }
.ide-drop button:hover { background: #e0f2f1; }
.ide-drop button.on { font-weight: 700; color: #00797f; }
.ide-drop-head { margin: 4px 0 0; padding: 4px 14px; font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; border-top: 1px solid #f3f4f6; }
.ide-drop-head:first-child { border-top: none; }
.ide-drop-note { margin: 0; padding: 6px 14px; font-size: 12px; color: #b45309; }
.ide-dim { color: #9ca3af; }
.ide-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #17a1a5; }
.ide-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); background: #0b7f85; color: #fff; font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ide-btn:hover:not(:disabled) { background: #06656a; }
.ide-btn:disabled { opacity: .45; cursor: default; }
.ide-btn.ide-ghost { border-color: transparent; background: transparent; }
.ide-btn.ide-ghost:hover { background: rgba(0, 0, 0, .15); }
.ide-board { min-width: 210px; padding: 7px 12px; border-radius: 6px; border: 1px solid #cbd5e1; background: #fff; color: #111827; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ide-board::before { content: '⇌ '; color: #00979d; font-weight: 700; }
.ide-gap { flex: 1; }
.ide-body { display: flex; height: 330px; }
.ide-side { flex: none; width: 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 12px; background: #ececec; color: #8a8a8a; font-style: normal; font-size: 18px; }
.ide-side i { font-style: normal; }
.ide-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ide-tabs { padding: 0 8px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.ide-tab { display: inline-block; padding: 6px 12px; font-size: 13px; background: #fff; border: 1px solid #e5e7eb; border-bottom-color: #fff; margin-bottom: -1px; }
.ide-editor { flex: 1; min-height: 0; display: flex; background: #fff; }
.ide-lines { margin: 0; padding: 8px 10px 8px 6px; min-width: 34px; text-align: right; color: #2b8ab0; background: #fff; font: 13px/1.5 Consolas, "Cascadia Mono", monospace; overflow: hidden; user-select: none; }
.ide-code { flex: 1; min-width: 0; margin: 0; padding: 8px; border: none; outline: none; resize: none; background: #fff; color: #1f2937; font: 13px/1.5 Consolas, "Cascadia Mono", monospace; white-space: pre; tab-size: 2; }
.ide-panel { flex: none; height: 118px; display: flex; flex-direction: column; border-top: 1px solid #d1d5db; background: #f9fafb; }
.ide-panel-tabs { display: flex; gap: 2px; padding: 0 8px; background: #f3f4f6; }
.ide-panel-tabs button { padding: 4px 10px; border: none; background: none; font: inherit; font-size: 12px; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; }
.ide-panel-tabs button.on { color: #111827; border-bottom-color: #00979d; }
.ide-out, .ide-mon-text { flex: 1; min-height: 0; margin: 0; padding: 6px 10px; overflow: auto; font: 12px/1.45 Consolas, "Cascadia Mono", monospace; color: #111827; white-space: pre-wrap; background: #fff; }
.ide-out .err { color: #dc2626; }
.ide-mon { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ide-mon[hidden], .ide-out[hidden] { display: none; }
.ide-mon-bar { display: flex; gap: 6px; padding: 4px 8px; background: #f3f4f6; }
.ide-mon-bar input { flex: 1; min-width: 0; padding: 3px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; background: #fff; color: #111827; }
.ide-baud { padding: 2px 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; background: #fff; color: #111827; }
.ide-status { display: flex; gap: 16px; padding: 3px 12px; background: #006d72; color: #e6fffd; font-size: 12px; }
.ide-status-board { margin-left: auto; }
.ide-progress { color: #fde68a; }
.ide-toast { position: absolute; right: 14px; bottom: 34px; z-index: 30; max-width: 330px; padding: 10px 14px; border-radius: 6px; background: #fff; color: #111827; border-left: 4px solid #00979d; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); font-size: 13px; }
.ide-toast.warn { border-left-color: #f59e0b; }
.ide-toast.err { border-left-color: #dc2626; }
.ide-hw { display: flex; flex-direction: column; gap: 10px; }
.ide-uno { position: relative; margin-left: 36px; }
.ide-uno img { display: block; width: 100%; height: auto; }
.ide-led { position: absolute; width: 3.2%; height: 3%; border-radius: 2px; transform: translate(-50%, -50%); background: transparent; }
.ide-on { left: 83.7%; top: 32%; }
.ide-l { left: 41.3%; top: 31.25%; background: #713f12; }
.ide-tx { left: 41.3%; top: 36.25%; }
.ide-rx { left: 41.3%; top: 40%; }
.ide-uno.plugged .ide-on { background: #4ade80; box-shadow: 0 0 6px 2px rgba(74, 222, 128, .9); }
.ide-l.on { background: #fde047; box-shadow: 0 0 6px 3px rgba(253, 224, 71, .9), 0 0 18px 6px rgba(250, 204, 21, .55); }
.ide-tx.on, .ide-rx.on { background: #fde047; box-shadow: 0 0 5px 2px rgba(253, 224, 71, .9); }
/* the USB cable: loose until clicked, then pushed into the board's USB socket */
.ide-cable { position: absolute; left: -48px; top: 17%; width: 46px; height: 15%; padding: 0; border: none; border-radius: 3px 0 0 3px; background: linear-gradient(#cbd5e1, #64748b); cursor: pointer; transition: left .25s; box-shadow: 0 0 0 3px rgba(250, 204, 21, .85); animation: ide-pulse 1.4s ease-in-out infinite; }
.ide-cable span { position: absolute; left: -14px; top: 50%; transform: translateY(-50%); font-size: 9px; font-weight: 800; color: #0f172a; writing-mode: vertical-rl; }
.ide-cable::after { content: ''; position: absolute; right: 100%; top: 35%; width: 40px; height: 30%; background: #334155; border-radius: 3px 0 0 3px; }
.ide-uno.plugged .ide-cable { left: -30px; box-shadow: none; animation: none; }
@keyframes ide-pulse { 50% { box-shadow: 0 0 0 6px rgba(250, 204, 21, .35); } }
.ide-hw-note { margin: 0; font-size: 13px; color: var(--tx-muted); }
@media (max-width: 860px) {
  .ide-stage { grid-template-columns: 1fr; }
  .ide-hw { max-width: 280px; }
  .ide-board { min-width: 0; flex: 1; }
}
/* the practice board: big enough to see the L light, with room on the left for the USB cable */
.ide-stage { grid-template-columns: minmax(0, 1fr) 300px; }
.ide-uno { margin-left: 78px; }

/* ===== "Build the circuit" steps: the simulator with the parts unwired ===== */
.circuit-brief { margin: 10px 0 8px; padding: 10px 14px; border-radius: 10px; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .35); }
.circuit-wrap { border-radius: 12px; overflow: hidden; border: 1px solid var(--card-border); box-shadow: 0 10px 26px rgba(23, 30, 33, 0.1); }
.circuit-frame { display: block; width: 100%; height: 470px; border: 0; background: #dddddd; }
@media (max-width: 640px) { .circuit-frame { height: 400px; } }

/* My builds: one row of the newest; "Show all" opens the rest in a box that scrolls */
.builds-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.builds-count { display: inline-block; min-width: 22px; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: rgba(148, 163, 184, .18); color: var(--tx-muted); font-size: 13px; text-align: center; }
.builds-tools { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; flex-wrap: wrap; }
.builds-tools input { width: min(320px, 100%); }
.builds-grid.builds-all { max-height: 300px; overflow-y: auto; padding-right: 4px; }
.build-saved[hidden] { display: none; }
.builds-tools input[type="search"] { font: inherit; font-size: 14px; color: var(--tx); background: #ffffff; border: 1px solid var(--card-border); border-radius: 10px; padding: 8px 12px; }
#my-builds { scroll-margin-top: 80px; }

/* home page Gallery row: a circuit picture fills the card's picture area */
.g-cover.g-photo { padding: 0; background: #ecf1f1; }
.g-cover.g-photo img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
.admin-table tr.done { opacity: .55; }

/* Simulation Gallery (Simulations page): a few rows of picture cards, and "Show more" */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.sim-grid .sim-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 14px; border: 1px solid var(--card-border); border-radius: 14px; background: var(--card); color: var(--tx); text-decoration: none; transition: box-shadow .15s, border-color .15s, transform .15s; }
.sim-grid .sim-card:hover { border-color: var(--ac); box-shadow: 0 6px 18px rgba(23, 30, 33, .08); transform: translateY(-2px); }
.sim-grid .sim-card[hidden] { display: none; }
.sim-grid .sim-card b { font-size: 16px; }
.sim-grid .sim-card p { color: var(--tx-muted); font-size: 14px; margin: 0; }
.sim-grid .g-cover { height: 160px; margin-bottom: 8px; }
.sim-more { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 0; color: var(--tx-muted); font-size: 14px; }
.sim-more .btn[hidden] { display: none; }
.sim-gallery { margin: 8px 0 26px; }
.sim-gallery .lede { margin: -4px 0 12px; }
.sim-card .g-cover { position: relative; background: #2b3036; }
.sim-card .g-cover:not(.g-photo) { background: linear-gradient(160deg, #f8fafc, #dbe3ee); }
.sim-card .card-level { position: absolute; top: 10px; left: 10px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .92); color: #171e21; }
.sim-card .card-level.lv-1 { color: #047857; } .sim-card .card-level.lv-2 { color: #a16207; } .sim-card .card-level.lv-3 { color: #b91c1c; }
.sim-card p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sim-card .project-gallery { align-self: flex-start; margin-top: auto; }

/* Simulation Gallery: "From students", and a student's post (projects/sim/) */
.stu-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 8px; }
.stu-head .group-title { margin: 0; margin-right: auto; }
.stu-publish { padding: 7px 14px; font-size: 14px; text-decoration: none; }
.stu-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--tx-muted); }
.stu-sort select { font: inherit; padding: 6px 10px; border: 1px solid var(--card-border); border-radius: 8px; background: var(--card); color: var(--tx); }
.stu-empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--card-border); border-radius: 12px; background: var(--card); color: var(--tx-muted); font-size: 14px; }
.stu-by { font-size: 13px; color: var(--tx-muted); }
.stu-stats { display: flex; gap: 12px; margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--tx-muted); }
.sim-gallery > .group-title { margin: 22px 0 8px; }

.sim-post-page { max-width: 900px; }
.sp-back a { color: var(--ac-text); text-decoration: none; font-weight: 600; }
.sp-main { padding: 26px 30px; border: 1px solid var(--card-border); border-radius: 14px; background: var(--card); }
.sp-cover { display: block; width: 100%; aspect-ratio: 5 / 3; object-fit: cover; border-radius: 12px; background: #2b3036; margin-bottom: 18px; }
.sp-main h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.2; }
.sp-pitch { margin: 6px 0 4px; font-size: 17px; color: var(--tx-muted); }
.sp-by { font-size: 14px; color: var(--tx-muted); }
.sp-based { margin-top: 4px; font-size: 14px; }
.sp-based a { color: var(--ac-text); font-weight: 600; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.sp-actions .btn.on { border-color: var(--ac); background: #ecfdf5; color: var(--ac-text); }
.sp-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; color: var(--tx-muted); }
.sp-link { border: 0; background: none; padding: 0; color: var(--ac-text); font: inherit; font-weight: 600; cursor: pointer; }
.sp-owner { display: flex; gap: 8px; margin-top: 12px; }
.sp-danger { color: #b91c1c; border-color: #fca5a5; }
.sp-section { margin-top: 26px; }
.sp-section h2 { font-size: 20px; margin-bottom: 10px; }
.sp-parts { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.sp-parts li { padding: 8px 0; border-bottom: 1px solid var(--card-border); }
.sp-parts b { display: inline-block; min-width: 26px; color: var(--ac-text); }
.sp-code { max-height: 420px; overflow: auto; padding: 14px 16px; border-radius: 10px; background: #f7f9f9; border: 1px solid var(--card-border); font: 13px/1.55 Consolas, "Cascadia Mono", ui-monospace, monospace; }
.sp-comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sp-comment-form textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: 10px; resize: vertical; }
.sp-comment-form .btn { align-self: flex-start; }
.sp-replying { margin: 0; font-size: 13px; color: var(--ac-text); }
.sp-comment-list, .sp-replies { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.sp-replies { margin: 10px 0 0 22px; padding-left: 12px; border-left: 2px solid var(--card-border); }
.sp-comment time { font-size: 12px; color: var(--tx-muted); }
.sp-comment p { margin: 2px 0; }
.sp-comment-tools { display: flex; gap: 12px; }
.sp-comment-tools button { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--tx-muted); cursor: pointer; }
.sp-comment-tools button:hover { color: var(--ac-text); }
.sp-signin a { color: var(--ac-text); font-weight: 600; }
.sp-empty { color: var(--tx-muted); }
.sp-remixes { padding-left: 18px; }
.sp-remixes a { color: var(--ac-text); font-weight: 600; }
@media (max-width: 700px) { .sp-main { padding: 18px 16px; } }

/* Home: the four "where to start" cards under the title, sliding round (js/home.js) */
.quick-wrap { overflow: hidden; margin: 0 0 16px; padding: 4px 2px; }
.quick-track { display: flex; gap: 12px; will-change: transform; }
.quick-card { flex: 0 0 calc((100% - 24px) / 3); display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 10px 10px 14px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card); color: var(--tx); text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; }
.quick-card:hover, .quick-card:focus-visible { transform: translateY(-2px); border-color: var(--ac); box-shadow: 0 8px 20px rgba(23, 30, 33, .1); outline: none; }
/* a big picture on top: the first picture of that part of the home page */
.q-pic { display: grid; place-items: center; height: 150px; border-radius: 10px; overflow: hidden; background: linear-gradient(160deg, #f8fafc, #dbe3ee); }
.q-pic img { max-width: 82%; max-height: 120px; object-fit: contain; }
.q-pic.q-photo { background: #2b3036; }
.q-pic.q-photo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.q-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0 4px; }
.q-text b { display: flex; align-items: center; gap: 6px; font-size: 18px; }
.q-text small { font-size: 14px; line-height: 1.35; color: var(--tx-muted); }
.q-go { font-size: 20px; color: var(--ac-text); transition: transform .2s; }
.quick-card:hover .q-go { transform: translateX(3px); }
.quick-wrap.still { overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 900px) { .quick-card { flex-basis: calc((100% - 12px) / 2); } }
@media (max-width: 560px) { .quick-card { flex-basis: 82%; } }

/* Simulations page: the gallery title with one "Build a simulation" button */
.sim-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sim-build-btn { flex: none; text-decoration: none; }
.sim-gallery { margin-top: 0; }
.sim-gallery > .stu-head { margin-top: 4px; }
.my-builds-end { margin-top: 30px; }

/* My assignments: how much is done and how much is left */
.assign-summary { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card); font-size: 15px; }
.assign-summary .lv-bar { max-width: 420px; }
.assign-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.assign-progress .lv-bar { flex: 0 1 220px; margin: 0; }
.assign-count { font-size: 14px; color: var(--tx); }
.assign-steps-n { color: var(--tx-muted); }
.assign-lessons { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; padding: 0; }
.assign-lessons a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--card-border); background: #f7f9f9; color: var(--tx); font-size: 13px; text-decoration: none; }
.assign-lessons a:hover { border-color: var(--ac); }
.assign-mark-dot { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: #dae3e3; color: #434f54; font-size: 11px; font-weight: 800; }
.assign-lessons a.done { background: #ecfdf5; border-color: #a7f3d0; }
.assign-lessons a.done .assign-mark-dot { background: #10b981; color: #042f2e; }
.assign-lessons a.started .assign-mark-dot { background: #fef3c7; color: #854d0e; }
.assign-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 2px; padding: 0; counter-reset: s; }
.assign-steps li { position: relative; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--card-border); background: #f7f9f9; color: var(--tx-muted); font-size: 13px; }
.assign-steps li.done { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.assign-steps li.now { border-color: var(--ac); color: var(--tx); font-weight: 700; }

/* Inside an assigned lesson: the assignment, and how many of its lessons are done */
.assign-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid #c4b5fd; background: #f5f3ff; color: var(--tx); text-decoration: none; font-size: 14px; }
.assign-bar:hover { border-color: #8b5cf6; }
.assign-bar-count { color: #4c1d95; }
.assign-bar .lv-bar { flex: 1 1 140px; max-width: 220px; margin: 0; }

/* Classroom: what a teacher can do, and the way to join as one */
.teach-join { margin-top: 18px; }
.teach-join-head { display: flex; gap: 14px; align-items: flex-start; }
.teach-join-icon { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: #ede9fe; font-size: 28px; }
.teach-join h2 { margin-bottom: 4px; }
.teach-can { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 16px 0; padding: 0; }
.teach-can li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); background: #f7f9f9; }
.teach-can li > span:last-child { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--tx-muted); }
.teach-can b { color: var(--tx); font-size: 15px; }
.teach-can-icon { font-size: 22px; line-height: 1.2; }
.teach-join-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.teach-join-actions .project-note { flex: 1 1 260px; }
.teach-help { margin-top: 18px; }
.teach-help summary { cursor: pointer; font-weight: 700; }
.teach-help .teach-can { margin-bottom: 0; }

.sp-assign { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #c4b5fd; background: #f5f3ff; font-size: 14px; }

/* My assignments: a publish task */
.assign-what { font-size: 14px; color: var(--tx); }
.assign-handin { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; }
.assign-handin select { font: inherit; padding: 6px 10px; border: 1px solid var(--card-border); border-radius: 8px; background: var(--card); color: var(--tx); max-width: 260px; }

/* Classroom: a Publish assignment, and reviewing a handed-in post */
.publish-row { flex-direction: column; align-items: stretch; gap: 10px; }
.publish-tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.publish-task { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--card); cursor: pointer; }
.publish-task.on { border-color: var(--ac); background: #ecfdf5; }
.publish-task > span { display: flex; flex-direction: column; gap: 2px; }
.remix-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.remix-pick[hidden] { display: none; }
.review-post { display: flex; gap: 14px; align-items: center; margin: 10px 0 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); background: #f7f9f9; color: var(--tx); text-decoration: none; }
.review-post:hover { border-color: var(--ac); }
.review-post img { width: 220px; aspect-ratio: 5 / 3; object-fit: cover; border-radius: 8px; background: #2b3036; }
.review-post > span { display: flex; flex-direction: column; gap: 4px; }
.review-open { color: var(--ac-text); font-weight: 700; }
.assign-handin .text-btn { padding: 0; border: 0; background: none; color: var(--ac-text); font: inherit; font-weight: 600; cursor: pointer; }
.assign-handin .text-btn:hover { text-decoration: underline; }

/* Learning page: a line that leads to the assignments in Classroom */
.assign-link { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 4px 0 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid #c4b5fd; background: #f5f3ff; color: var(--tx); text-decoration: none; font-size: 15px; }
.assign-link:hover { border-color: #8b5cf6; }
.assign-link-go { color: #5b21b6; font-weight: 700; }
#my-assign-host .my-assign { margin: 4px 0 18px; }

/* An assignment the teacher sent back, with the teacher's words */
.assign-back { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid #fcd34d; background: #fffbeb; font-size: 14px; }
.assign-back b { color: #92400e; }
.assign-back p { margin: 0; font-style: italic; color: var(--tx); }
.assign-back span { color: var(--tx-muted); }

/* Classroom: "I teach" and "I learn", for someone who is both a teacher and a student */
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 18px; }
.role-tab { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--card-border); background: var(--card); color: var(--tx); font: inherit; text-align: left; cursor: pointer; }
.role-tab > span:last-child { display: flex; flex-direction: column; }
.role-tab b { font-size: 17px; }
.role-tab small { font-size: 13px; color: var(--tx-muted); }
.role-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 24px; }
.role-tab.teach .role-icon { background: #ede9fe; }
.role-tab.learn .role-icon { background: #dcfce7; }
.role-tab.teach.on { border-color: #8b5cf6; background: #f5f3ff; }
.role-tab.learn.on { border-color: #10b981; background: #ecfdf5; }
.role-tab:not(.on):hover { border-color: #b9c9c9; }
.role-part[hidden] { display: none; }
.part-head { margin: 0 0 12px; padding-left: 14px; border-left: 4px solid var(--card-border); }
.part-teach .part-head { border-left-color: #8b5cf6; }
.part-learn .part-head { border-left-color: #10b981; }
.part-head h2 { margin: 4px 0 2px; font-size: 22px; }
.part-head .lede { margin: 0; font-size: 15px; }
.part-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.part-teach .part-badge { background: #ede9fe; color: #5b21b6; }
.part-learn .part-badge { background: #dcfce7; color: #166534; }
@media (max-width: 560px) { .role-switch { grid-template-columns: 1fr; } }

/* Admin: paused people, and buttons in the tables */
.tag.paused { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.admin-table tr.paused-row td { background: #fffbeb; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost.danger { color: #b91c1c; border-color: #fca5a5; }

/* Sign in with Google, above the email forms */
.google-box { margin: 10px 0 6px; }
.google-box[hidden] { display: none; }
#google-button { min-height: 44px; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; max-width: 360px; color: var(--tx-muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }

/* Forgot password */
.text-link { border: 0; background: none; padding: 0; color: var(--ac-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.text-link:hover { text-decoration: underline; }
.forgot-link { margin-top: 2px; }
.forgot-form { margin-top: 12px; padding: 14px; border: 1px dashed var(--card-border); border-radius: 12px; }
.forgot-form[hidden] { display: none; }
.forgot-done { margin: 0; color: #065f46; font-weight: 600; }

/* ===== Simulations page: the build panel and the search (projects/index.html) ===== */
.build-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: center;
  margin: 6px 0 22px; padding: 28px 30px; border-radius: 22px; overflow: hidden; color: #e5f6f3;
  background: radial-gradient(circle at 85% 20%, rgba(16, 185, 129, .28), transparent 45%), radial-gradient(circle at 10% 110%, rgba(0, 151, 157, .35), transparent 50%), linear-gradient(135deg, #0b1f24, #0f2f35 55%, #0b1a20);
  box-shadow: 0 14px 34px rgba(4, 30, 34, .28); }
.build-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.2px); background-size: 18px 18px; }
.bh-text { position: relative; z-index: 1; }
.bh-kicker { margin: 0 0 6px; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #6ee7b7; }
.build-hero h2 { margin: 0 0 10px; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; color: #fff; }
.bh-lede { margin: 0 0 16px; max-width: 520px; font-size: 16px; line-height: 1.55; color: #b9d6d2; }
.bh-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.bh-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); font-size: 14px; font-weight: 700; color: #e5f6f3; }
.bh-steps li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #10b981; color: #052e24; font-size: 12px; font-weight: 800; }
.bh-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bh-actions .btn { text-decoration: none; }
.bh-start { box-shadow: 0 6px 18px rgba(16, 185, 129, .45); }
.build-hero .btn.ghost.bh-esp { color: #e5f6f3; border-color: rgba(229, 246, 243, .45); background: rgba(255, 255, 255, .05); }
.build-hero .btn.ghost.bh-esp:hover { background: rgba(255, 255, 255, .14); }
.bh-more { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 0 0; font-size: 14px; }
.bh-more a { color: #9ee7d0; font-weight: 700; text-decoration: none; }
.bh-more a:hover { text-decoration: underline; }
.bh-more a[hidden] { display: none; }

/* the picture: the Uno in front of the ESP32, parts floating around, glowing wires between them */
.bh-art { position: relative; z-index: 1; height: 300px; }
.bh-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 1; pointer-events: none; }
.bh-part { z-index: 2; }
.bh-wires path { fill: none; stroke: #facc15; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 8 9; filter: drop-shadow(0 0 4px rgba(250, 204, 21, .8)); animation: bh-flow 1.2s linear infinite; }
.bh-wires path:nth-child(2n) { stroke: #34d399; filter: drop-shadow(0 0 4px rgba(52, 211, 153, .8)); }
.bh-uno { position: absolute; left: 22%; top: 24%; width: 58%; transform: rotate(-6deg); filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .55)); }
.bh-esp32 { position: absolute; right: -6%; top: 6%; width: 50%; transform: rotate(8deg); opacity: .9; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .5)); }
.bh-part { position: absolute; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); animation: bh-float 5s ease-in-out infinite; }
.p-led { left: 14%; top: 4%; width: 9%; }
.p-servo { right: 4%; top: 44%; width: 20%; animation-delay: -1.4s; }
.p-sonar { left: 0; top: 56%; width: 22%; animation-delay: -2.6s; }
.p-buzzer { right: 16%; bottom: 0; width: 13%; animation-delay: -3.4s; }
.p-pot { left: 40%; top: 0; width: 10%; animation-delay: -.8s; }
@keyframes bh-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes bh-flow { to { stroke-dashoffset: -34; } }
@media (prefers-reduced-motion: reduce) { .bh-part, .bh-wires path { animation: none; } }
@media (max-width: 860px) {
  .build-hero { grid-template-columns: 1fr; padding: 22px; }
  .bh-art { height: 220px; order: -1; }
}

/* the search */
.sim-search-box { margin: 0 0 18px; }
.sim-search { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 16px; border: 2px solid var(--card-border); border-radius: 16px; background: var(--card); box-shadow: 0 4px 14px rgba(15, 23, 42, .06); transition: border-color .15s, box-shadow .15s; }
.sim-search:focus-within { border-color: var(--ac); box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
.sim-search svg { flex: none; width: 22px; height: 22px; color: var(--tx-muted); }
.sim-search input { flex: 1; min-width: 0; padding: 13px 4px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--tx); }
.sim-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sim-chips button { padding: 6px 13px; border: 1px solid var(--card-border); border-radius: 999px; background: var(--card); color: var(--tx); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.sim-chips button:hover { border-color: var(--ac); }
.sim-chips button.on { background: var(--ac); border-color: var(--ac); color: #fff; }
.sim-search-count { min-height: 1.3em; margin: 10px 2px 0; font-size: 14px; color: var(--tx-muted); }
.sim-none { margin: 4px 0 14px; padding: 16px; border: 1px dashed var(--card-border); border-radius: 12px; background: var(--card); color: var(--tx-muted); }
.sim-none[hidden] { display: none; }
.sim-none a { color: var(--ac-text); font-weight: 700; }

/* ===== ▶ Build in the menu, and Previous / Next at the bottom of the main pages (js/platform.js) ===== */
.nav a.nav-build { margin-right: 6px; padding-left: 14px; padding-right: 14px; border-color: #00979d; background: #00979d; color: #fff; font-weight: 800; box-shadow: 0 4px 12px rgba(0, 151, 157, .3); }
.nav a.nav-build:hover { background: #007f84; border-color: #007f84; color: #fff; }
.page-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 36px 0 10px; padding-top: 22px; border-top: 1px solid var(--card-border); }
.pager-card { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; border: 1px solid var(--card-border); border-radius: 14px; background: var(--card); color: var(--tx); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pager-card:hover { border-color: var(--ac); box-shadow: 0 8px 20px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.pager-card small { font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ac-text); }
.pager-card b { font-size: 18px; }
.pager-card span { font-size: 14px; color: var(--tx-muted); }
.pager-card.next { text-align: right; grid-column: 2; }
@media (max-width: 640px) { .page-pager { grid-template-columns: 1fr; } .pager-card.next { grid-column: 1; } }
/* ▶ Build: in the menu on wide screens, in the top row on small ones (the menu row scrolls there) */
.site-header > .top-build { display: none; padding: 7px 14px; border-radius: 999px; background: #00979d; color: #fff; font-weight: 800; text-decoration: none; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 151, 157, .3); }
.site-header > .brand { margin-right: auto; }
@media (max-width: 980px) {
  .site-header > .top-build { display: inline-block; }
  .nav a.nav-build { display: none; }
}

/* ===== Admin: messages from the 💬 Feedback button (js/admin.js) ===== */
.msg-list { display: grid; gap: 10px; margin-bottom: 8px; }
.msg { padding: 14px 16px; border-left: 4px solid var(--ac); }
.msg.read { border-left-color: var(--card-border); opacity: .8; }
.msg header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.msg header time { margin-left: auto; font-size: 13px; color: var(--tx-muted); }
.msg .tag { padding: 2px 8px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11.5px; font-weight: 800; }
.msg-text { margin: 8px 0 6px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.5; }
.msg-meta { margin: 0 0 8px; font-size: 13px; color: var(--tx-muted); }
.msg-actions { display: flex; gap: 8px; }

/* Admin: Visitors */
.visit-stats .stat b { color: var(--accent, #0b7a75); }
.visit-chart-card { padding: 16px 18px; margin-bottom: 12px; }
.visit-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin: 12px 0 6px; border-bottom: 1px solid rgba(0,0,0,.15); }
.vc-col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.vc-col i { display: block; width: 100%; background: #0b7a75; border-radius: 3px 3px 0 0; min-height: 0; }
.vc-col:hover i { background: #10a39c; }
.vc-col:last-child i { background: #e8833a; }
.vc-axis { display: flex; justify-content: space-between; font-size: .8rem; opacity: .7; }
.visit-period { margin-left: auto; align-self: center; font-size: .9rem; opacity: .8; }
.visit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.visit-grid > .card { padding: 14px 16px; }
.visit-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.visit-list li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 6px; overflow: hidden; font-size: .92rem; }
.visit-list li i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(11,122,117,.12); z-index: 0; }
.visit-list li span { position: relative; z-index: 1; }
.vl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-num { white-space: nowrap; font-variant-numeric: tabular-nums; opacity: .85; }
