:root {
  --navy: #0a1628;
  --navy-2: #12233d;
  --card: #162a47;
  --card-lift: #1c3558;
  --text: #f4f7fb;
  --muted: #9bb0c9;
  --accent: #ff6b2c;
  --accent-hot: #ff8f5a;
  --accent-glow: rgba(255, 107, 44, 0.35);
  --cyan: #3ecfff;
  --ok: #3dd68c;
  --danger: #ff6b7a;
  --border: #2a4466;
  --pip: #2a4466;
  --pip-done: #3dd68c;
  --pip-active: #ff6b2c;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Ubuntu, sans-serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(255, 107, 44, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(62, 207, 255, 0.12), transparent 45%),
    var(--navy);
  color: var(--text);
  line-height: 1.55;
  font-size: 17px;
  min-height: 100vh;
}

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

/* ——— Login ——— */
.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.page-login::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 107, 44, 0.15), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(62, 207, 255, 0.1), transparent 40%);
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-2%, 3%) scale(1.05); }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #ff3d00);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
  animation: pulse-glow 2.4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 18px var(--accent-glow); }
  50% { box-shadow: 0 0 32px rgba(255, 107, 44, 0.55); }
}

.brand-text h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.role-tab {
  border: 1px solid var(--border);
  background: var(--navy-2);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: default;
  text-align: center;
}

.role-tab strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

/* ——— Layout ——— */
.wrap {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.wrap.wide { width: min(960px, 100%); }

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.topbar-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.topbar-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.mission-card {
  background: linear-gradient(160deg, var(--card-lift) 0%, var(--card) 55%);
  border-color: #3a5a82;
  position: relative;
  overflow: hidden;
}

.mission-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.login-card { width: 100%; position: relative; z-index: 1; }

.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
}

h1 { font-size: clamp(1.45rem, 4vw, 1.85rem); margin: 0.2rem 0 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 0.45rem; color: var(--cyan); }
h3 { font-size: 0.95rem; margin: 0 0 0.3rem; color: var(--accent-hot); }

.muted { color: var(--muted); }
.fineprint { font-size: 0.85rem; }
.lead { font-size: 1.1rem; }

.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(62, 207, 255, 0.15);
  color: var(--cyan);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.badge.accent {
  background: rgba(255, 107, 44, 0.2);
  color: var(--accent-hot);
}

.badge.ok {
  background: rgba(61, 214, 140, 0.18);
  color: var(--ok);
}

.stack { display: grid; gap: 0.9rem; }

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--navy);
  color: var(--text);
  font-size: 1.05rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--navy-2);
  color: var(--text);
  border-radius: 12px;
  padding: 0.7rem 1.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #ff3d00);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn.primary.cta-pulse {
  animation: cta-pulse 2.2s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 6px 20px var(--accent-glow); transform: scale(1); }
  50% { box-shadow: 0 8px 28px rgba(255, 107, 44, 0.55); transform: scale(1.02); }
}

.btn.ghost {
  background: transparent;
}

.btn.big {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.2rem;
  border-radius: 14px;
}

.btn.small {
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}

.inline { display: inline; }

.error { color: var(--danger); }
.ok { color: var(--ok); }
.bad { color: var(--danger); }

/* ——— Dashboard ——— */
.hero-mission {
  margin-bottom: 1.25rem;
}

.hero-mission .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--navy);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.chip strong { color: var(--text); }

.mission-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.mission-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mission-list li:hover {
  border-color: var(--accent);
  background: var(--card-lift);
}

.mission-list a.mission-link {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.mission-list a.mission-link:hover { color: var(--accent-hot); }

.mission-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.stat-card h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.stat-card p {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.parent-calm .card {
  box-shadow: none;
  background: var(--navy-2);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.friday-note-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 160px;
}

/* ——— Lesson player ——— */
.pip-bar {
  position: sticky;
  top: 52px;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0;
  margin-bottom: 0.5rem;
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(8px);
}

.pip {
  flex: 1 1 auto;
  min-width: 4.2rem;
  text-align: center;
  padding: 0.4rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--navy-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pip.done {
  border-color: rgba(61, 214, 140, 0.45);
  color: var(--ok);
  background: rgba(61, 214, 140, 0.1);
}

.pip.active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff3d00);
  box-shadow: 0 0 16px var(--accent-glow);
  animation: pip-pop 0.35s ease;
}

@keyframes pip-pop {
  from { transform: scale(0.92); }
  to { transform: scale(1); }
}

.step-panel {
  display: none;
  animation: step-in 0.28s ease;
}

.step-panel.active { display: block; }

@keyframes step-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: space-between;
  margin-top: 1.1rem;
}

.hook-text {
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.4;
  margin: 0.4rem 0 0;
}

