:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --soft: #f4f7fb;
  --paper: #ffffff;
  --blue: #5b5ce2;
  --blue-dark: #4742b8;
  --teal: #17b8b3;
  --teal-dark: #0f8f91;
  --green: #138a63;
  --red: #c2412f;
  --amber: #b7791f;
  --violet: #6f4cc3;
  --violet-soft: #f1efff;
  --teal-soft: #e7fbfa;
  --shadow: 0 16px 40px rgba(44, 35, 91, 0.11);
  --math-font: "Latin Modern Math", "STIX Two Math", "Cambria Math", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #eef4f7;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.classroom-active {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(23, 184, 179, 0.12), transparent 34%),
    #15142a;
  color: #f8fafc;
}

.brand {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  isolation: isolate;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: white;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
  overflow: hidden;
}

.brand-mark::before {
  content: attr(data-kaizen);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -49%) rotate(-10deg);
  z-index: -1;
  color: rgba(255, 255, 255, 0.24);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.16em;
  white-space: nowrap;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

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

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-list a {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #dedcf0;
  text-decoration: none;
  font-weight: 650;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-list a.nav-primary {
  color: #ffffff;
  font-weight: 780;
}

.nav-list a.nav-child {
  margin-left: 18px;
  min-height: 34px;
  color: #cbc8e5;
  font-size: 0.94rem;
  position: relative;
}

.nav-list a.nav-child::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.25);
}

.nav-list a.nav-child .nav-icon {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
  font-size: 0.76rem;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #9ff4eb;
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.nav-list a:hover,
.nav-list a.active {
  background: linear-gradient(90deg, rgba(23,184,179,0.18), rgba(111,76,195,0.18));
  color: white;
  transform: translateX(3px);
}

.nav-list a:hover .nav-icon,
.nav-list a.active .nav-icon {
  background: linear-gradient(135deg, rgba(23,184,179,0.95), rgba(111,76,195,0.92));
  color: white;
  box-shadow: 0 8px 18px rgba(23,184,179,0.18);
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.075);
  color: #dedcf0;
  border: 1px solid rgba(255,255,255,0.08);
}

.sidebar-panel p {
  margin: 8px 0 0;
  line-height: 1.45;
  font-size: 0.9rem;
}

.eyebrow {
  color: #2dd4bf;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.main-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.site-trust-note {
  margin: 0 24px 24px;
  padding: 12px 16px;
  border: 1px solid rgba(23, 184, 179, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 184, 179, 0.08), rgba(111, 76, 195, 0.06)),
    #fff;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.site-trust-note strong {
  color: var(--ink);
  margin-right: 4px;
}

.topbar {
  min-height: 72px;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-search {
  max-width: 620px;
  display: grid;
  gap: 5px;
}

.topbar-search label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.topbar-search input,
.filter-row input,
.filter-row select,
.tool-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.topbar-search input:focus,
.filter-row input:focus,
.filter-row select:focus,
.tool-control select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(23, 184, 179, 0.13);
}

.account-pill {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-width: 250px;
}

.account-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  grid-column: 1;
}

.account-pill strong {
  display: block;
  font-size: 0.88rem;
  grid-column: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-action {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 32px;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(44, 35, 91, 0.13);
}

.account-action:disabled {
  cursor: wait;
  opacity: 0.7;
}

.account-pill[data-auth-state="not-configured"] .account-action {
  background: #f1efff;
  color: var(--violet);
  box-shadow: none;
}

.account-pill[data-auth-state="signed-in"] {
  border-color: rgba(23, 184, 179, 0.3);
  background: linear-gradient(135deg, rgba(23, 184, 179, 0.08), rgba(111, 76, 195, 0.06)), #fff;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.menu-button {
  display: none;
  place-items: center;
  gap: 4px;
}

.menu-button span {
  width: 18px;
  height: 2px;
  background: var(--ink);
}

#app {
  min-width: 0;
  padding: 28px;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 2rem;
}

