.dark-mode {
  --bg:#07111f;
  --panel:rgba(15,23,42,.82);
  --panel-strong:#0f172a;
  --line:rgba(148,163,184,.22);
  --text:#e5eefb;
  --muted:#9fb0c8;
  --cream:#0b1220;
  color-scheme: dark;
}

.dark-mode body,
body.dark-mode {
  background:
    radial-gradient(circle at 15% 10%, rgba(56,189,248,.16), transparent 22%),
    radial-gradient(circle at 80% 18%, rgba(16,185,129,.12), transparent 20%),
    linear-gradient(180deg,#07111f,#0b1220 52%,#111827);
}

.dark-mode .panel,
.dark-mode .dashboard-card,
.dark-mode .login-card,
.dark-mode .ai-sidebar,
.dark-mode .ai-chat-panel,
.dark-mode .upgrade-card,
.dark-mode .upgrade-submission-card,
.dark-mode .upgrade-project-card {
  background: linear-gradient(180deg, rgba(15,23,42,.94), rgba(17,24,39,.86));
  border-color: rgba(148,163,184,.2);
  color: var(--text);
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
  background:#111827;
  color:var(--text);
  border-color:rgba(148,163,184,.24);
}

.dark-mode .project-item,
.dark-mode .leader-item,
.dark-mode .voltage-row {
  background:#111827;
}

.ai-sidebar {
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

.ai-sidebar .ai-card {
  flex:0 0 auto;
}

.ai-sidebar::-webkit-scrollbar {
  width:10px;
}

.ai-sidebar::-webkit-scrollbar-thumb {
  background:rgba(100,116,139,.28);
  border-radius:999px;
  border:3px solid transparent;
  background-clip:content-box;
}

.ai-sidebar::-webkit-scrollbar-thumb:hover {
  background:rgba(59,130,246,.38);
  border:3px solid transparent;
  background-clip:content-box;
}

html {
  scroll-behavior:smooth;
}

.saas-landing {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: auto;
  color: #121621;
  background:
    linear-gradient(rgba(18,22,33,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18,22,33,.045) 1px, transparent 1px),
    linear-gradient(115deg, rgba(16,185,129,.18) 0%, rgba(16,185,129,0) 38%),
    linear-gradient(245deg, rgba(249,115,22,.16) 0%, rgba(249,115,22,0) 42%),
    linear-gradient(135deg, #fbfffd 0%, #f0fff8 48%, #fff7f2 100%);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
  padding: 24px;
}

.dark-mode .saas-landing {
  color:#f3f7f2;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(115deg, rgba(45,212,191,.16) 0%, rgba(45,212,191,0) 40%),
    linear-gradient(245deg, rgba(251,146,60,.17) 0%, rgba(251,146,60,0) 42%),
    linear-gradient(135deg, #101510 0%, #151a16 54%, #241a17 100%);
}

.landing-orb {
  display:none;
}

.landing-orb-one {
  width: 260px;
  height: 260px;
  left: -70px;
  bottom: 14%;
  background: rgba(249,115,22,.28);
}

.landing-orb-two {
  width: 320px;
  height: 320px;
  right: -90px;
  top: 20%;
  background: rgba(15,98,254,.18);
  animation-delay: -4s;
}

.landing-nav,
.landing-hero,
.landing-features,
.landing-social-proof,
.landing-footer-row {
  width: min(1180px, 100%);
  margin-inline: auto;
  position: relative;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0 36px;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.landing-brand b {
  display:block;
  font-size: 17px;
  letter-spacing: .08em;
}

.landing-brand small {
  display:block;
  color:#64748b;
  margin-top:2px;
}

.dark-mode .landing-brand small {
  color:#9fb0c8;
}

.logo-pulse {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display:grid;
  place-items:center;
  position:relative;
  background: rgba(255,255,255,.72);
  box-shadow: 0 18px 40px rgba(249,115,22,.2);
}

.logo-pulse::before,
.logo-pulse::after {
  content:"";
  position:absolute;
  inset:-6px;
  border-radius:24px;
  border:1px solid rgba(249,115,22,.32);
  animation: lightningPulse 2.2s ease-out infinite;
}

.logo-pulse::after {
  animation-delay:.8s;
}

.logo-pulse img {
  width: 42px;
  height: 42px;
  object-fit:contain;
  border-radius:12px;
  z-index:1;
}

.lightning-bolt {
  position:absolute;
  right:-8px;
  top:-8px;
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:linear-gradient(135deg,#f97316,#facc15);
  color:white;
  box-shadow:0 10px 20px rgba(249,115,22,.28);
  animation: boltFlicker 1.7s ease-in-out infinite;
  z-index:2;
}

.landing-nav-actions,
.landing-actions,
.landing-footer-row {
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.landing-hero {
  display:grid;
  grid-template-columns:minmax(0, 1.05fr) minmax(320px, .8fr);
  gap:42px;
  align-items:center;
}

.landing-kicker {
  display:inline-flex;
  padding:8px 12px;
  border-radius:8px;
  background:rgba(16,185,129,.12);
  color:#047857;
  border:1px solid rgba(16,185,129,.22);
  font-weight:800;
  font-size:13px;
}

.dark-mode .landing-kicker {
  background:rgba(45,212,191,.13);
  color:#99f6e4;
}

.landing-copy h1 {
  font-size: 72px;
  line-height:.94;
  letter-spacing:0;
  margin:20px 0 20px;
  max-width:780px;
}

.landing-copy p {
  max-width:680px;
  color:#526176;
  font-size:18px;
  line-height:1.7;
  margin:0;
}

.dark-mode .landing-copy p {
  color:#b6c4d8;
}

.landing-primary,
.landing-secondary {
  margin-top:28px;
  height:48px;
  border-radius:999px;
  padding:0 22px;
}

.landing-primary {
  background:linear-gradient(135deg,#0f766e,#16a34a);
  box-shadow:0 18px 38px rgba(15,118,110,.22);
}

.landing-secondary {
  background:rgba(255,255,255,.78);
  color:#0f172a;
  border:1px solid rgba(15,23,42,.08);
}

.dark-mode .landing-secondary {
  background:rgba(15,23,42,.84);
  color:#e5eefb;
  border-color:rgba(148,163,184,.2);
}

.landing-primary,
.landing-secondary,
.landing-features article,
.landing-metrics div,
.landing-product-card,
.proof-stat,
.landing-social-proof blockquote {
  transition:transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.landing-primary:hover,
.landing-secondary:hover,
.landing-features article:hover,
.landing-metrics div:hover,
.proof-stat:hover,
.landing-social-proof blockquote:hover {
  transform:translateY(-4px);
  box-shadow:0 28px 62px rgba(15,23,42,.13);
}

.landing-metrics {
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:28px;
  max-width:640px;
}

.landing-metrics div,
.landing-features article,
.landing-product-card {
  border:1px solid rgba(20,83,45,.12);
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(18px);
  box-shadow:0 24px 70px rgba(20,83,45,.08);
}

.dark-mode .landing-metrics div,
.dark-mode .landing-features article,
.dark-mode .landing-product-card {
  background:rgba(15,23,42,.72);
  border-color:rgba(148,163,184,.18);
}

.landing-metrics div {
  border-radius:22px;
  padding:16px;
}

.landing-metrics b,
.landing-metrics span {
  display:block;
}

.landing-metrics b {
  font-size:24px;
  letter-spacing:0;
}

.landing-metrics span {
  color:#64748b;
  font-size:13px;
  margin-top:4px;
}

.landing-product-card {
  border-radius:8px;
  padding:20px;
  min-height:420px;
  transform:rotate(1.5deg);
  animation: productRise .6s ease;
}

.product-card-top {
  display:flex;
  gap:7px;
  margin-bottom:24px;
}

.product-card-top span {
  width:11px;
  height:11px;
  border-radius:999px;
  background:#fb7185;
}

.product-card-top span:nth-child(2) {
  background:#facc15;
}

.product-card-top span:nth-child(3) {
  background:#34d399;
}

.product-score {
  padding:22px;
  border-radius:8px;
  background:linear-gradient(135deg,#0f766e,#22c55e);
  color:white;
  box-shadow:0 28px 56px rgba(15,118,110,.18);
  position:relative;
  overflow:hidden;
}

.product-score::after {
  content:"";
  position:absolute;
  inset:-40% -20% auto auto;
  width:180px;
  height:180px;
  border-radius:999px;
  background:rgba(255,255,255,.18);
  animation:landingFloat 7s ease-in-out infinite;
}

.product-score p,
.product-score small {
  margin:0;
  opacity:.84;
}

.product-score strong {
  display:block;
  font-size:58px;
  letter-spacing:0;
  margin:8px 0;
}

.product-circuit {
  display:flex;
  align-items:center;
  gap:10px;
  margin:22px 0;
}

.product-circuit div {
  border:1px solid rgba(148,163,184,.22);
  background:rgba(255,255,255,.86);
  border-radius:8px;
  padding:12px;
  font-weight:800;
  font-size:13px;
}

.landing-lab-node {
  cursor:pointer;
}

.landing-lab-node.active {
  border-color:rgba(16,185,129,.34);
  box-shadow:0 0 0 4px rgba(16,185,129,.08);
}

.landing-lab-node.warning {
  border-color:rgba(245,158,11,.45);
  box-shadow:0 0 0 4px rgba(245,158,11,.1);
}

.dark-mode .product-circuit div {
  background:#111827;
}

.product-circuit span {
  height:3px;
  flex:1;
  background:linear-gradient(90deg,#f97316,#16a34a);
  border-radius:999px;
}

.product-debug {
  padding:18px;
  border-radius:8px;
  background:rgba(16,185,129,.1);
  border:1px solid rgba(16,185,129,.18);
}

.product-debug p {
  margin:8px 0 0;
  color:#526176;
  line-height:1.55;
}

.dark-mode .product-debug p {
  color:#b6c4d8;
}

.landing-lab-actions {
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
  margin-top:14px;
}

.landing-lab-actions button {
  border:none;
  border-radius:8px;
  padding:10px 12px;
  background:rgba(15,23,42,.06);
  color:#0f172a;
  font-weight:900;
  font-size:12px;
}

.landing-lab-actions button.active,
.landing-lab-actions button:hover {
  background:linear-gradient(135deg,#0f766e,#16a34a);
  color:white;
}

.dark-mode .landing-lab-actions button {
  background:rgba(148,163,184,.14);
  color:#dbeafe;
}

.landing-product-card.lab-warning .product-score {
  background:linear-gradient(135deg,#f59e0b,#f97316);
}

.landing-product-card.lab-teacher .product-score {
  background:linear-gradient(135deg,#1f2933,#0f766e);
}

.landing-features {
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:16px;
  margin-top:42px;
}

.landing-social-proof {
  display:grid;
  grid-template-columns:280px 1fr 1fr;
  gap:16px;
  margin-top:42px;
}

.proof-stat,
.landing-social-proof blockquote {
  margin:0;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(18px);
  border-radius:28px;
  padding:22px;
  box-shadow:0 24px 70px rgba(15,23,42,.08);
}

.dark-mode .proof-stat,
.dark-mode .landing-social-proof blockquote {
  background:rgba(15,23,42,.72);
  border-color:rgba(148,163,184,.18);
}

.proof-stat b {
  display:block;
  font-size:42px;
  letter-spacing:-.06em;
}

.proof-stat span,
.landing-social-proof cite {
  display:block;
  color:#64748b;
  font-size:13px;
  margin-top:8px;
  font-style:normal;
}

.landing-social-proof blockquote {
  color:#243044;
  line-height:1.65;
}

.dark-mode .landing-social-proof blockquote {
  color:#dbeafe;
}

.dark-mode .proof-stat span,
.dark-mode .landing-social-proof cite {
  color:#9fb0c8;
}

.landing-features article {
  border-radius:26px;
  padding:20px;
}

.landing-features b,
.landing-features span {
  display:block;
}

.landing-features span {
  color:#64748b;
  line-height:1.55;
  margin-top:8px;
}

.dark-mode .landing-features span,
.dark-mode .landing-metrics span {
  color:#9fb0c8;
}

.landing-footer-row {
  justify-content:space-between;
  color:#64748b;
  font-size:13px;
  margin-top:28px;
  padding-bottom:10px;
}

.landing-footer-row a {
  color:#0f62fe;
  font-weight:800;
  text-decoration:none;
}

.reveal-on-scroll {
  opacity:1;
  transform:translateY(0);
  transition:opacity .55s ease, transform .55s ease;
}

.reveal-effects-enabled .reveal-on-scroll {
  opacity:0;
  transform:translateY(18px);
}

.reveal-effects-enabled .reveal-on-scroll.is-visible {
  opacity:1;
  transform:translateY(0);
}

.theme-toggle-btn {
  min-width:112px;
}

.login-screen .premium-login-card {
  width:min(560px, 94vw);
  padding:28px;
  border-radius:34px;
  background:rgba(255,255,255,.86);
  border:1px solid rgba(15,23,42,.08);
  box-shadow:0 36px 110px rgba(15,23,42,.18);
}

.dark-mode .login-screen {
  background:
    radial-gradient(circle at 18% 12%, rgba(59,130,246,.18), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(16,185,129,.14), transparent 18%),
    linear-gradient(180deg,#07111f,#0f172a);
}

.login-progress {
  margin:18px 0 22px;
}

.login-progress-line {
  height:8px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(148,163,184,.22);
}

.login-progress-line span {
  display:block;
  width:0;
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,#0f62fe,#10b981);
  transition:width .28s ease;
}

.premium-login-card[data-step="2"] .login-progress-line span {
  width:100%;
}

.login-progress-steps {
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  letter-spacing:.02em;
  margin-top:8px;
}

.login-progress-steps span.active {
  color:#0f62fe;
}

.dark-mode .login-progress-steps span.active {
  color:#7dd3fc;
}

.login-step {
  display:none;
  animation:stepFade .26s ease;
}

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

.premium-login-card[data-step="1"] .login-actions-step2,
.premium-login-card[data-step="2"] .login-actions-step1 {
  display:none;
}

.login-screen .login-demo-row {
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid rgba(148,163,184,.18);
}

.login-screen .login-actions {
  margin-top:14px;
}

.login-screen .access-model-field {
  margin-top:12px;
}

.login-screen .access-model-copy {
  margin:8px 0 0;
  line-height:1.45;
}

.login-screen input,
.login-screen select,
.login-screen textarea {
  transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.login-screen input:focus,
.login-screen select:focus,
.login-screen textarea:focus {
  border-color:rgba(15,98,254,.42);
  box-shadow:0 0 0 4px rgba(15,98,254,.1);
  outline:none;
}

.upgrade-ready .top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-picker {
  display:grid;
  grid-template-columns:auto minmax(88px, 1fr);
  align-items:center;
  gap:8px;
  height:40px;
  max-width:170px;
  padding:4px 10px;
  border:1px solid rgba(75,95,130,.14);
  border-radius:8px;
  background:rgba(255,255,255,.72);
  box-shadow:0 8px 18px rgba(15,23,42,.05);
  color:var(--text);
}

.language-picker-label {
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  letter-spacing:0;
  white-space:nowrap;
}

.language-select {
  width:100%;
  min-width:0;
  border:0;
  outline:0;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  font:inherit;
  font-size:13px;
  font-weight:900;
}

.language-picker:focus-within {
  border-color:rgba(15,98,254,.35);
  box-shadow:0 0 0 4px rgba(15,98,254,.1), 0 8px 18px rgba(15,23,42,.05);
}

#loginAccessModel {
  color: var(--text);
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
}

.upgrade-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(59, 130, 246, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(239,246,255,0.88));
}

.upgrade-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -20px auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.14), transparent 60%);
  pointer-events: none;
}

.upgrade-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.upgrade-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin: 10px 0 6px;
}

.upgrade-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f62fe, #10b981);
  transition: width 220ms ease;
}

.upgrade-stat-row,
.upgrade-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upgrade-stat-row b,
.upgrade-summary-item b {
  color: var(--text);
}

.upgrade-summary-grid {
  display: grid;
  gap: 10px;
}

.upgrade-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.upgrade-submission-list,
.upgrade-project-grid {
  display: grid;
  gap: 12px;
}

.upgrade-project-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.upgrade-leaderboard-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.upgrade-submission-card,
.upgrade-project-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.upgrade-project-card.liked {
  border-color:rgba(249,115,22,.45);
}

.upgrade-like-count {
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:6px 10px;
  background:rgba(249,115,22,.1);
  color:#c2410c;
  font-weight:800;
  font-size:12px;
}

.remote-graded-header {
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  border-radius:22px;
  border:1px solid rgba(15,98,254,.14);
  background:linear-gradient(135deg, rgba(15,98,254,.08), rgba(16,185,129,.08));
}

.remote-graded-header b,
.remote-graded-header span {
  display:block;
}

.remote-graded-header span {
  color:var(--muted);
  font-size:13px;
  margin-top:4px;
}

.graded-feedback {
  margin:10px 0 0;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(16,185,129,.1);
  color:#047857;
  line-height:1.45;
}

.dark-mode .graded-feedback {
  color:#86efac;
}

.ai-debug-toast {
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  max-width:min(720px, calc(100vw - 28px));
  z-index:13000;
  padding:14px 16px;
  border-radius:18px;
  background:rgba(15,23,42,.94);
  color:white;
  box-shadow:0 24px 60px rgba(15,23,42,.28);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease, transform .22s ease;
}

.ai-debug-toast.show {
  opacity:1;
  transform:translateX(-50%) translateY(-6px);
}

.auto-grade-pill {
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:6px 10px;
  background:rgba(16,185,129,.12);
  color:#047857;
  font-size:12px;
  font-weight:900;
}

.simulation-feedback-panel {
  position:absolute;
  left:22px;
  top:82px;
  z-index:60;
  width:min(380px, calc(100% - 44px));
  padding:16px;
  border-radius:24px;
  border:1px solid rgba(148,163,184,.2);
  background:rgba(255,255,255,.9);
  backdrop-filter:blur(18px);
  box-shadow:0 28px 80px rgba(15,23,42,.18);
  transform:translateY(-10px) scale(.98);
  opacity:0;
  pointer-events:none;
  transition:opacity .24s ease, transform .24s ease;
}

.dark-mode .simulation-feedback-panel {
  background:rgba(15,23,42,.9);
}

.simulation-feedback-panel.show {
  opacity:1;
  transform:translateY(0) scale(1);
}

.simulation-feedback-panel.success {
  border-color:rgba(16,185,129,.28);
}

.simulation-feedback-panel.warning {
  border-color:rgba(245,158,11,.32);
}

.simulation-feedback-panel.danger {
  border-color:rgba(239,68,68,.34);
}

.simulation-feedback-top {
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.simulation-feedback-icon {
  width:42px;
  height:42px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#0f62fe,#10b981);
  color:white;
  font-weight:900;
  box-shadow:0 14px 26px rgba(15,98,254,.2);
}

.simulation-feedback-panel.warning .simulation-feedback-icon {
  background:linear-gradient(135deg,#f59e0b,#f97316);
}

.simulation-feedback-panel.danger .simulation-feedback-icon {
  background:linear-gradient(135deg,#ef4444,#f97316);
}

.simulation-feedback-panel h4 {
  margin:0 0 4px;
}

.simulation-feedback-panel p,
.simulation-feedback-panel li {
  color:var(--muted);
  font-size:13px;
  line-height:1.45;
}

.simulation-feedback-panel p {
  margin:0;
}

.simulation-feedback-panel ul {
  margin:12px 0 0;
  padding-left:18px;
}

.coach-score-card,
.voltage-health-card,
.component-health-list {
  margin-top:14px;
}

.learning-challenge-tabs {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  margin-top:12px;
}

.learning-challenge-tabs button {
  width:100%;
  min-width:0;
  border-radius:8px;
}

.learning-challenge-tabs button.active {
  color:#fff;
  background:linear-gradient(135deg,#0f62fe,#10b981);
  border-color:rgba(15,98,254,.18);
  box-shadow:0 12px 24px rgba(15,98,254,.16);
}

.learning-score-row {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  margin-top:12px;
}

.learning-score-row div {
  padding:10px;
  border-radius:8px;
  background:rgba(148,163,184,.11);
  border:1px solid rgba(148,163,184,.14);
}

.learning-score-row span,
.learning-score-row b {
  display:block;
}

.learning-score-row span {
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.learning-score-row b {
  margin-top:4px;
  color:var(--text);
}

.learning-meter {
  height:8px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(148,163,184,.22);
  margin-top:10px;
}

.learning-meter span {
  display:block;
  height:100%;
  width:0;
  border-radius:inherit;
  background:linear-gradient(90deg,#ef4444,#f59e0b,#10b981);
  transition:width .24s ease;
}

.learning-hint {
  margin:10px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.learning-requirements {
  display:grid;
  gap:7px;
  margin-top:10px;
}

.learning-requirement {
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:8px;
  background:rgba(255,255,255,.7);
  border:1px solid rgba(148,163,184,.15);
  font-size:12px;
}

.dark-mode .learning-requirement,
.dark-mode .learning-score-row div {
  background:rgba(15,23,42,.68);
}

.learning-requirement span {
  width:18px;
  height:18px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:rgba(148,163,184,.16);
  color:var(--muted);
  font-weight:900;
}

.learning-requirement.passed span {
  background:rgba(16,185,129,.16);
  color:#047857;
}

.learning-requirement.pending {
  color:var(--muted);
}

.coach-score-card {
  padding:12px;
  border-radius:18px;
  background:linear-gradient(135deg, rgba(15,98,254,.08), rgba(16,185,129,.08));
  border:1px solid rgba(15,98,254,.12);
}

.coach-score-head,
.voltage-meter-head {
  display:flex;
  justify-content:space-between;
  gap:12px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.coach-score-head b {
  color:var(--text);
}

.coach-meter,
.voltage-meter {
  height:9px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(148,163,184,.22);
  margin-top:8px;
}

.coach-meter span,
.voltage-meter span {
  display:block;
  height:100%;
  width:0;
  border-radius:inherit;
  background:linear-gradient(90deg,#ef4444,#f59e0b,#10b981);
  transition:width .24s ease;
}

.coach-suggestion-list {
  display:grid;
  gap:8px;
  margin-top:12px;
}

.coach-suggestion {
  padding:9px 10px;
  border-radius:14px;
  color:var(--muted);
  background:rgba(148,163,184,.12);
  font-size:12px;
  line-height:1.45;
}

.ai-precision-card {
  background:
    linear-gradient(180deg, rgba(15,98,254,.08), rgba(16,185,129,.08)),
    rgba(255,255,255,.9);
  border-color:rgba(15,98,254,.18);
}

.ai-precision-card p {
  color:var(--text);
  font-weight:700;
}

.ai-teacher-page .ai-chip,
.ai-teacher-page .secondary {
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ai-teacher-page .ai-chip:hover,
.ai-teacher-page .secondary:hover {
  transform:translateY(-2px);
  box-shadow:0 14px 24px rgba(15,98,254,.12);
}

.ai-message.teacher::before {
  content:"AI Teacher";
  display:block;
  margin-bottom:6px;
  color:#0f62fe;
  font-size:11px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}

.ai-message.student::before {
  content:"You";
  display:block;
  margin-bottom:6px;
  color:rgba(255,255,255,.78);
  font-size:11px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}

.status-chip-safe,
.status-chip-warning,
.status-chip-danger {
  border-radius:999px;
  padding:4px 9px;
}

.status-chip-safe {
  background:rgba(16,185,129,.12);
  color:#047857;
}

.status-chip-warning {
  background:rgba(245,158,11,.14);
  color:#b45309;
}

.status-chip-danger {
  background:rgba(239,68,68,.12);
  color:#b91c1c;
}

.component-health-list {
  display:grid;
  gap:8px;
}

.component-health-chip {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(148,163,184,.18);
}

.dark-mode .component-health-chip {
  background:rgba(15,23,42,.7);
}

.component-health-chip span:first-child {
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
}

.component-health-chip.safe {
  border-color:rgba(16,185,129,.22);
}

.component-health-chip.warning {
  border-color:rgba(245,158,11,.28);
}

.component-health-chip.danger {
  border-color:rgba(239,68,68,.28);
}

button,
.btn,
.component-card,
.example-item,
.dashboard-card,
.upgrade-project-card,
.upgrade-submission-card,
.landing-features article,
.landing-metrics div {
  position:relative;
}

button,
.btn {
  overflow:hidden;
}

button:hover,
.btn:hover,
.dashboard-card:hover,
.upgrade-card:hover,
.upgrade-project-card:hover,
.upgrade-submission-card:hover,
.example-item:hover {
  transform:translateY(-2px);
}

button,
.btn,
.dashboard-card,
.upgrade-card,
.upgrade-project-card,
.upgrade-submission-card,
.example-item {
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.ui-ripple {
  position:absolute;
  border-radius:999px;
  background:rgba(255,255,255,.42);
  transform:scale(0);
  animation:ripplePop .62s ease-out;
  pointer-events:none;
}

.dark-mode .ui-ripple {
  background:rgba(125,211,252,.24);
}

@keyframes lightningPulse {
  0% { opacity:.9; transform:scale(.88); }
  70%, 100% { opacity:0; transform:scale(1.35); }
}

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

@keyframes ripplePop {
  to { transform:scale(3.2); opacity:0; }
}

@keyframes boltFlicker {
  0%, 100% { transform:rotate(-8deg) scale(1); }
  50% { transform:rotate(8deg) scale(1.14); }
}

@keyframes landingFloat {
  0%, 100% { transform:translate3d(0,0,0); }
  50% { transform:translate3d(20px,-18px,0); }
}

@keyframes productRise {
  from { opacity:0; transform:translateY(20px) rotate(0); }
  to { opacity:1; transform:translateY(0) rotate(1.5deg); }
}

.upgrade-submission-card h4,
.upgrade-project-card h3 {
  margin: 0 0 6px;
}

.upgrade-submission-card p,
.upgrade-project-card p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.upgrade-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.upgrade-overlay-shell {
  height: 100%;
  border-radius: 28px;
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
  box-shadow: 0 40px 90px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.upgrade-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.upgrade-overlay-head h2 {
  margin: 0;
}

.upgrade-overlay-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#exploreProjectsList {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 24px;
}

.intensity-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 98, 254, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(15, 98, 254, 0.2);
}

.canvas-item {
  will-change: transform, left, top;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.canvas-item:hover {
  transform: translateY(-2px);
}

.canvas-item.bursting {
  animation: burstPulse 0.6s ease infinite alternate;
}

.canvas-item.switch-control-item {
  border-color:rgba(37,99,235,.16);
}

.canvas-item.switch-control-item.switch-closed {
  box-shadow:0 18px 34px rgba(16,185,129,.14);
}

.switch-toggle-control {
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:30px;
  margin-top:10px;
  border-radius:8px;
  border:1px solid rgba(37,99,235,.18);
  background:#fff;
  color:#0f62fe;
  font-weight:900;
  cursor:pointer;
  transition:transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.switch-toggle-control:hover {
  transform:translateY(-1px);
  box-shadow:0 10px 18px rgba(15,98,254,.12);
}

.switch-closed .switch-toggle-control {
  background:linear-gradient(135deg, #0f62fe, #10b981);
  border-color:rgba(16,185,129,.34);
  color:#fff;
}

.voice-coach-btn[aria-pressed="true"] {
  color:#0f62fe;
  border-color:rgba(15,98,254,.22);
}

.voice-coach-controls {
  display:grid;
  grid-template-columns:auto minmax(160px, 1fr) minmax(132px, auto);
  align-items:center;
  gap:8px;
  width:100%;
}

.voice-coach-label {
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}

.voice-coach-select {
  width:100%;
  min-width:0;
  height:38px;
  border-radius:8px;
  border:1px solid rgba(75,95,130,.14);
  background:rgba(255,255,255,.76);
  color:var(--text);
  font-weight:800;
  padding:0 10px;
  box-shadow:0 6px 14px rgba(15,23,42,.04);
}

.voice-coach-select:focus {
  outline:none;
  border-color:rgba(15,98,254,.35);
  box-shadow:0 0 0 4px rgba(15,98,254,.1);
}

.voice-coach-btn {
  min-width:132px;
  white-space:nowrap;
}

body.upgrade-ready button.primary-action {
  border-radius:8px;
  background:linear-gradient(135deg, #0f62fe, #10b981);
  color:#fff;
  border:1px solid rgba(255,255,255,.28);
  box-shadow:0 18px 38px rgba(15,98,254,.22), inset 0 1px 0 rgba(255,255,255,.28);
  min-width:104px;
}

body.upgrade-ready #runLogicBtn.primary-action {
  min-width:132px;
}

body.upgrade-ready #saveBtn.primary-action {
  min-width:92px;
}

body.upgrade-ready button.secondary,
body.upgrade-ready button.quiet-action {
  border-radius:8px;
  background:rgba(255,255,255,.66);
  color:var(--muted);
  border-color:rgba(75,95,130,.12);
  box-shadow:0 6px 14px rgba(15,23,42,.04);
}

body.upgrade-ready button.secondary:hover,
body.upgrade-ready button.quiet-action:hover {
  color:var(--text);
  background:rgba(255,255,255,.9);
  box-shadow:0 10px 20px rgba(15,23,42,.07);
}

body.upgrade-ready .canvas-toolbar {
  align-items:stretch;
  flex-direction:column;
  gap:8px;
}

body.upgrade-ready .canvas-toolbar .toolbar-group:first-child {
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:8px;
  width:100%;
}

body.upgrade-ready .canvas-toolbar .toolbar-group:first-child button,
body.upgrade-ready .canvas-toolbar #runLogicBtn.primary-action {
  min-width:0;
  width:100%;
  padding-inline:8px;
  white-space:nowrap;
}

body.upgrade-ready .canvas-toolbar .toolbar-group:last-child {
  width:100%;
}

body.upgrade-ready .canvas-toolbar .toolbar-group:last-child .pill {
  justify-content:center;
  width:100%;
}

body.upgrade-ready button:active,
body.upgrade-ready .btn:active,
body.upgrade-ready .component-card:active,
body.upgrade-ready .example-item:active {
  transform:translateY(1px) scale(.98);
}

body.upgrade-ready .component-card,
body.upgrade-ready .example-item,
body.upgrade-ready .dashboard-card,
body.upgrade-ready .upgrade-project-card,
body.upgrade-ready .upgrade-submission-card {
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

body.upgrade-ready .component-card:hover,
body.upgrade-ready .example-item:hover,
body.upgrade-ready .dashboard-card:hover,
body.upgrade-ready .upgrade-project-card:hover,
body.upgrade-ready .upgrade-submission-card:hover {
  box-shadow:0 22px 48px rgba(15,23,42,.11);
}

#workspaceEmptyState {
  position:absolute;
  inset:86px 22px 190px;
  z-index:8;
  display:grid;
  place-items:center;
  pointer-events:none;
  transition:opacity .22s ease, transform .22s ease;
}

#workspaceEmptyState.hidden {
  opacity:0;
  transform:translateY(8px);
}

.workspace-empty-copy {
  display:grid;
  justify-items:center;
  gap:8px;
  text-align:center;
  color:var(--text);
}

.workspace-empty-copy b {
  font-size:22px;
  letter-spacing:0;
}

.workspace-empty-copy span {
  color:var(--muted);
  font-size:14px;
}

.workspace-quick-starts {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  margin-top:18px;
  pointer-events:auto;
}

.workspace-quick-starts button {
  border-radius:8px;
  min-width:120px;
  background:rgba(255,255,255,.9);
  color:#0f62fe;
  border:1px solid rgba(15,98,254,.18);
  box-shadow:0 12px 24px rgba(15,98,254,.08);
}

.workspace-quick-starts button:first-child {
  background:linear-gradient(135deg, rgba(15,98,254,.12), rgba(16,185,129,.14)), #fff;
}

.dark-mode .workspace-quick-starts button {
  background:rgba(15,23,42,.92);
  color:#7dd3fc;
  border-color:rgba(125,211,252,.22);
}

.dark-mode .workspace-quick-starts button:first-child {
  background:linear-gradient(135deg, rgba(56,189,248,.14), rgba(16,185,129,.12)), rgba(15,23,42,.92);
}

.workspace-area.workspace-is-empty .canvas-world {
  opacity:.72;
}

.workspace-area.workspace-wiring .port,
.workspace-area .port:hover {
  box-shadow:0 0 0 6px rgba(15,98,254,.12), 0 8px 16px rgba(37,99,235,.22);
}

.workspace-area.simulation-running::after {
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:3px;
  z-index:20;
  background:linear-gradient(90deg, transparent, #0f62fe, #10b981, transparent);
  animation:simulationSweep 1.3s ease-in-out infinite;
}

.workspace-area.simulation-running-error::after {
  background:linear-gradient(90deg, transparent, #f59e0b, #ef4444, transparent);
}

#wireLayer .wire-flow-dot {
  opacity:0;
  transition:opacity .18s ease;
  filter:drop-shadow(0 0 7px rgba(16,185,129,.7));
}

body.simulation-flow-active #wireLayer .wire-flow-dot.is-active {
  opacity:1;
}

#wireLayer .wire-path-upgraded {
  transition:stroke-width .18s ease, opacity .18s ease, filter .18s ease;
}

body.simulation-flow-active #wireLayer .wire-path-active {
  stroke-width:5.5 !important;
  stroke-dasharray:12 10;
  animation:wireDash 1s linear infinite;
  filter:drop-shadow(0 0 7px rgba(15,98,254,.32));
}

body.simulation-flow-error #wireLayer .wire-path-active {
  filter:drop-shadow(0 0 7px rgba(245,158,11,.42));
}

.ai-debug-toast {
  display:grid;
  gap:10px;
  border:1px solid rgba(255,255,255,.12);
}

.ai-debug-toast.status-safe {
  background:linear-gradient(135deg, rgba(5,150,105,.96), rgba(15,23,42,.96));
}

.ai-debug-toast.status-error {
  background:linear-gradient(135deg, rgba(185,28,28,.96), rgba(15,23,42,.96));
}

.ai-debug-toast-head {
  display:flex;
  align-items:center;
  gap:10px;
}

.ai-debug-toast-head b {
  font-size:14px;
}

.ai-debug-toast p {
  margin:0;
  color:rgba(255,255,255,.82);
  line-height:1.45;
  font-size:13px;
}

.ai-debug-status-pill {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:54px;
  border-radius:999px;
  padding:5px 9px;
  background:rgba(255,255,255,.16);
  color:#fff;
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
}

.ai-debug-toast-grid {
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:10px;
}

.ai-debug-toast-grid span {
  display:grid;
  gap:3px;
  padding:8px 10px;
  border-radius:8px;
  background:rgba(255,255,255,.1);
  color:rgba(255,255,255,.82);
  font-size:12px;
  line-height:1.35;
}

.ai-debug-toast-grid b {
  color:#fff;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.debugger-response-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  margin-top:12px;
}

.debugger-response-grid div {
  padding:10px;
  border-radius:8px;
  background:rgba(148,163,184,.12);
  border:1px solid rgba(148,163,184,.16);
}

.debugger-response-grid .wide {
  grid-column:1 / -1;
}

.debugger-response-grid span,
.debugger-response-grid b,
.debugger-response-grid p {
  display:block;
}

.debugger-response-grid span {
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-bottom:4px;
}

.debugger-response-grid b {
  color:var(--text);
  text-transform:uppercase;
}

.debugger-response-grid p {
  margin:0;
}

.debugger-status-safe {
  color:#047857 !important;
}

.debugger-status-error {
  color:#b91c1c !important;
}

@keyframes wireDash {
  to { stroke-dashoffset:-22; }
}

@keyframes simulationSweep {
  0% { transform:translateX(-100%); opacity:.2; }
  45% { opacity:1; }
  100% { transform:translateX(100%); opacity:.2; }
}

@media (prefers-reduced-motion: reduce) {
  body.simulation-flow-active #wireLayer .wire-path-active,
  .workspace-area.simulation-running::after {
    animation:none;
  }

  .ui-ripple {
    animation:none;
    display:none;
  }
}

@keyframes burstPulse {
  from {
    box-shadow: 0 12px 26px rgba(239, 68, 68, 0.16);
  }
  to {
    box-shadow: 0 18px 42px rgba(239, 68, 68, 0.34);
  }
}

@media (max-width: 1100px) {
  .topbar {
    height: auto;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .saas-landing {
    padding:18px;
  }

  .landing-nav,
  .landing-hero,
  .landing-features,
  .landing-social-proof {
    grid-template-columns:1fr;
  }

  .landing-nav {
    flex-direction:column;
    align-items:flex-start;
  }

  .landing-metrics {
    grid-template-columns:1fr;
  }

  .landing-product-card {
    min-height:auto;
    transform:none;
  }

  .landing-lab-actions {
    grid-template-columns:1fr;
  }

  .landing-features {
    display:grid;
  }

  .login-screen .login-demo-row,
  .remote-graded-header {
    flex-direction:column;
    align-items:stretch;
  }

  .simulation-feedback-panel {
    left:14px;
    top:76px;
    width:calc(100% - 28px);
  }

  .upgrade-leaderboard-grid {
    grid-template-columns:1fr;
  }

  .ai-shell {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .upgrade-submission-card,
  .upgrade-project-card,
  .upgrade-overlay-head {
    flex-direction: column;
    align-items: stretch;
  }

  .layout {
    padding: 14px;
    gap: 14px;
  }
}

/* Responsive simulator shell */
html,
body {
  max-width:100%;
}

body {
  overflow-x:hidden;
}

.app-shell,
.topbar,
.layout,
.panel,
.canvas-panel,
.workspace-area,
.dashboard-card,
.component-card,
.example-item {
  min-width:0;
}

.app-shell {
  width:100%;
  min-height:100vh;
  min-height:100dvh;
}

.topbar {
  height:auto;
  min-height:72px;
  gap:14px;
  flex-wrap:wrap;
}

.brand {
  flex:1 1 250px;
  min-width:0;
}

.brand > .brand {
  flex:0 1 auto;
}

.brand-text {
  min-width:0;
}

.brand-text h1,
.panel-header h2,
.ai-topbar-title h2 {
  letter-spacing:0;
  overflow-wrap:anywhere;
}

.top-actions {
  flex:2 1 560px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:0;
}

.top-actions > *,
.toolbar-group > *,
.mini-actions > * {
  min-width:0;
}

.top-actions button,
.top-actions .pill,
.top-actions .zoom-display,
.top-actions .language-picker {
  max-width:100%;
  white-space:nowrap;
}

.layout {
  width:100%;
  grid-template-columns:minmax(230px, 300px) minmax(360px, 1fr) minmax(250px, 320px);
  grid-template-areas:"components canvas dashboard";
  align-items:stretch;
}

.layout > .panel:nth-child(1) {
  grid-area:components;
}

.layout > .panel:nth-child(2) {
  grid-area:canvas;
}

.layout > .panel:nth-child(3) {
  grid-area:dashboard;
}

.panel {
  display:flex;
  flex-direction:column;
}

.panel-header {
  flex:0 0 auto;
}

.panel-body {
  flex:1 1 auto;
  min-height:0;
  height:auto;
}

.stat {
  align-items:flex-start;
}

.stat b,
.card-title,
.component-name,
.project-name,
.pill {
  overflow-wrap:anywhere;
}

.mini-actions {
  align-items:center;
}

.ai-topbar {
  height:auto;
  min-height:76px;
  flex-wrap:wrap;
}

.ai-inputbar,
.guide-header,
.project-page-header {
  min-width:0;
}

@media (max-width: 1320px) {
  .landing-copy h1 {
    font-size:64px;
  }

  .layout {
    grid-template-columns:minmax(220px, 280px) minmax(340px, 1fr) minmax(230px, 300px);
  }

  .topbar {
    padding:12px 14px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  html,
  body {
    height:100%;
    overflow:hidden;
  }

  .app-shell {
    height:100vh;
    height:100dvh;
    min-height:0;
  }

  .topbar {
    min-height:62px;
    padding:8px 12px;
    gap:8px;
  }

  .brand {
    flex-basis:220px;
    gap:8px;
  }

  .brand-logo {
    width:44px;
    height:44px;
  }

  .brand-text h1 {
    font-size:22px;
  }

  .brand-text p {
    font-size:11px;
    margin-top:1px;
  }

  .top-actions {
    gap:6px;
  }

  .top-actions button,
  .top-actions .zoom-display,
  .top-actions .pill,
  .top-actions .language-picker {
    min-height:34px;
    height:34px;
    padding:7px 10px;
    border-radius:8px;
    font-size:12px;
    line-height:1.15;
  }

  .layout {
    gap:12px;
    padding:12px;
    grid-template-columns:minmax(218px, 260px) minmax(340px, 1fr) minmax(224px, 286px);
  }

  .panel {
    border-radius:18px;
  }

  .panel-header {
    padding:11px 12px 8px;
  }

  .panel-header h2 {
    font-size:19px;
  }

  .panel-header small {
    font-size:11px;
  }

  .panel-body {
    padding:12px;
  }

  .component-grid,
  .example-list {
    gap:8px;
  }

  .left-section-title {
    margin:8px 0 9px;
    font-size:12px;
  }

  .component-card {
    min-height:78px;
    padding:10px;
    border-radius:14px;
  }

  .component-icon {
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:16px;
    margin-bottom:7px;
  }

  .component-name {
    font-size:13px;
    margin-bottom:2px;
  }

  .component-meta {
    font-size:11px;
    line-height:1.3;
  }

  .example-item {
    padding:10px;
    border-radius:14px;
    font-size:12px;
  }

  .canvas-toolbar {
    padding:9px 12px;
    gap:6px;
  }

  body.upgrade-ready .canvas-toolbar {
    gap:6px;
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:first-child {
    gap:6px;
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:first-child button,
  body.upgrade-ready .canvas-toolbar #runLogicBtn.primary-action {
    height:34px;
    min-height:34px;
    padding-inline:8px;
    font-size:12px;
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:last-child .pill {
    min-height:28px;
    height:auto;
    padding:6px 10px;
    font-size:11px;
  }

  #workspaceEmptyState {
    inset:68px 16px 142px;
  }

  .workspace-empty-copy {
    gap:6px;
  }

  .workspace-empty-copy b {
    font-size:20px;
  }

  .workspace-empty-copy span {
    font-size:13px;
  }

  .workspace-quick-starts {
    margin-top:12px;
  }

  .workspace-quick-starts button {
    height:34px;
    min-height:34px;
  }

  .logic-dock {
    left:12px;
    right:12px;
    bottom:12px;
    min-height:118px;
    padding:12px;
    border-radius:18px;
  }

  .logic-dock h3 {
    font-size:16px;
    margin-bottom:8px;
  }

  .logic-list {
    min-height:48px;
  }

  .logic-chip {
    padding:8px 10px;
    font-size:12px;
  }

  .mini-actions {
    gap:7px;
    margin-top:8px;
  }

  .mini-actions button {
    height:34px;
    min-height:34px;
    padding:7px 10px;
    font-size:12px;
  }

  #deleteBin {
    width:56px;
    height:56px;
    right:14px;
    bottom:120px;
    font-size:24px;
    border-radius:12px;
  }

  .dashboard-card {
    padding:12px;
    margin-bottom:8px;
    border-radius:14px;
  }

  .card-title {
    font-size:16px;
    margin-bottom:8px;
  }

  .stat {
    margin:5px 0;
    gap:8px;
    font-size:12px;
  }

  .small-note {
    font-size:11px;
    line-height:1.35;
  }
}

@media (max-width: 980px) {
  html,
  body {
    height:auto;
    min-height:100%;
    overflow:auto;
    overflow-x:hidden;
  }

  .app-shell {
    height:auto;
    min-height:100vh;
    min-height:100dvh;
  }

  .layout {
    grid-template-columns:minmax(220px, 280px) minmax(0, 1fr);
    grid-template-areas:
      "components canvas"
      "dashboard dashboard";
    align-items:stretch;
  }

  .layout > .panel:nth-child(1),
  .canvas-panel {
    height:min(640px, calc(100dvh - 150px));
    min-height:520px;
  }

  .workspace-area {
    min-height:0;
  }

  .layout > .panel:nth-child(3) {
    min-height:320px;
  }

  .top-actions {
    justify-content:flex-start;
  }
}

@media (max-width: 900px) {
  .landing-copy h1 {
    font-size:52px;
    line-height:1;
  }

  .layout {
    grid-template-columns:1fr;
    grid-template-areas:
      "canvas"
      "components"
      "dashboard";
  }

  .canvas-panel {
    height:620px;
    min-height:560px;
  }

  .workspace-area {
    height:auto;
    min-height:0;
  }

  .layout > .panel:nth-child(1) {
    height:560px;
  }

  .panel {
    min-height:0;
  }

  .panel-body {
    max-height:none;
  }
}

@media (max-width: 640px) {
  .saas-landing {
    padding:14px;
  }

  .landing-copy h1 {
    font-size:40px;
  }

  .landing-copy p {
    font-size:16px;
  }

  .landing-actions,
  .landing-nav-actions,
  .login-actions,
  .login-screen .login-demo-row,
  .project-card-actions {
    align-items:stretch;
    flex-direction:column;
  }

  .landing-actions button,
  .landing-nav-actions button,
  .login-actions button,
  .login-screen .login-demo-row button,
  .project-card-actions button {
    width:100%;
  }

  .topbar {
    padding:10px;
  }

  .brand-logo {
    width:48px;
    height:48px;
  }

  .brand-text h1 {
    font-size:22px;
  }

  .brand-text p {
    font-size:12px;
  }

  .top-actions {
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    width:100%;
    flex-basis:100%;
    gap:8px;
  }

  .top-actions > * {
    width:100%;
    justify-content:center;
  }

  .top-actions button,
  .top-actions .zoom-display,
  .top-actions .pill,
  .top-actions .language-picker {
    min-height:36px;
    height:auto;
    padding:7px 8px;
    font-size:12px;
    line-height:1.2;
    white-space:normal;
  }

  .language-picker {
    grid-template-columns:auto minmax(0, 1fr);
    max-width:none;
  }

  #activeUserPill {
    grid-column:1 / -1;
  }

  .layout {
    padding:10px;
    gap:10px;
  }

  .panel,
  .ai-sidebar,
  .ai-chat-panel,
  .login-card {
    border-radius:18px;
  }

  .panel-header,
  .panel-body {
    padding:12px;
  }

  .panel-header h2 {
    font-size:20px;
  }

  .component-grid {
    gap:8px;
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:first-child {
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:first-child button,
  body.upgrade-ready .canvas-toolbar #runLogicBtn.primary-action {
    min-width:0;
    white-space:normal;
  }

  body.upgrade-ready .canvas-toolbar .toolbar-group:last-child .pill {
    white-space:normal;
  }

  .canvas-panel {
    height:580px;
    min-height:520px;
  }

  .workspace-area {
    min-height:0;
  }

  .layout > .panel:nth-child(1) {
    height:520px;
  }

  #workspaceEmptyState {
    inset:78px 12px 210px;
  }

  .workspace-empty-copy b {
    font-size:20px;
  }

  .workspace-quick-starts {
    gap:8px;
  }

  .workspace-quick-starts button {
    flex:1 1 130px;
    min-width:0;
  }

  .logic-dock {
    left:10px;
    right:10px;
    bottom:10px;
    min-height:0;
    max-height:42%;
    overflow:auto;
    border-radius:18px;
    padding:12px;
  }

  .logic-dock h3 {
    font-size:16px;
  }

  .logic-list {
    min-height:48px;
  }

  #deleteBin {
    width:54px;
    height:54px;
    right:14px;
    bottom:168px;
    font-size:24px;
    border-radius:12px;
  }

  .ai-topbar {
    padding:12px;
  }

  .ai-shell {
    padding:10px;
    gap:10px;
  }

  .ai-message {
    max-width:100%;
  }

  .ai-inputbar {
    flex-direction:column;
    align-items:stretch;
  }

  .ai-inputbar textarea {
    min-height:92px;
  }

  .login-screen {
    align-items:flex-start;
    padding:14px;
    overflow:auto;
  }

  .login-card {
    width:100%;
    max-height:none;
    padding:18px;
  }

  .login-top {
    align-items:flex-start;
  }

  .login-top h2 {
    font-size:24px;
  }

  .guide-page {
    align-items:stretch;
    padding:10px;
  }

  .guide-shell {
    width:100%;
    max-height:none;
    border-radius:18px;
    padding:18px;
  }

  .guide-header,
  .project-page-header {
    align-items:stretch;
    flex-direction:column;
  }
}

.assignment-list,
.guided-lab-steps,
.replay-build-timeline {
  display:grid;
  gap:10px;
}

.assignment-item,
.guided-lab-step,
.replay-build-entry,
.multimeter-grid > div,
.viva-feedback-card,
.viva-summary {
  border:1px solid rgba(148,163,184,.22);
  border-radius:8px;
  background:rgba(255,255,255,.88);
  box-shadow:0 10px 24px rgba(15,23,42,.05);
}

.assignment-item {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:12px;
}

.assignment-item.active {
  border-color:rgba(16,185,129,.36);
  box-shadow:0 0 0 1px rgba(16,185,129,.2);
}

.assignment-item.teacher {
  align-items:center;
}

.assignment-item b,
.assignment-item span,
.assignment-item p,
.replay-build-entry b,
.replay-build-entry span {
  display:block;
}

.assignment-item span,
.assignment-item small,
.guided-lab-meta span,
.replay-build-entry span,
.voice-conversation-status {
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

.assignment-item p,
.guided-lab-step b,
.viva-feedback-card p,
.viva-summary p,
.multimeter-grid p {
  margin:6px 0 0;
  line-height:1.5;
}

.assignment-form-grid,
.multimeter-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
}

.assignment-form-actions,
.replay-build-actions,
.viva-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.assignment-form-actions,
.replay-build-actions {
  margin-top:12px;
}

.guided-lab-meta,
.multimeter-header,
.viva-score-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.guided-lab-meta {
  align-items:flex-start;
  flex-direction:column;
  margin-bottom:12px;
}

.guided-lab-step {
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px 12px;
}

.guided-lab-step.passed {
  border-color:rgba(16,185,129,.28);
  background:rgba(16,185,129,.08);
}

.guided-lab-step.pending {
  border-color:rgba(59,130,246,.16);
}

.multimeter-readings {
  margin-top:12px;
}

.multimeter-header {
  margin-bottom:10px;
}

.multimeter-grid > div {
  padding:12px;
}

.multimeter-grid span {
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}

.multimeter-grid .wide {
  grid-column:1 / -1;
}

.replay-build-timeline {
  max-height:240px;
  overflow:auto;
  padding-right:4px;
}

.replay-build-entry {
  padding:10px 12px;
}

.replay-build-entry b {
  margin-bottom:4px;
}

.viva-question {
  margin:12px 0 10px;
  font-weight:800;
  line-height:1.55;
}

#aiVivaAnswerInput {
  min-height:92px;
  resize:vertical;
}

.viva-feedback-card,
.viva-summary {
  margin-top:12px;
  padding:12px;
}

.viva-feedback-card small,
.viva-summary small {
  display:block;
  margin-top:8px;
  color:var(--muted);
  line-height:1.5;
}

.voice-conversation-btn {
  min-width:88px;
}

.voice-conversation-status {
  margin-top:10px;
}

.dark-mode .assignment-item,
.dark-mode .guided-lab-step,
.dark-mode .replay-build-entry,
.dark-mode .multimeter-grid > div,
.dark-mode .viva-feedback-card,
.dark-mode .viva-summary {
  background:rgba(15,23,42,.82);
  border-color:rgba(148,163,184,.18);
}

@media (max-width: 860px) {
  .assignment-form-grid,
  .multimeter-grid {
    grid-template-columns:1fr;
  }

  .assignment-item,
  .multimeter-header,
  .viva-score-row {
    flex-direction:column;
    align-items:flex-start;
  }

  .assignment-item button,
  .assignment-form-actions button,
  .replay-build-actions button,
  .viva-actions button,
  .voice-conversation-btn {
    width:100%;
  }
}

@media (max-width: 420px) {
  .landing-copy h1 {
    font-size:34px;
  }

  .component-grid {
    grid-template-columns:1fr;
  }

  .workspace-area {
    min-height:0;
  }

  #workspaceEmptyState {
    inset:70px 10px 230px;
  }

  .mini-actions {
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .mini-actions button {
    width:100%;
    padding-inline:8px;
    white-space:normal;
  }

  .stat {
    flex-direction:column;
    gap:4px;
  }
}