.callout {
  background: var(--navy);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 0.85rem 1rem;
  margin-top: 0.9rem;
}

.callout.loud {
  border-left-width: 5px;
  background: linear-gradient(90deg, rgba(255, 107, 44, 0.18), var(--navy));
  font-size: 1.08rem;
}

.callout.say {
  border-left-color: var(--cyan);
  background: linear-gradient(90deg, rgba(62, 207, 255, 0.12), var(--navy));
}

.callout.redraw {
  border-left-color: var(--ok);
}

.callout h3 {
  margin: 0 0 0.3rem;
}

.idea-blocks p {
  margin: 0.65rem 0;
  font-size: 1.05rem;
}

.idea-blocks p + p {
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
}

.graphics-stack {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.graphic-figure { margin: 0; }

.svg-zoom-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  text-align: left;
  border-radius: 12px;
}

.svg-zoom-trigger:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.svg-frame {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  padding: 0.55rem;
}

.svg-frame svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 220px;
  max-height: none;
}

.graphic-figure figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.zoom-hint {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
}

/* Lightbox for enlarged diagrams */
body.lightbox-open {
  overflow: hidden;
}

.svg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.svg-lightbox[hidden] {
  display: none !important;
}

.svg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  cursor: pointer;
}

.svg-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--navy-2, #0f172a);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.svg-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.svg-lightbox-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.02rem;
}

.svg-lightbox-body {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  cursor: zoom-out;
}

.svg-lightbox-body svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
  max-height: 78vh;
}

.svg-lightbox-hint {
  margin: 0.65rem 0 0;
  text-align: center;
}

.video-slot { margin-top: 0.85rem; }

.video-slot iframe {
  width: 100%;
  min-height: 200px;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.narration-block { margin-top: 1rem; }

.narration {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.narration-script {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.98rem;
}

.say-line {
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  margin: 0.25rem 0 0;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: var(--navy-2);
}

fieldset label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.45rem 0;
  font-size: 1.02rem;
  cursor: pointer;
}

fieldset legend {
  font-weight: 700;
  padding: 0 0.35rem;
}

.feedback { margin: 0.5rem 0 0; font-weight: 600; }

.boss-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.boss-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #ff3d00);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

@media (min-width: 720px) {
  .graphics-stack {
    grid-template-columns: 1fr;
  }

  .svg-frame svg {
    min-height: 280px;
  }
}

@media (max-width: 480px) {
  body { font-size: 16.5px; }
  .pip { font-size: 0.65rem; min-width: 3.6rem; padding: 0.35rem 0.2rem; }
  .btn.big { font-size: 1.1rem; }
}

/* ——— Icon system ——— */
.icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--navy);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.icon-badge img {
  width: 28px;
  height: 28px;
}

.icon-badge.tip-badge {
  width: auto;
  height: auto;
  padding: 0.35rem 0.7rem;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.icon-badge.tip-badge img {
  width: 20px;
  height: 20px;
}

.login-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.deco-float {
  position: absolute;
  width: 56px;
  height: 56px;
  opacity: 0.45;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  animation: float-y 7s ease-in-out infinite;
}

.deco-a { top: 8%; left: 8%; animation-delay: 0s; }
.deco-b { top: 18%; right: 10%; width: 48px; animation-delay: 1.2s; }
.deco-c { bottom: 22%; left: 6%; width: 52px; animation-delay: 2s; }
.deco-d { bottom: 12%; right: 12%; animation-delay: 0.6s; }
.deco-e { top: 42%; left: 3%; width: 40px; opacity: 0.3; animation-delay: 1.8s; }

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.brand-icon img {
  width: 28px;
  height: 28px;
  filter: brightness(1.15);
}

.role-tab-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.25rem;
  display: block;
}

.login-icon-row { margin-bottom: 0.85rem; }

.topbar-logo {
  display: block;
  flex-shrink: 0;
}

.hero-art {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  z-index: 1;
  pointer-events: none;
}

.hero-art img {
  width: 56px;
  height: 56px;
  opacity: 0.9;
  filter: drop-shadow(0 4px 12px rgba(255, 107, 44, 0.35));
}

.hero-art-secondary {
  width: 28px !important;
  height: 28px !important;
  margin-top: 1.5rem;
  opacity: 0.7 !important;
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.section-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.mission-row-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.mission-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mission-icon-wrap img {
  width: 28px;
  height: 28px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 0.35rem;
}

.stat-icon img {
  width: 32px;
  height: 32px;
}

.empty-state {
  text-align: center;
  padding: 1.25rem 0.75rem;
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}

.empty-state.illustrated {
  background: var(--navy);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.lesson-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.lesson-title-icon {
  flex-shrink: 0;
  margin-top: 0.15rem;
  filter: drop-shadow(0 2px 8px rgba(62, 207, 255, 0.35));
}

.step-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.step-head h2 { margin: 0; }

.step-head-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.callout-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}

.callout-head h3 { margin: 0; }

.pip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.3rem 0.4rem;
}