.page-header p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--teal-dark));
  color: white;
}

.button.primary:hover {
  background: linear-gradient(135deg, #5e41ad, #0d7f82);
}

.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin-bottom: 22px;
  padding: 26px;
  min-height: 260px;
  border: 1px solid rgba(111, 76, 195, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 18%, rgba(23, 184, 179, 0.18), transparent 24%),
    radial-gradient(circle at 78% 78%, rgba(111, 76, 195, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(111, 76, 195, 0.09), rgba(23, 184, 179, 0.08)),
    linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--violet), var(--teal));
  z-index: 2;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 18px 22px 18px auto;
  width: min(430px, 45%);
  background-image:
    linear-gradient(rgba(111, 76, 195, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 184, 179, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  opacity: 0.72;
  z-index: 0;
}

.hero-copy,
.home-hero-actions {
  position: relative;
  z-index: 1;
}

.home-hero h1 {
  max-width: 840px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.home-hero p {
  max-width: 820px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.58;
}

.hero-diagram {
  position: absolute;
  top: 34px;
  right: 34px;
  width: min(410px, 44%);
  height: calc(100% - 64px);
  pointer-events: none;
  z-index: 0;
}

.diagram-card,
.diagram-node,
.diagram-line {
  position: absolute;
  display: block;
}

.diagram-card {
  min-width: 82px;
  padding: 10px 12px;
  border: 1px solid rgba(111, 76, 195, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(44, 35, 91, 0.08);
  color: rgba(44, 35, 91, 0.62);
  font-weight: 850;
  text-align: center;
  backdrop-filter: blur(8px);
}

.diagram-card-a {
  top: 14px;
  right: 56px;
}

.diagram-card-b {
  top: 92px;
  right: 204px;
  min-width: 58px;
  color: rgba(13, 127, 130, 0.66);
  font-size: 1.5rem;
}

.diagram-card-c {
  right: 28px;
  bottom: 22px;
  min-width: 64px;
  color: rgba(111, 76, 195, 0.68);
  font-size: 1.35rem;
}

.diagram-node {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(111, 76, 195, 0.74), rgba(23, 184, 179, 0.74));
  box-shadow: 0 0 0 8px rgba(23, 184, 179, 0.09);
}

.node-a {
  top: 58px;
  right: 194px;
}

.node-b {
  top: 152px;
  right: 112px;
}

.node-c {
  right: 254px;
  bottom: 38px;
}

.diagram-line {
  height: 2px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(111, 76, 195, 0.36), rgba(23, 184, 179, 0.36));
}

.line-a {
  top: 65px;
  right: 126px;
  width: 138px;
  transform: rotate(32deg);
}

.line-b {
  right: 94px;
  bottom: 76px;
  width: 184px;
  transform: rotate(-19deg);
}

.home-hero-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 360px;
}

.guide-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 390px);
  gap: 18px;
  align-items: center;
  margin: -6px 0 22px;
  padding: 18px;
  border: 1px solid rgba(111, 76, 195, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(111, 76, 195, 0.1), rgba(23, 184, 179, 0.08)),
    #ffffff;
  box-shadow: 0 10px 28px rgba(44, 35, 91, 0.08);
}

.guide-callout h2 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 1.18rem;
}

.guide-callout p {
  max-width: 760px;
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.guide-callout img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.1);
}

.worksheet-callout {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: -6px 0 22px;
  padding: 18px;
  border: 1px solid rgba(23, 184, 179, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 184, 179, 0.11), rgba(111, 76, 195, 0.08)),
    #ffffff;
  box-shadow: 0 10px 28px rgba(44, 35, 91, 0.08);
}

.worksheet-callout-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
}

.worksheet-callout h2 {
  margin: 0;
  font-size: 1.12rem;
}

.worksheet-callout p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.beta-callout {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: -6px 0 22px;
  padding: 18px;
  border: 1px solid rgba(111, 76, 195, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(111, 76, 195, 0.12), rgba(23, 184, 179, 0.1)),
    #ffffff;
  box-shadow: 0 10px 28px rgba(44, 35, 91, 0.08);
}

.beta-callout-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  color: #fff;
  font-size: 1.15rem;
  font-weight: 950;
}

.beta-callout h2 {
  margin: 4px 0 5px;
  font-size: 1.12rem;
}

.beta-callout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.university-callout {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: -6px 0 22px;
  padding: 18px;
  border: 1px solid rgba(23, 184, 179, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 184, 179, 0.12), rgba(111, 76, 195, 0.1)),
    #ffffff;
  box-shadow: 0 10px 28px rgba(44, 35, 91, 0.08);
}

.university-callout h2 {
  margin: 4px 0 5px;
  font-size: 1.12rem;
}

.university-callout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.beta-page {
  display: grid;
  gap: 16px;
}

.university-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  border-color: rgba(23, 184, 179, 0.3);
  background:
    linear-gradient(135deg, rgba(111, 76, 195, 0.12), rgba(23, 184, 179, 0.12)),
    #ffffff;
}

.university-hero h2 {
  margin: 4px 0 8px;
}

.university-steps {
  display: grid;
  gap: 8px;
}

.university-steps span {
  display: block;
  border: 1px solid rgba(111, 76, 195, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #282450;
  font-weight: 850;
  text-align: center;
}

.university-section {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.university-section-head h2 {
  margin: 0 0 5px;
  color: var(--ink);
}

.university-section-head p {
  margin: 0;
  color: var(--muted);
}

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

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.video-placeholder {
  min-height: 156px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 24% 24%, rgba(23, 184, 179, 0.18), transparent 42%),
    radial-gradient(circle at 78% 74%, rgba(111, 76, 195, 0.18), transparent 42%),
    #172f4a;
  color: white;
}

.video-placeholder span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.45rem;
  font-weight: 900;
}

.video-placeholder small {
  align-self: start;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 750;
}

.video-embed {
  aspect-ratio: 16 / 9;
  background: #172f4a;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.video-card-copy {
  padding: 14px;
}

.video-card-copy h3 {
  margin: 4px 0 6px;
  color: #282450;
}

.video-card-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.beta-intro p,
.beta-thanks p {
  color: var(--muted);
  line-height: 1.6;
}

.beta-how-it-works {
  display: grid;
  gap: 14px;
}

.beta-how-it-works p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.beta-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.beta-steps div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(111, 76, 195, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(111, 76, 195, 0.08), rgba(23, 184, 179, 0.06));
}

.beta-steps span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  color: #fff;
  font-weight: 900;
}

.beta-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.beta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.beta-checklist,
.beta-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.beta-checklist a {
  color: var(--violet);
  font-weight: 800;
}

.beta-survey {
  display: grid;
  gap: 16px;
}

.beta-survey p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.beta-feedback-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.beta-feedback-form label,
.beta-output label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.beta-feedback-form label:nth-child(n + 3) {
  grid-column: 1 / -1;
}

.beta-feedback-form input,
.beta-feedback-form select,
.beta-feedback-form textarea,
.beta-output textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.beta-feedback-form button {
  justify-self: start;
}

.beta-output {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.metric,
.panel,
.tool-card,
.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.metric {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(111, 76, 195, 0.75), rgba(23, 184, 179, 0.75));
}

.metric span {
  color: var(--muted);
  font-weight: 750;
  font-size: 0.8rem;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
  color: #282450;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.split-grid > .panel:first-child {
  border-color: rgba(23, 184, 179, 0.45);
  background:
    linear-gradient(135deg, rgba(23, 184, 179, 0.18), rgba(111, 76, 195, 0.13)),
    #ffffff;
  box-shadow: 0 12px 32px rgba(23, 184, 179, 0.12);
}

.split-grid > .panel:first-child h2 {
  color: #19346b;
}

.panel {
  padding: 18px;
}