.pip img {
  width: 16px;
  height: 16px;
  opacity: 0.75;
}

.pip.active img,
.pip.done img {
  opacity: 1;
  filter: brightness(1.2);
}

.pip span { line-height: 1.1; }

.boss-icon img {
  width: 24px;
  height: 24px;
  filter: brightness(1.2);
}

.quiz-type-row {
  justify-content: flex-start;
  margin-bottom: 0.85rem;
}

.q-num {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 6px;
  background: rgba(62, 207, 255, 0.18);
  color: var(--cyan);
  font-size: 0.85rem;
  margin-right: 0.25rem;
}

.q-type-tag {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  background: rgba(255, 107, 44, 0.18);
  color: var(--accent-hot);
  vertical-align: middle;
}

.q-short .q-type-tag {
  background: rgba(61, 214, 140, 0.18);
  color: var(--ok);
}

.short-label {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.short-label textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--navy);
  color: var(--text);
  font-size: 1.02rem;
  font-family: inherit;
  resize: vertical;
  min-height: 3rem;
}

.short-label textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.model-answer {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(62, 207, 255, 0.1);
  border: 1px solid rgba(62, 207, 255, 0.35);
  color: var(--cyan);
  font-size: 0.95rem;
  font-weight: 600;
}

fieldset.q-right {
  border-color: rgba(61, 214, 140, 0.55);
}

fieldset.q-wrong {
  border-color: rgba(255, 107, 122, 0.55);
}

@media (max-width: 480px) {
  .deco-float { width: 40px; height: 40px; opacity: 0.3; }
  .hero-art img { width: 44px; height: 44px; }
  .pip img { width: 14px; height: 14px; }
}

/* ——— Lab-bot lesson guide ——— */
.lab-bot-guide {
  position: sticky;
  top: 0.75rem;
  z-index: 40;
  margin: 0 0 1rem;
  pointer-events: none;
}

.lab-bot-guide.is-active {
  display: block;
}

.lab-bot-guide[hidden] {
  display: none !important;
}

.lab-bot-body {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  max-width: 420px;
  margin-left: auto;
  pointer-events: auto;
  position: relative;
}

.lab-bot-avatar {
  width: 56px;
  height: 70px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(62, 207, 255, 0.35));
  animation: lab-bot-bob 2.8s ease-in-out infinite;
}

@keyframes lab-bot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.lab-bot-bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.85rem 0.75rem;
  border-radius: 14px 14px 14px 4px;
  background: var(--card-lift);
  border: 1px solid rgba(62, 207, 255, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.lab-bot-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 14px;
  width: 12px;
  height: 12px;
  background: var(--card-lift);
  border-left: 1px solid rgba(62, 207, 255, 0.45);
  border-bottom: 1px solid rgba(62, 207, 255, 0.45);
  transform: rotate(45deg);
}

.lab-bot-name {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
}

.lab-bot-tip {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
}

.lab-bot-dismiss {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  z-index: 2;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: 8px;
  background: rgba(10, 22, 40, 0.55);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
.lab-bot-bubble .lab-bot-name {
  padding-right: 1.4rem;
}

.lab-bot-dismiss:hover,
.lab-bot-dismiss:focus-visible {
  color: var(--text);
  background: rgba(255, 107, 44, 0.35);
  outline: none;
}

.lab-bot-guide.is-collapsed .lab-bot-body {
  display: none;
}

.lab-bot-show {
  pointer-events: auto;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(62, 207, 255, 0.5);
  background: var(--card-lift);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.lab-bot-show[hidden] {
  display: none !important;
}

.lab-bot-show img {
  width: 36px;
  height: 45px;
}

.lab-bot-guide.is-collapsed {
  position: fixed;
  right: 0.75rem;
  bottom: 0.85rem;
  top: auto;
  margin: 0;
  z-index: 50;
}

@media (max-width: 640px) {
  .lab-bot-guide.is-active:not(.is-collapsed) {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.75rem;
    top: auto;
    margin: 0;
    z-index: 50;
  }

  .lab-bot-body {
    max-width: none;
    margin-left: 0;
  }

  .lab-bot-avatar {
    width: 44px;
    height: 55px;
  }

  .lab-bot-tip {
    font-size: 0.88rem;
  }

  /* Keep content clickable; guide sits above bottom chrome without blocking cards */
  .lab-bot-guide.is-active:not(.is-collapsed) ~ .step-panel.active {
    padding-bottom: 6.5rem;
  }
}