.panel h2 {
  color: #282450;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
}

.migration-list {
  display: grid;
  gap: 10px;
}

.migration-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #dde3ee;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(241,239,255,0.75), rgba(231,251,250,0.55));
}

.migration-item span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--teal-dark));
  color: white;
  font-weight: 800;
}

.migration-item h3 {
  margin: 0 0 3px;
  font-size: 0.95rem;
}

.migration-item p {
  margin: 0;
  font-size: 0.88rem;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px 170px 150px auto;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-reset {
  min-width: 86px;
  height: 100%;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tool-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(111, 76, 195, 0.78), rgba(23, 184, 179, 0.78));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tool-card:hover {
  border-color: rgba(23, 184, 179, 0.55);
  box-shadow: var(--shadow);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card.locked {
  border-style: dashed;
  background:
    linear-gradient(135deg, rgba(111, 76, 195, 0.05), rgba(23, 184, 179, 0.04)),
    var(--paper);
}

.tool-card.locked h2,
.tool-card.locked p {
  color: #535b70;
}

.tool-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.tool-card h2 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.18;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.locked-badge {
  background: #fff7ed;
  color: #9a3412;
}

.access-callout {
  max-width: 720px;
  display: grid;
  gap: 12px;
}

.access-callout .button {
  justify-self: start;
}

.admin-panel {
  display: grid;
  gap: 14px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.admin-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #2f3654;
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
}

.admin-tab.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(20, 184, 166, 0.14));
  border-color: rgba(124, 58, 237, 0.38);
  color: #282450;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: grid;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.admin-status {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f8fafc;
  color: #282450;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.admin-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.admin-access-select {
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
}

.admin-user-role,
.admin-user-trial-date {
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
  font: inherit;
}

.admin-metadata-list {
  display: grid;
  gap: 12px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.admin-metadata-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-metadata-card-head {
  display: grid;
  gap: 3px;
}

.admin-metadata-card-head small {
  color: var(--muted);
}

.admin-metadata-field {
  display: grid;
  gap: 5px;
  color: #4a5570;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-metadata-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
  background: white;
  color: var(--ink);
  pointer-events: auto;
  user-select: text;
}

.admin-metadata-input:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
  outline: none;
}

.admin-video-list {
  display: grid;
  gap: 14px;
}

.admin-video-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.admin-video-section h3 {
  margin: 0;
  color: #282450;
}

.admin-video-row {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(300px, 1.35fr);
  gap: 14px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e6edf5;
  border-radius: 7px;
  background: white;
}

.admin-video-default {
  position: sticky;
  top: 12px;
}

.admin-video-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.admin-video-fields {
  display: grid;
  gap: 9px;
}

.admin-video-fields label {
  display: grid;
  gap: 5px;
  color: #4a5570;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-video-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  font-size: 0.95rem;
}

.admin-video-textarea {
  min-height: 82px;
  resize: vertical;
}

.upgrade-page {
  display: grid;
  gap: 18px;
}

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

.trial-notice {
  display: grid;
  gap: 12px;
  border-color: rgba(23, 179, 176, 0.35);
  background:
    linear-gradient(135deg, rgba(23, 179, 176, 0.12), rgba(115, 88, 242, 0.10)),
    var(--panel);
}

.trial-notice h2 {
  margin: 0;
  color: var(--ink);
}

.trial-notice p {
  max-width: 860px;
}

.upgrade-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.upgrade-status[data-tone="success"] {
  color: var(--green);
}

.upgrade-status[data-tone="cancelled"],
.upgrade-status[data-tone="error"] {
  color: var(--red);
}

.upgrade-status[data-tone="loading"] {
  color: var(--blue-dark);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pricing-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.pricing-card.featured {
  border-color: rgba(91, 92, 226, 0.35);
  box-shadow: 0 18px 44px rgba(91, 92, 226, 0.14);
}

.pricing-card h2,
.upgrade-details h2 {
  margin: 0;
}

.pricing-price {
  margin: 0;
  color: var(--blue-dark);
  font-size: 1.3rem;
  font-weight: 800;
}

.pricing-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.upgrade-details {
  display: grid;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--violet-soft);
  color: #4c3a8a;
  font-size: 0.7rem;
  font-weight: 800;
}

.badge.free {
  background: #dcfce7;
  color: #166534;
}

.badge.pro {
  background: #fff7ed;
  color: #9a3412;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.legacy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.legacy-stage {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.legacy-stage.classroom {
  --classroom-frame-scale: 1;
  position: fixed;
  inset: 0;
  z-index: 1000;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  box-shadow: none;
}

.legacy-toolbar {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(241, 239, 255, 0.75), rgba(231, 251, 250, 0.75)),
    #f8fbff;
}

.legacy-stage.classroom .legacy-toolbar {
  min-height: 42px;
  padding: 7px 10px;
  align-items: center;
  flex-direction: row;
  background: #111827;
  color: white;
}

.legacy-stage.classroom .badge-row {
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.legacy-toolbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-path {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.legacy-stage.classroom .tool-path {
  color: #cbd5e1;
}

.classroom-exit {
  display: none;
  min-height: 30px;
  padding: 5px 10px;
}

.legacy-stage.classroom .classroom-exit {
  display: inline-flex;
}

@media (max-width: 820px) {
  .legacy-stage.classroom .tool-path {
    display: none;
  }
}

.legacy-frame {
  display: block;
  width: 100%;
  height: min(74vh, 820px);
  border: 0;
  background: white;
}

.site-guide-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: calc(100vh - 128px);
}

.site-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.site-guide-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 182px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.worksheet-builder {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.worksheet-controls {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.worksheet-control {
  display: grid;
  gap: 6px;
}

.worksheet-control label,
.worksheet-options label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.worksheet-control select,
.worksheet-control input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

.worksheet-control select:focus,
.worksheet-control input:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(23, 184, 179, 0.13);
}

.worksheet-count-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.worksheet-count-preset {
  min-height: 30px;
  border: 1px solid rgba(23, 184, 179, 0.32);
  border-radius: 6px;
  background: #eefbfb;
  color: #106a6e;
  cursor: pointer;
  font-weight: 850;
}

.worksheet-count-preset:hover {
  border-color: var(--teal);
  background: #dff7f6;
}

.worksheet-mark-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.worksheet-mark-preset {
  min-height: 30px;
  border: 1px solid rgba(111, 76, 195, 0.28);
  border-radius: 6px;
  background: #f5f3ff;
  color: #4c2d88;
  cursor: pointer;
  font-weight: 850;
}

.worksheet-mark-preset:hover {
  border-color: var(--violet);
  background: #ede9fe;
}

.worksheet-options {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(111, 76, 195, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(241,239,255,0.8), rgba(231,251,250,0.7));
}

.worksheet-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #282450;
}

.worksheet-assessment-panel {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 11px;
  border: 1px solid rgba(23, 184, 179, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.worksheet-assessment-panel[hidden] {
  display: none;
}

.worksheet-assessment-heading {
  display: grid;
  gap: 3px;
}

.worksheet-assessment-heading strong {
  color: #282450;
}

.worksheet-assessment-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.worksheet-mark-control {
  display: grid;
  gap: 7px;
}

.worksheet-mark-control label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.worksheet-mark-control input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.worksheet-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.worksheet-status[data-tone="success"] {
  color: var(--green);
  font-weight: 750;
}

.worksheet-status[data-tone="error"] {
  color: var(--red);
  font-weight: 750;
}

.worksheet-section-list {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.worksheet-section-list h3 {
  margin: 0;
  color: #282450;
  font-size: 0.95rem;
}

.worksheet-section-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.worksheet-section-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(23, 184, 179, 0.22);
  border-radius: 8px;
  background: #ffffff;
}

.worksheet-section-summary {
  min-width: 0;
}

.worksheet-section-item strong,
.worksheet-section-item span {
  display: block;
}

.worksheet-section-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.worksheet-section-editors {
  display: flex;
  align-items: end;
  gap: 8px;
}

.worksheet-section-editors label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.worksheet-section-editors input {
  width: 70px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--ink);
}

.worksheet-section-remove {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.78rem;
}

.worksheet-preview {
  min-height: 640px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(135deg, rgba(111,76,195,0.05), rgba(23,184,179,0.05)),
    #f8fbff;
}

.worksheet-loader {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

.worksheet-sheet {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: white;
  color: #111827;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.08);
}

.worksheet-sheet-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 2px solid #111827;
}

.worksheet-sheet-header h2 {
  margin: 6px 0;
  font-size: 1.65rem;
}

.worksheet-sheet-header p {
  margin: 0;
  color: #4b5563;
}

.worksheet-student-fields {
  display: grid;
  gap: 12px;
  font-weight: 750;
}

.worksheet-student-fields span {
  min-height: 28px;
  border-bottom: 1px solid #9ca3af;
}

.worksheet-assessment-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #111827;
  border-radius: 6px;
  color: #111827;
  font-weight: 750;
}

.worksheet-assessment-summary span {
  color: #4b5563;
  font-weight: 650;
}

.worksheet-question-list {
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 18px;
  list-style: none;
}

.worksheet-section {
  margin-top: 24px;
}

.worksheet-section h3 {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #d1d5db;
  font-size: 1.2rem;
}

.worksheet-section > p {
  margin: 4px 0 0;
  color: #4b5563;
}

.worksheet-section > .worksheet-section-instruction {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 3px solid #17b8b3;
  border-radius: 5px;
  background: #eefbfb;
  color: #12314b;
  font-weight: 750;
}

.worksheet-question {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  break-inside: avoid;
}

.worksheet-question-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #111827;
  color: white;
  font-weight: 850;
}

.worksheet-question-text {
  font-family:var(--math-font);
  font-size: 1.08rem;
  line-height: 1.5;
}

.worksheet-question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.worksheet-question-marks,
.worksheet-total-marks {
  white-space: nowrap;
  color: #111827;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 850;
}

.worksheet-question-marks {
  padding-top: 0.12rem;
  font-size: 0.92rem;
}

.worksheet-question-text sup,
.worksheet-answer sup,
.worksheet-steps sup,
.worksheet-key-item sup {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
}

.worksheet-question-text .superscript,
.worksheet-answer .superscript,
.worksheet-steps .superscript,
.worksheet-key-item .superscript {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
}

.worksheet-steps .step-indicator,
.worksheet-steps .step-arrow {
  display: inline-block;
  margin-right: 0.35em;
}

.worksheet-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  margin: 0 0.18em;
  vertical-align: middle;
  text-align: center;
  font-family:var(--math-font);
  line-height: 1.05;
}

.worksheet-fraction span:first-child {
  border-bottom: 1px solid currentColor;
  padding: 0 0.18em 0.08em;
}

.worksheet-fraction span:last-child {
  padding: 0.08em 0.18em 0;
}

sup .worksheet-fraction {
  margin: 0 0.03em;
  font-size: 0.72em;
  line-height: 0.88;
  transform: translateY(-0.18em);
}

sup .worksheet-fraction span:first-child {
  padding: 0 0.12em 0.03em;
}

sup .worksheet-fraction span:last-child {
  padding: 0.03em 0.12em 0;
}

.worksheet-integral {
  display: inline-flex;
  align-items: center;
  gap: 0.03em;
  margin-right: 0.1em;
  vertical-align: middle;
}

.worksheet-integral-limits {
  display: inline-grid;
  grid-template-rows: auto auto;
  line-height: 0.92;
  font-size: 0.64em;
  transform: translateY(-0.03em);
}

.worksheet-limited-operator {
  display: inline-grid;
  grid-template-rows: auto auto auto;
  align-items: center;
  justify-items: center;
  margin: 0 0.18em;
  vertical-align: middle;
  font-family:var(--math-font);
  line-height: 0.9;
}

.worksheet-limited-symbol {
  font-size: 1.35em;
  line-height: 0.78;
}

.worksheet-limited-upper,
.worksheet-limited-lower {
  font-size: 0.58em;
  line-height: 0.95;
  white-space: nowrap;
}

.worksheet-question-text .system-equations,
.worksheet-question-text .prob-table {
  margin-top: 8px;
}

.worksheet-math-table {
  border-collapse: collapse;
  margin: 8px 0;
  font-family:var(--math-font);
}

.worksheet-math-table td {
  min-width: 34px;
  padding: 4px 8px;
  border-bottom: 1px solid #d1d5db;
  text-align: center;
}

.worksheet-math-table td:first-child {
  border-right: 2px solid #6b7280;
  color: #4c1d95;
  font-weight: 700;
}

.worksheet-question-text .system-line {
  margin: 4px 0;
}

.worksheet-question-text table {
  max-width: 100%;
  border-collapse: collapse;
}

.worksheet-question-text td,
.worksheet-question-text th {
  border: 1px solid #9ca3af;
  padding: 4px 7px;
}

.worksheet-working-lines {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.worksheet-working-lines span {
  height: 1px;
  background: #d1d5db;
}

.worksheet-answer,
.worksheet-steps {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: #f0fdfa;
  color: #134e4a;
  line-height: 1.45;
}

.worksheet-steps {
  background: #f5f3ff;
  color: #3b236d;
}

.worksheet-step-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
  margin: 0.42rem 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(111, 76, 195, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.66);
}

.worksheet-step-line.math {
  background: rgba(255, 255, 255, 0.86);
}

.worksheet-step-line.explicit {
  display: block;
}

.worksheet-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.1rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #6f4cc3;
  color: #fff;
  font-size: 0.78em;
  font-weight: 850;
  white-space: nowrap;
}

.worksheet-step-body {
  min-width: 0;
  overflow-x: auto;
}

.worksheet-answer-key {
  break-before: page;
  page-break-before: always;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 2px solid #111827;
}

.worksheet-answer-key-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.worksheet-answer-key-header h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
}

.worksheet-key-section {
  margin-top: 18px;
  break-inside: avoid;
}

.worksheet-key-section h3 {
  margin: 0;
  font-size: 1.05rem;
}

.worksheet-key-section p {
  margin: 4px 0 10px;
  color: #4b5563;
}

.worksheet-key-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.worksheet-key-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-family:var(--math-font);
  line-height: 1.45;
}

.worksheet-key-item > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
}

.worksheet-key-marks {
  margin-bottom: 2px;
  color: #4b5563;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.legacy-stage.classroom .legacy-frame {
  width: calc(100% / var(--classroom-frame-scale));
  height: calc(100% / var(--classroom-frame-scale));
  min-height: 0;
  transform: scale(var(--classroom-frame-scale));
  transform-origin: top left;
}

@media (min-width: 1400px) {
  .legacy-stage.classroom {
    --classroom-frame-scale: 1;
  }
}

@media (max-width: 820px) {
  .legacy-stage.classroom {
    --classroom-frame-scale: 1;
  }
}

.missing-tool {
  min-height: 520px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(19, 138, 99, 0.06)),
    white;
}

.missing-tool h2 {
  margin: 0;
}

.missing-tool p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.missing-tool code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #e9eef6;
  color: var(--ink);
}

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

.related-list a {
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 750;
}

.related-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.topic-map-card {
  padding: 10px;
  border: 1px solid rgba(111, 76, 195, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(241, 239, 255, 0.65), rgba(231, 251, 250, 0.32));
}

.topic-map-card h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.86rem;
}

.topic-map-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.standards-list {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.standards-list {
  display: grid;
  gap: 7px;
  margin: 10px 0 16px;
}

.tool-stage {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.tool-stage-head {
  padding: 18px;
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.level-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.level-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-weight: 750;
}

.level-tabs button.active {
  border-color: var(--blue);
  background: #dbeafe;
  color: #1e40af;
}

.tool-controls {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.tool-control {
  display: grid;
  gap: 5px;
}

.tool-control label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.question-card {
  padding: 14px;
}

.question-card header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.question-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fee2e2;
  color: var(--red);
  font-weight: 850;
  flex: 0 0 auto;
}

.question-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.question-card p {
  margin: 0;
  color: var(--muted);
}

.answer-line,
.steps-box {
  display: none;
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
}

.answer-line.visible {
  display: block;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 800;
}

.steps-box.visible {
  display: block;
  background: #fff7ed;
  color: #7c2d12;
}

.teacher-panel {
  position: sticky;
  top: 92px;
  align-self: start;
}

.teacher-panel ul {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.teacher-panel h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.mobile-nav {
  display: none;
}

@media (max-width: 1120px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filter-row {
    grid-template-columns: minmax(200px, 1fr) 1fr;
  }

  .tool-layout,
  .legacy-layout,
  .split-grid,
  .worksheet-builder {
    grid-template-columns: 1fr;
  }

  .teacher-panel,
  .worksheet-controls {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .worksheet-preview {
    max-height: none;
  }

  .legacy-frame {
    height: 70vh;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 12px;
  }

  .menu-button {
    display: grid;
  }

  .account-pill {
    display: grid;
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  #app {
    padding: 18px 12px;
  }

  .page-header {
    grid-template-columns: 1fr;
  }

  .home-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .home-hero::after,
  .hero-diagram {
    opacity: 0.22;
    width: 58%;
    right: 4%;
  }

  .home-hero-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .guide-callout,
  .worksheet-callout,
  .beta-callout,
  .university-callout,
  .university-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topic-map-grid {
    grid-template-columns: 1fr;
  }

  .guide-callout .button,
  .worksheet-callout .button,
  .beta-callout .button,
  .university-callout .button {
    justify-self: start;
  }

  .beta-grid,
  .beta-feedback-form,
  .beta-steps,
  .pricing-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .filter-row,
  .tool-controls,
  .level-tabs,
  .metric-grid,
  .tool-grid,
  .legacy-layout,
  .worksheet-sheet-header {
    grid-template-columns: 1fr;
  }

  .worksheet-question-row,
  .worksheet-assessment-summary {
    display: grid;
    grid-template-columns: 1fr;
  }

  .worksheet-section-item {
    grid-template-columns: 1fr;
  }

  .worksheet-section-editors {
    align-items: stretch;
  }

  .worksheet-section-editors input {
    width: 100%;
  }

  .admin-metadata-card {
    grid-template-columns: 1fr;
  }

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

  .worksheet-question-marks {
    justify-self: end;
  }

  .legacy-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-path {
    white-space: normal;
  }

  .mobile-nav {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .mobile-nav.open {
    pointer-events: auto;
    opacity: 1;
  }

  .mobile-nav-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
  }

  .mobile-nav-panel {
    position: relative;
    width: min(320px, 86vw);
    min-height: 100vh;
    padding: 18px;
    background: #111827;
    color: white;
    box-shadow: var(--shadow);
  }
}

@media (min-width: 620px) and (max-width: 820px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .page-header,
  .worksheet-controls,
  .mobile-nav {
    display: none !important;
  }

  .app-shell,
  .main-wrap,
  #app,
  .worksheet-builder,
  .worksheet-preview {
    display: block;
    padding: 0;
    margin: 0;
    min-height: auto;
    border: 0;
    box-shadow: none;
    background: white;
  }

  .worksheet-sheet {
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .worksheet-question-marks,
  .worksheet-total-marks,
  .worksheet-key-marks {
    color: #111827;
  }
}
