/* ==========================================================================
   Laboratório Virtual — Peso e Massa
   Folha de estilos comum ao aluno, professor e guia teórico
   ========================================================================== */

:root {
  --ink: #102a3a;
  --ink-2: #23475c;
  --muted: #60798a;
  --muted-2: #8298a6;
  --bg: #eef4f6;
  --bg-2: #f7fafb;
  --paper: #ffffff;
  --line: #d9e4e9;
  --line-2: #e8eff2;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --brand-3: #14b8a6;
  --brand-soft: #e6f7f4;
  --navy: #0b2533;
  --navy-2: #123447;
  --amber: #f59e0b;
  --amber-soft: #fff7e6;
  --coral: #e4572e;
  --coral-soft: #fdeee9;
  --blue: #20639b;
  --blue-soft: #eaf3fb;
  --purple: #7b4b94;
  --green: #15803d;
  --green-soft: #e9f9ef;
  --red: #b42318;
  --red-soft: #fdecea;
  --shadow-sm: 0 2px 6px rgba(11, 37, 51, .05);
  --shadow: 0 14px 34px rgba(11, 37, 51, .08);
  --shadow-lg: 0 28px 70px rgba(11, 37, 51, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --font: "Aptos", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .85rem; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding-left: 1.25rem; }
li + li { margin-top: .3rem; }
:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .76rem; color: var(--muted-2); line-height: 1.5; }
.eyebrow {
  margin: 0 0 .45rem;
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand);
}
.eyebrow.light { color: #7dd3c7; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-border: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 42px;
  padding: .62rem 1rem;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.1;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--brand-2), var(--brand));
  --btn-fg: #fff;
  --btn-border: transparent;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .22);
}
.btn-primary:hover { box-shadow: 0 12px 24px rgba(15, 118, 110, .28); }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: #0b5f59; --btn-border: #c8ebe6; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-border: var(--line); }
.btn-ghost:hover { background: #f3f8f9; }
.btn-danger { --btn-bg: var(--red-soft); --btn-fg: var(--red); --btn-border: #f3c6c1; }
.btn-sm { min-height: 34px; padding: .4rem .72rem; font-size: .82rem; }
.btn-mini { min-height: 30px; padding: .32rem .6rem; font-size: .76rem; }
.btn-block { width: 100%; }

/* ---------- Boot ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, #17465a, var(--navy) 60%);
  color: #fff;
}
.boot-mark { display: grid; justify-items: center; gap: 1rem; text-align: center; }
.boot-mark img { width: 150px; filter: brightness(0) invert(1); opacity: .92; }
.boot-mark p { color: #b6d4dc; font-size: .9rem; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: #5eead4;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   AUTH
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  background: var(--bg-2);
}
.auth-art {
  position: relative;
  display: flex; align-items: center;
  padding: clamp(2rem, 5vw, 5rem);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(20,184,166,.35), transparent 38%),
    radial-gradient(circle at 10% 80%, rgba(245,158,11,.18), transparent 36%),
    linear-gradient(145deg, #071b26, #0d3444 55%, #0f5d5a);
}
.auth-art::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
  pointer-events: none;
}
.auth-art-inner { position: relative; z-index: 1; width: 100%; max-width: 660px; }
.auth-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: clamp(2.4rem, 5vw, 4.5rem); }
.auth-brand img { width: 190px; background: #fff; border-radius: 8px; padding: .35rem .5rem; }
.auth-brand span { max-width: 140px; font-size: .7rem; line-height: 1.35; color: #a9c8d0; text-transform: uppercase; letter-spacing: .08em; }
.auth-art h1 { font-size: clamp(3rem, 6vw, 5rem); color: #fff; font-weight: 800; letter-spacing: -.045em; margin-bottom: .5rem; }
.auth-lead { max-width: 480px; font-size: 1.08rem; color: #bdd9df; }
.auth-features { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 1.6rem; }
.auth-features > div {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem; border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px; background: rgba(255,255,255,.055); backdrop-filter: blur(4px);
}
.auth-features span { font-size: 1.3rem; }
.auth-features p { margin: 0; display: grid; line-height: 1.2; }
.auth-features strong { font-size: .86rem; }
.auth-features small { font-size: .68rem; color: #9fc2ca; }
.auth-illustration { margin-top: 1rem; opacity: .95; }
.auth-illustration svg { width: 100%; max-width: 560px; }

.auth-panel { display: grid; place-items: center; padding: clamp(1.5rem, 4vw, 4rem); }
.auth-card { width: 100%; max-width: 460px; }
.auth-card h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: .55rem; }
.auth-card > .muted { margin-bottom: 1.6rem; }
.mobile-brand { display: none; }
.auth-card label, .field-label { display: block; margin: 1rem 0 .4rem; font-size: .82rem; font-weight: 800; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: .75rem .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(13,148,136,.11);
}
input:disabled, select:disabled, textarea:disabled {
  background: #f4f7f8; color: #68808e; cursor: not-allowed;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.auth-card .btn-block { margin-top: 1.2rem; }
.form-error { min-height: 1.3rem; margin-top: .7rem; color: var(--red); font-size: .84rem; font-weight: 700; }
.auth-criteria {
  margin-top: 1.1rem;
  padding: .75rem .85rem;
  border: 1px solid #c8ebe6;
  border-radius: 12px;
  background: #f1fbf9;
  font-size: .78rem;
  color: #295b56;
  line-height: 1.45;
}
.auth-criteria strong { display: block; margin-bottom: .15rem; color: #0b5f59; }
.auth-criteria span { color: #3e6d68; }
.auth-criteria a { font-weight: 800; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .45rem 1.1rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .86rem; font-weight: 700; }
.auth-card .tiny { margin-top: 1rem; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { min-height: 100vh; background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 72px; padding: .7rem clamp(1rem, 3vw, 2rem);
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.topbar-brand img { width: 106px; height: 48px; object-fit: contain; }
.topbar-brand div { display: grid; line-height: 1.14; }
.topbar-brand strong { font-size: .98rem; }
.topbar-brand span { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.student-chip { display: flex; align-items: center; gap: .55rem; padding: .28rem .6rem .28rem .3rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.student-chip > span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-3), var(--brand)); color: #fff; font-weight: 800; font-size: .82rem;
}
.student-chip div { display: grid; line-height: 1.1; max-width: 150px; }
.student-chip strong { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-chip small { font-size: .66rem; color: var(--muted); }
.sync-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sync-pill i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.sync-pill[data-state="saving"] i { background: var(--amber); animation: pulse 1s infinite; }
.sync-pill[data-state="error"] i { background: var(--red); }

.app-body { display: grid; grid-template-columns: 272px minmax(0, 1fr); align-items: start; }
.sidebar {
  position: sticky; top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 1.15rem;
  background: #f8fbfc;
  border-right: 1px solid var(--line);
}
.progress-card { display: flex; align-items: center; gap: .9rem; padding: .9rem; margin-bottom: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.progress-card > div:last-child { display: grid; line-height: 1.25; }
.progress-card strong { font-size: .85rem; }
.progress-card small { color: var(--muted); font-size: .7rem; }
.progress-ring {
  --p: 0;
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--brand-2) calc(var(--p) * 1%), #e3edf0 0);
  position: relative;
}
.progress-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.progress-ring span { position: relative; z-index: 1; font-size: .7rem; font-weight: 800; color: var(--ink-2); }
.step-nav { display: grid; gap: .3rem; margin-bottom: 1rem; }
.step-btn {
  display: grid; grid-template-columns: 30px 1fr 8px; align-items: center; gap: .6rem;
  width: 100%; padding: .55rem .6rem; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ink-2); text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.step-btn:hover { background: #eef6f7; }
.step-btn .step-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #eaf1f3; font-size: .9rem; }
.step-btn .step-label { display: grid; line-height: 1.18; }
.step-btn .step-label strong { font-size: .8rem; }
.step-btn .step-label small { font-size: .66rem; color: var(--muted-2); }
.step-btn .step-dot { width: 7px; height: 7px; border-radius: 50%; background: #cfdde2; }
.step-btn.active { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); }
.step-btn.active .step-icon { background: var(--brand-soft); }
.step-btn.done .step-dot { background: var(--green); }
.step-btn.active .step-dot { background: var(--brand-2); box-shadow: 0 0 0 4px rgba(13,148,136,.12); }
.sidebar-card { padding: .9rem; margin-top: .75rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.sidebar-card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-bottom: .4rem; }
.sidebar-card p { font-size: .74rem; color: var(--muted); line-height: 1.45; margin-bottom: .6rem; }
.sidebar-card.compact p { margin-bottom: 0; }

.main { min-width: 0; padding: clamp(1rem, 3vw, 2.2rem); max-width: 1500px; width: 100%; margin: 0 auto; }
.banner { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 12px; font-size: .88rem; }
.banner-info { background: var(--blue-soft); border: 1px solid #c9e2f4; color: #134b75; }
.banner strong { font-size: .88rem; }

/* ---------- Home ---------- */
.hero-card {
  display: grid; grid-template-columns: 1fr 220px; gap: 1.5rem; align-items: center;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  margin-bottom: 1.8rem;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 20%, rgba(94,234,212,.22), transparent 35%),
    linear-gradient(135deg, #0b2533, #0d4754 60%, #0f766e);
  box-shadow: var(--shadow);
}
.hero-card .eyebrow { color: #7dd3c7; }
.hero-card h1 { color: #fff; margin-bottom: .6rem; }
.hero-lead { max-width: 640px; color: #c6dfe4; font-size: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.hero-actions .btn-primary { --btn-bg: #fff; --btn-fg: #0b5f59; --btn-border: transparent; box-shadow: none; }
.hero-actions .btn-soft { --btn-bg: rgba(255,255,255,.12); --btn-fg: #fff; --btn-border: rgba(255,255,255,.22); }
.hero-visual { position: relative; display: grid; justify-items: center; padding: 1rem; border: 1px solid rgba(255,255,255,.14); border-radius: 20px; background: rgba(255,255,255,.06); }
.hero-number { font-size: 4rem; font-weight: 800; line-height: 1; letter-spacing: -.06em; }
.hero-number small { font-size: 1rem; font-weight: 600; color: #9fd8d0; letter-spacing: 0; }
.hero-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #9fc2ca; }
.hero-spark { width: 100%; height: 4px; margin-top: .9rem; border-radius: 99px; background: linear-gradient(90deg, #5eead4, #f59e0b); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; }
.section-heading h2 { margin: 0; }
.section-heading .muted { max-width: 420px; font-size: .88rem; margin: 0; }
.section-lead { max-width: 900px; color: var(--muted); margin: -.35rem 0 1.3rem; }
.heading-chip { flex: 0 0 auto; padding: .38rem .7rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .72rem; font-weight: 800; color: var(--brand); }
.heading-chip.neutral { color: var(--muted); background: #f4f7f8; }
.step-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.step-card { display: grid; gap: .5rem; padding: 1rem; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease; }
.step-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.step-card .step-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.step-card .step-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 800; }
.step-card h3 { font-size: .95rem; }
.step-card p { margin: 0; font-size: .78rem; color: var(--muted); }
.step-card .mini-status { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); }
.step-card .mini-status.done { color: var(--green); }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.info-card { padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.info-card h3 { margin-bottom: .6rem; font-size: 1rem; }
.info-card p { font-size: .84rem; color: var(--muted); }
.info-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #f3f8f9; margin-bottom: .65rem; font-size: 1.1rem; }
.info-card.accent-card { background: linear-gradient(160deg, #fff, #fffaf0); border-color: #f4e3bd; }
.info-card.accent-card a { font-size: .8rem; font-weight: 800; }
.check-list, .number-list { font-size: .82rem; color: var(--muted); padding-left: 1.1rem; }
.check-list li::marker { color: var(--brand-2); }

/* ---------- Panels ---------- */
.panel { padding: clamp(1rem, 2.2vw, 1.4rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: .9rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.panel-head h3 { margin-bottom: .2rem; }

/* ---------- Lab ---------- */
.lab-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel-instructions { position: sticky; top: 88px; }
.panel-instructions h3 { margin-bottom: .7rem; }
.procedure { padding-left: 1.15rem; font-size: .82rem; color: var(--ink-2); }
.procedure li { padding-left: .2rem; }
.procedure li.done { color: var(--green); }
.procedure li.done::marker { content: "✓  "; }
.zero-box { display: grid; gap: .45rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.zero-line { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: .8rem; font-weight: 700; }
.zero-line .ok { color: var(--green); font-size: .72rem; }
.zero-line .pending { color: var(--muted-2); font-size: .72rem; }
.lab-stage-panel { padding: .6rem; overflow: hidden; }
.lab-stage { position: relative; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #f9fcfd, #eaf2f5); border: 1px solid var(--line-2); }
#labSvg { display: block; width: 100%; height: auto; }
.svg-label { font-family: var(--font); font-size: 10px; font-weight: 800; letter-spacing: .12em; fill: #7f98a5; }
.apparatus-zone { cursor: pointer; }
.apparatus-zone:hover .zone-hit, .apparatus-zone:focus-visible .zone-hit { fill: rgba(13,148,136,.08); }
.apparatus-zone.is-active { filter: drop-shadow(0 0 8px rgba(13,148,136,.45)); }
.scene-hint { position: absolute; left: 50%; bottom: .65rem; transform: translateX(-50%); padding: .42rem .8rem; border-radius: 99px; background: rgba(11,37,51,.82); color: #fff; font-size: .72rem; font-weight: 700; white-space: nowrap; pointer-events: none; }
.selection-badge { position: absolute; top: .7rem; left: .7rem; display: flex; align-items: center; gap: .45rem; padding: .35rem .65rem; border-radius: 99px; background: #fff; box-shadow: var(--shadow-sm); font-size: .72rem; font-weight: 800; }
.selection-badge .dot { width: 10px; height: 10px; border-radius: 50%; }
.stage-actions { display: flex; flex-wrap: wrap; gap: .45rem; padding: .65rem .35rem .2rem; }
.measure-panel { display: grid; gap: .5rem; padding: .2rem .35rem .35rem; }
.measure-card { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfc; }
.measure-card strong { font-size: .9rem; }
.measure-card .measure-value { font-family: var(--mono); font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.measure-card label { font-size: .74rem; font-weight: 800; color: var(--ink-2); }
.measure-card input { width: 100px; padding: .45rem .55rem; border-radius: 9px; }
.measure-card .btn { margin-left: auto; }
.measure-card .reading-help { flex: 1 1 100%; font-size: .74rem; color: var(--muted); }
.bodies-panel { margin: 0 0 1rem; }
.counter-pill { padding: .35rem .7rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.body-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
.body-token {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem; border: 2px solid var(--line); border-radius: 14px;
  background: #fff; text-align: left; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.body-token:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.body-token.selected { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(13,148,136,.12); }
.body-token.measured { background: #fcfefd; }
.body-token .cylinder {
  position: relative; flex: 0 0 auto; width: 38px; height: 48px;
  border-radius: 8px 8px 11px 11px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 78%, #000 22%), var(--c) 45%, color-mix(in srgb, var(--c) 70%, #fff 30%));
  box-shadow: inset -4px 0 8px rgba(0,0,0,.12);
}
.body-token .cylinder::before { content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--c) 72%, #fff 28%); }
.body-token .cylinder span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .78rem; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.body-token .body-meta { display: grid; line-height: 1.2; min-width: 0; }
.body-token .body-meta strong { font-size: .85rem; }
.body-token .body-meta small { font-size: .68rem; color: var(--muted); }
.body-token .body-check { margin-left: auto; font-size: .72rem; color: var(--green); font-weight: 800; }
.lab-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.lab-progress { flex: 1; max-width: 460px; }
.bar { height: 8px; border-radius: 99px; background: #dfeaee; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); transition: width .35s ease; }
.lab-progress small { display: block; margin-top: .3rem; font-size: .72rem; color: var(--muted); }

/* ---------- Questions / records ---------- */
.question-card { margin-bottom: 1rem; }
.question-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.question-head > div { display: flex; gap: .75rem; align-items: start; }
.q-number { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .82rem; }
.question-head h3 { font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.question-head p { margin: .2rem 0 0; color: var(--muted); font-size: .83rem; }
.points-badge { padding: .2rem .5rem; border-radius: 99px; background: #f2f7f8; color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.status-pill { flex: 0 0 auto; padding: .32rem .62rem; border-radius: 99px; background: #f1f5f6; color: var(--muted); font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.status-pill.submitted { background: var(--green-soft); color: var(--green); }
.status-pill.reopened { background: var(--amber-soft); color: #9a5b00; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.option { display: flex; align-items: center; gap: .55rem; padding: .62rem .7rem; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; font-size: .82rem; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.option:hover { border-color: #b9d4d9; background: #fbfdfd; }
.option input { width: 16px; height: 16px; accent-color: var(--brand); }
.option.checked { border-color: var(--brand-2); background: var(--brand-soft); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 620px; font-size: .84rem; }
.data-table th, .data-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line-2); text-align: center; }
.data-table thead th { background: #f4f9fa; color: var(--ink-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.data-table tbody th { text-align: left; background: #fbfdfd; font-size: .78rem; }
.data-table tr:last-child th, .data-table tr:last-child td { border-bottom: 0; }
.data-table td input { width: 100%; min-width: 80px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: .35rem .3rem; text-align: center; }
.data-table td input:hover { border-color: var(--line); background: #fff; }
.data-table td input:focus { border-color: var(--brand-2); background: #fff; }
.data-table td.correct { background: var(--green-soft); }
.data-table td.wrong { background: var(--red-soft); }
.instrument-table { min-width: 560px; }
.instrument-table select { min-width: 130px; padding: .4rem .45rem; border-radius: 8px; font-size: .8rem; }
.question-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.question-actions [data-submit] { display: none !important; }

/* ---------- Hints ---------- */
.hint-box { margin: .8rem 0; border: 1px solid #f1dfb8; border-radius: 12px; background: #fffbf2; overflow: hidden; }
.hint-box.compact { margin: .9rem 0 0; }
.hint-toggle { display: flex; width: 100%; align-items: center; gap: .5rem; padding: .62rem .8rem; border: 0; background: transparent; color: #8a5a00; font-size: .78rem; font-weight: 800; text-align: left; }
.hint-toggle::before { content: "💡"; font-size: .9rem; }
.hint-toggle::after { content: "+"; margin-left: auto; font-size: 1rem; font-weight: 800; }
.hint-toggle[aria-expanded="true"]::after { content: "−"; }
.hint-content { display: none; padding: 0 .85rem .75rem; font-size: .79rem; color: #6b5126; }
.hint-box.open .hint-content { display: block; }
.hint-content p { margin: 0 0 .5rem; }
.hint-content ul, .hint-content ol { padding-left: 1.1rem; }
.hint-example { padding: .55rem .65rem; border-radius: 9px; background: #fff; border: 1px dashed #ecd39c; }
.hint-warning { padding-left: .6rem; border-left: 3px solid #e2a43a; }
.mini-steps { font-size: .78rem; }

/* ---------- Feedback ---------- */
.feedback-slot:empty { display: none; }
.feedback { margin-top: .9rem; padding: .9rem; border-radius: 13px; border: 1px solid var(--line); background: #fbfdfd; }
.feedback.success { border-color: #bfe6cb; background: #f3fcf6; }
.feedback.partial { border-color: #f0d9a8; background: #fffbf2; }
.feedback.error { border-color: #f1c4bf; background: #fff7f6; }
.feedback.info { border-color: #c9e2f4; background: #f5faff; }
.feedback-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .55rem; }
.feedback-head h4 { font-size: .9rem; margin: 0; }
.feedback-score { margin-left: auto; padding: .22rem .55rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: .72rem; font-weight: 800; }
.feedback p { font-size: .82rem; }
.feedback ul, .feedback ol { font-size: .82rem; padding-left: 1.15rem; }
.feedback .detail-list { display: grid; gap: .28rem; margin: .55rem 0 0; padding: 0; list-style: none; }
.feedback .detail-list li { display: grid; grid-template-columns: 20px 1fr auto; gap: .45rem; align-items: start; margin: 0; font-size: .78rem; }
.feedback .detail-list .di { font-size: .8rem; }
.feedback .detail-list .ok { color: var(--green); }
.feedback .detail-list .no { color: var(--red); }
.feedback .detail-list small { color: var(--muted); font-size: .7rem; }
.feedback .model-answer { margin-top: .7rem; padding: .7rem .8rem; border-left: 3px solid var(--brand-2); background: #fff; border-radius: 0 9px 9px 0; font-size: .82rem; }
.feedback .model-answer strong { display: block; margin-bottom: .25rem; color: var(--brand); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.feedback .teacher-note { margin-top: .7rem; padding: .65rem .75rem; border-radius: 9px; background: #eef6ff; border: 1px solid #cfe3f7; font-size: .8rem; }
.feedback .teacher-note strong { color: #134b75; }
.feedback .tag-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.tag { display: inline-block; padding: .22rem .5rem; border-radius: 99px; background: #eef5f6; color: var(--muted); font-size: .67rem; font-weight: 700; }
.tag.good { background: var(--green-soft); color: var(--green); }
.tag.bad { background: var(--red-soft); color: var(--red); }

/* ---------- Graph ---------- */
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.graph-card { padding: .8rem; }
.graph-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .2rem .2rem .6rem; }
.graph-legend { display: flex; flex-wrap: wrap; gap: .35rem; }
.legend-item { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .45rem; border-radius: 99px; background: #f4f8f9; font-size: .68rem; font-weight: 700; }
.legend-item i { width: 9px; height: 9px; border-radius: 50%; }
.graph-buttons { display: flex; gap: .35rem; }
.graph-wrap { position: relative; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; overflow: hidden; }
#graphSvg { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; }
#graphSvg.locked { cursor: default; }
.graph-readout { position: absolute; left: .55rem; bottom: .55rem; padding: .3rem .55rem; border-radius: 7px; background: rgba(255,255,255,.92); border: 1px solid var(--line); font-size: .68rem; color: var(--muted); pointer-events: none; }
.axis-note { padding: .5rem .2rem 0; text-align: center; font-size: .7rem; color: var(--muted); }
.graph-side { display: grid; gap: .8rem; }
.line-options { display: grid; gap: .45rem; margin-top: .6rem; }
.line-option { display: flex; align-items: center; gap: .6rem; padding: .5rem; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; text-align: left; }
.line-option:hover { border-color: #b9d4d9; }
.line-option.selected { border-color: var(--brand-2); background: var(--brand-soft); }
.line-option svg { flex: 0 0 auto; width: 58px; height: 42px; border-radius: 6px; background: #f8fbfc; }
.line-option span { display: grid; line-height: 1.2; }
.line-option strong { font-size: .76rem; }
.line-option small { font-size: .66rem; color: var(--muted); }
.inline-input { display: flex; align-items: center; gap: .45rem; margin: .5rem 0; }
.inline-input input { width: 110px; padding: .55rem .6rem; }
.inline-input span { font-weight: 800; color: var(--muted); font-size: .82rem; }

/* ---------- Choices / textareas ---------- */
.choice-list { display: grid; gap: .5rem; margin: .6rem 0; }
.choice { display: flex; gap: .65rem; align-items: flex-start; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.choice:hover { border-color: #b9d4d9; background: #fbfdfd; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-letter { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #f0f5f6; font-weight: 800; font-size: .76rem; }
.choice span:last-child { display: grid; line-height: 1.25; }
.choice strong { font-size: .86rem; }
.choice small { color: var(--muted); font-size: .72rem; }
.choice.checked { border-color: var(--brand-2); background: var(--brand-soft); }
.choice.checked .choice-letter { background: var(--brand); color: #fff; }
textarea { resize: vertical; min-height: 130px; line-height: 1.5; }
.textarea-meta { margin-top: .3rem; text-align: right; font-size: .68rem; color: var(--muted-2); }

/* ---------- Quiz ---------- */
.quiz-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.quiz-progress { flex: 1; max-width: 620px; }
.quiz-progress small { display: block; margin-top: .3rem; color: var(--muted); font-size: .72rem; }
.quiz-score { display: flex; align-items: baseline; gap: .3rem; }
.quiz-score strong { font-size: 2rem; line-height: 1; color: var(--brand); }
.quiz-score span { font-size: .72rem; color: var(--muted); }
.quiz-list { display: grid; gap: .8rem; }
.quiz-card { padding: 1rem; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.quiz-card.answered { background: #fcfefd; }
.quiz-card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.quiz-card-head .q-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #f1f6f7; font-size: .72rem; font-weight: 800; }
.quiz-card h3 { font-size: .95rem; }
.quiz-card .quiz-question { font-size: .86rem; color: var(--ink-2); margin: .2rem 0 .6rem; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.quiz-option { display: flex; align-items: center; gap: .45rem; padding: .5rem .6rem; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; font-size: .8rem; cursor: pointer; }
.quiz-option:hover { border-color: #b9d4d9; }
.quiz-option input { width: 15px; height: 15px; accent-color: var(--brand); }
.quiz-option.checked { border-color: var(--brand-2); background: var(--brand-soft); }
.quiz-numeric { display: flex; align-items: center; gap: .5rem; max-width: 250px; }
.quiz-numeric input { padding: .5rem .6rem; }
.quiz-numeric span { font-size: .8rem; font-weight: 800; color: var(--muted); }
.quiz-actions { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.quiz-feedback { margin-top: .6rem; padding: .6rem .7rem; border-radius: 9px; font-size: .78rem; background: #f7fafb; border: 1px solid var(--line-2); }
.quiz-feedback.good { background: var(--green-soft); border-color: #bfe6cb; }
.quiz-feedback.bad { background: var(--red-soft); border-color: #f1c4bf; }
.quiz-feedback strong { display: block; margin-bottom: .15rem; }
.quiz-card .teacher-note { margin-top: .55rem; padding: .6rem .7rem; border-radius: 9px; background: #eef6ff; border: 1px solid #cfe3f7; font-size: .78rem; }
.quiz-card .teacher-note strong { color: #134b75; }
.quiz-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* ---------- Result ---------- */
.result-hero { display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem; align-items: center; padding: clamp(1.2rem, 3vw, 2rem); border-radius: 22px; color: #fff; background: radial-gradient(circle at 85% 20%, rgba(94,234,212,.22), transparent 40%), linear-gradient(135deg, #0b2533, #0d4754 60%, #0f766e); box-shadow: var(--shadow); }
.result-meta { margin: -.2rem 0 .65rem; font-size: .82rem; color: #9fc2ca; font-weight: 700; }
.print-header { display: none; }
.result-ring { --p: 0; width: 190px; height: 190px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#5eead4 calc(var(--p) * 1%), rgba(255,255,255,.16) 0); position: relative; justify-self: center; }
.result-ring::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #0d3444; }
.result-ring div { position: relative; z-index: 1; display: grid; justify-items: center; line-height: 1; }
.result-ring strong { font-size: 3.6rem; letter-spacing: -.06em; }
.result-ring small { margin-top: .3rem; font-size: .7rem; color: #9fd8d0; letter-spacing: .1em; text-transform: uppercase; }
.result-hero h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.8rem); margin-bottom: .35rem; }
.result-hero p { color: #c6dfe4; max-width: 620px; }
.result-level { display: inline-block; margin-top: .6rem; padding: .35rem .7rem; border-radius: 99px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); font-size: .76rem; font-weight: 800; }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.result-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1rem; margin-top: 1rem; }
.breakdown-list { display: grid; gap: .55rem; }
.breakdown-row { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; }
.breakdown-row .bl { font-size: .8rem; font-weight: 700; }
.breakdown-row .bv { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.breakdown-row .bar { grid-column: 1 / -1; }
.outcome-list { display: grid; gap: .5rem; }
.outcome { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.outcome .o-icon { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .7rem; font-weight: 800; }
.outcome .o-icon.good { background: var(--green-soft); color: var(--green); }
.outcome .o-icon.mid { background: var(--amber-soft); color: #9a5b00; }
.outcome .o-icon.low { background: var(--red-soft); color: var(--red); }
.outcome div { display: grid; line-height: 1.25; }
.outcome > .btn { margin-left: auto; flex: 0 0 auto; }
.outcome strong { font-size: .8rem; }
.outcome small { font-size: .7rem; color: var(--muted); }
.result-section { margin-top: 1rem; }
.result-section h2 { font-size: 1.3rem; margin-bottom: .7rem; }
.importance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.importance-card { padding: 1rem; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.importance-card span { font-size: 1.3rem; }
.importance-card h3 { font-size: .9rem; margin: .4rem 0 .3rem; }
.importance-card p { font-size: .78rem; color: var(--muted); margin: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-cloud .tag { font-size: .72rem; padding: .32rem .6rem; background: #fff; border: 1px solid var(--line); }
.ae-list { display: grid; gap: .5rem; }
.ae-item { padding: .7rem .8rem; border-left: 3px solid var(--brand-2); background: #fff; border-radius: 0 10px 10px 0; font-size: .8rem; color: var(--ink-2); }
.teacher-comment-box { margin-top: 1rem; padding: .9rem 1rem; border: 1px solid #cfe3f7; border-radius: 13px; background: #f5faff; }
.teacher-comment-box strong { color: #134b75; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.teacher-comment-box p { margin: .35rem 0 0; font-size: .86rem; white-space: pre-wrap; }
.incomplete-box { padding: .9rem 1rem; border-radius: 12px; background: var(--amber-soft); border: 1px solid #f1dfb8; font-size: .84rem; margin-bottom: 1rem; }

/* ---------- Teacher ---------- */
.teacher-page { background: #f3f7f8; min-height: 100vh; }
.teacher-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem clamp(1rem, 3vw, 2rem); background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.teacher-topbar .brand { display: flex; align-items: center; gap: .7rem; }
.teacher-topbar img { width: 96px; }
.teacher-topbar .brand div { display: grid; line-height: 1.15; }
.teacher-topbar .brand strong { font-size: .9rem; }
.teacher-topbar .brand span { font-size: .68rem; color: var(--muted); }
.teacher-login { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(circle at 15% 15%, rgba(20,184,166,.16), transparent 35%), var(--bg); }
.teacher-login-card { width: min(440px, 100%); padding: clamp(1.4rem, 4vw, 2.2rem); background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.teacher-login-card img { width: 130px; margin-bottom: 1rem; }
.teacher-login-card h1 { font-size: 1.9rem; margin-bottom: .3rem; }
.teacher-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: calc(100vh - 66px); }
.teacher-sidebar { border-right: 1px solid var(--line); background: #fbfdfd; padding: 1rem; overflow-y: auto; max-height: calc(100vh - 66px); position: sticky; top: 66px; }
.teacher-main { padding: clamp(1rem, 3vw, 2rem); min-width: 0; }
.teacher-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.stat-card { padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stat-card strong { display: block; font-size: 1.5rem; line-height: 1; }
.stat-card small { display: block; font-size: .68rem; color: var(--muted); line-height: 1.3; }
.stat-card small + small { margin-top: .1rem; color: var(--muted-2); font-size: .62rem; }
.teacher-search { display: flex; gap: .4rem; margin-bottom: .7rem; }
.teacher-search input { padding: .55rem .65rem; border-radius: 9px; font-size: .82rem; }
.teacher-filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .7rem; }
.filter-chip { padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: .68rem; font-weight: 700; color: var(--muted); }
.filter-chip.active { border-color: var(--brand-2); background: var(--brand-soft); color: var(--brand); }
.student-list { display: grid; gap: .35rem; }
.student-list-item { display: grid; grid-template-columns: 36px 1fr auto; gap: .55rem; align-items: center; padding: .55rem; border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left; width: 100%; }
.student-list-item:hover { background: #f1f7f8; }
.student-list-item.active { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); }
.student-list-item .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #e6f2f3; color: var(--brand); font-weight: 800; font-size: .76rem; }
.student-list-item .who { display: grid; line-height: 1.18; min-width: 0; }
.student-list-item .who strong { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-list-item .who small { font-size: .66rem; color: var(--muted); }
.student-list-item .score { text-align: right; }
.student-list-item .score strong { display: block; font-size: .9rem; line-height: 1; }
.student-list-item .score small { font-size: .6rem; color: var(--muted); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; margin-bottom: .8rem; }
.detail-head h1 { font-size: 1.6rem; margin-bottom: .2rem; }
.detail-head .meta { font-size: .78rem; color: var(--muted); }
.detail-score { display: flex; align-items: center; gap: 1rem; }
.detail-score .big { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.05em; }
.detail-score .big small { font-size: .8rem; color: var(--muted); letter-spacing: 0; }
.detail-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.toggle { display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { position: relative; width: 42px; height: 24px; border-radius: 99px; background: #d6e2e6; transition: background .15s ease; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s ease; }
.toggle input:checked + .track { background: var(--brand-2); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.teacher-tabs { display: flex; gap: .3rem; margin-bottom: .8rem; border-bottom: 1px solid var(--line); }
.teacher-tab { padding: .55rem .8rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 800; }
.teacher-tab.active { color: var(--brand); border-bottom-color: var(--brand-2); }
.answer-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: .7rem; overflow: hidden; }
.answer-card-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; background: #fbfdfd; border-bottom: 1px solid var(--line-2); }
.answer-card-head h3 { font-size: .9rem; flex: 1; }
.answer-score { font-size: .78rem; font-weight: 800; color: var(--brand); }
.answer-body { padding: .85rem; }
.answer-body .answer-text { padding: .7rem .8rem; border-radius: 9px; background: #f8fbfc; border: 1px solid var(--line-2); font-size: .84rem; white-space: pre-wrap; }
.answer-grid { display: grid; gap: .3rem; margin: .5rem 0; }
.answer-row { display: flex; justify-content: space-between; gap: .8rem; font-size: .78rem; padding: .25rem 0; border-bottom: 1px dashed var(--line-2); }
.answer-row:last-child { border-bottom: 0; }
.answer-row span:last-child { font-weight: 700; }
.teacher-controls { display: grid; grid-template-columns: 150px 1fr auto; gap: .5rem; align-items: end; margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.teacher-controls label { font-size: .68rem; font-weight: 800; color: var(--ink-2); display: grid; gap: .2rem; }
.teacher-controls input, .teacher-controls textarea { padding: .45rem .55rem; border-radius: 8px; font-size: .8rem; }
.teacher-controls textarea { min-height: 38px; resize: vertical; }
.correction-panel iframe { width: 100%; height: 76vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.correction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.rubric-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.rubric-table th, .rubric-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.rubric-table th { background: #f5f9fa; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.rubric-table td:last-child { text-align: left; }
.rubric-table.points-table td:last-child { text-align: center; font-weight: 800; white-space: nowrap; }
.correction-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 800; }
.teacher-empty { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 2rem; }
.teacher-empty .big-icon { font-size: 3rem; margin-bottom: .6rem; }

/* ---------- Modal / toast ---------- */
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 20px); z-index: 80; padding: .7rem 1rem; border-radius: 999px; background: var(--navy); color: #fff; font-size: .82rem; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 2rem); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }
.modal-root { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6,24,34,.58); backdrop-filter: blur(3px); }
.modal-card { position: relative; z-index: 1; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 1.3rem; border-radius: 18px; background: #fff; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-card h2 { font-size: 1.3rem; margin-bottom: .4rem; }
.modal-card p { color: var(--muted); font-size: .88rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.zoom-scale { display: grid; gap: .6rem; }
.zoom-scale svg { width: 100%; max-height: 420px; background: #fbfdfd; border: 1px solid var(--line); border-radius: 12px; }
.zoom-tip { font-size: .8rem; color: var(--muted); }

/* ==========================================================================
   THEORY
   ========================================================================== */
.theory-page { background: #f6f9fa; }
.theory-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem clamp(1rem,4vw,3rem); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.theory-topbar .brand { display: flex; align-items: center; gap: .8rem; }
.theory-topbar img { width: 104px; }
.theory-topbar .brand span { font-size: .68rem; color: var(--muted); }
.theory-hero { position: relative; overflow: hidden; padding: clamp(2.4rem,6vw,5rem) clamp(1rem,4vw,3rem); color: #fff; background: radial-gradient(circle at 82% 18%, rgba(94,234,212,.26), transparent 34%), radial-gradient(circle at 8% 80%, rgba(245,158,11,.16), transparent 30%), linear-gradient(135deg,#071b26,#0d3d4b 60%,#0f766e); }
.theory-hero-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 260px; gap: 2rem; align-items: center; }
.theory-hero h1 { color: #fff; font-size: clamp(2.4rem,5vw,4.4rem); margin-bottom: .5rem; }
.theory-hero p { color: #c6dfe4; max-width: 680px; font-size: 1.02rem; }
.theory-hero .eyebrow { color: #7dd3c7; }
.theory-hero-card { padding: 1.1rem; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.07); }
.theory-hero-card strong { display: block; font-size: 2.4rem; line-height: 1; }
.theory-hero-card small { color: #9fc2ca; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.theory-hero-card p { margin: .45rem 0 0; font-size: .78rem; color: #b8d4db; }
.theory-layout { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 2rem; padding: 2rem clamp(1rem,4vw,3rem) 4rem; }
.theory-toc { position: sticky; top: 84px; align-self: start; padding: .9rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.theory-toc h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; }
.theory-toc a { display: block; padding: .34rem .45rem; border-radius: 7px; font-size: .76rem; color: var(--ink-2); }
.theory-toc a:hover { background: #f1f7f8; text-decoration: none; }
.theory-content { min-width: 0; }
.theory-section { padding: 1.6rem 1.8rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; scroll-margin-top: 84px; }
.theory-section h2 { margin-bottom: .6rem; font-size: 1.5rem; }
.theory-section h3 { margin: 1rem 0 .35rem; font-size: 1rem; color: var(--ink-2); }
.theory-section p, .theory-section li { font-size: .88rem; color: #3e5a6b; }
.theory-section ul, .theory-section ol { margin: .5rem 0 .8rem; }
.theory-section strong { color: var(--ink); }
.callout { padding: .8rem .9rem; margin: .8rem 0; border-radius: 11px; border-left: 4px solid var(--brand-2); background: #f2fbf9; font-size: .84rem; color: #245b56; }
.callout.warn { border-left-color: var(--amber); background: #fffbf2; color: #6b5126; }
.callout.info { border-left-color: var(--blue); background: #f3f9ff; color: #295273; }
.callout strong { color: inherit; }
.formula-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .8rem; padding: 1rem; margin: .8rem 0; border: 1px dashed #b9d9d4; border-radius: 12px; background: #f7fdfc; font-family: var(--mono); font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.formula-box small { font-family: var(--font); font-size: .7rem; font-weight: 600; color: var(--muted); }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: .8rem 0; }
.compare-card { padding: .9rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfd; }
.compare-card h3 { margin-top: 0; font-size: .9rem; }
.compare-card.mass { border-top: 4px solid var(--blue); }
.compare-card.weight { border-top: 4px solid var(--coral); }
.compare-card dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: .25rem .5rem; font-size: .78rem; }
.compare-card dt { color: var(--muted); }
.compare-card dd { margin: 0; font-weight: 700; color: var(--ink-2); }
.theory-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin: .7rem 0; }
.theory-table th, .theory-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line-2); text-align: left; }
.theory-table th { background: #f4f9fa; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.theory-table tr:last-child td { border-bottom: 0; }
.example-box { padding: .8rem .9rem; margin: .7rem 0; border-radius: 11px; background: #f5f9ff; border: 1px solid #d5e5f5; font-size: .84rem; }
.example-box strong { color: var(--blue); }
.misconception { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .6rem 0; }
.misconception > div { padding: .65rem .75rem; border-radius: 10px; font-size: .8rem; }
.misconception .wrong { background: var(--red-soft); border: 1px solid #f1c4bf; color: #7a231b; }
.misconception .right { background: var(--green-soft); border: 1px solid #bfe6cb; color: #14532d; }
.misconception strong { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.glossary { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.glossary div { padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px; font-size: .78rem; }
.glossary dt { font-weight: 800; color: var(--brand); }
.glossary dd { margin: .1rem 0 0; color: var(--muted); }
.selfcheck { display: grid; gap: .6rem; }
.selfcheck-card { padding: .8rem; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfd; }
.selfcheck-card p { margin: 0 0 .4rem; font-weight: 700; }
.selfcheck-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.selfcheck-options button { padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: .75rem; }
.selfcheck-options button:hover { border-color: var(--brand-2); }
.selfcheck-options button.ok { background: var(--green-soft); border-color: #bfe6cb; color: var(--green); }
.selfcheck-options button.no { background: var(--red-soft); border-color: #f1c4bf; color: var(--red); }
.selfcheck-feedback { margin-top: .4rem; font-size: .75rem; color: var(--muted); }
.theory-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem; border-radius: 16px; background: linear-gradient(135deg,#0b2533,#0f766e); color: #fff; }
.theory-cta h2 { color: #fff; font-size: 1.3rem; margin: 0 0 .2rem; }
.theory-cta p { color: #c6dfe4; margin: 0; font-size: .82rem; }
.theory-cta .btn { --btn-bg: #fff; --btn-fg: #0b5f59; --btn-border: transparent; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .app-body { grid-template-columns: 230px minmax(0,1fr); }
  .sidebar { padding: .8rem; }
  .lab-layout { grid-template-columns: 270px minmax(0,1fr); }
  .graph-layout { grid-template-columns: minmax(0,1fr) 300px; }
  .teacher-layout { grid-template-columns: 310px minmax(0,1fr); }
}
@media (max-width: 980px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { min-height: 100vh; padding: 1.2rem; }
  .mobile-brand { display: block; margin-bottom: 1.2rem; }
  .mobile-brand img { width: 150px; }
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr; border-right: 0; border-bottom: 1px solid var(--line); padding: .7rem; }
  .progress-card { margin-bottom: .5rem; }
  .step-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; padding-bottom: .3rem; }
  .step-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .18rem; padding: .45rem .2rem; text-align: center; }
  .step-btn .step-icon { width: 28px; height: 28px; }
  .step-btn .step-label { text-align: center; }
  .step-btn .step-label strong { font-size: .66rem; line-height: 1.15; }
  .step-btn .step-label small { display: none; }
  .step-btn .step-dot { display: none; }
  .sidebar-card { display: none; }
  .main { padding: 1rem; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-visual { max-width: 240px; }
  .step-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .lab-layout { grid-template-columns: 1fr; }
  .panel-instructions { position: static; }
  .graph-layout { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .importance-grid { grid-template-columns: 1fr 1fr; }
  .teacher-layout { grid-template-columns: 1fr; }
  .teacher-sidebar { position: static; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .teacher-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .correction-grid { grid-template-columns: 1fr; }
  .theory-hero-inner { grid-template-columns: 1fr; }
  .theory-hero-card { max-width: 280px; }
  .theory-layout { grid-template-columns: 1fr; }
  .theory-toc { position: static; display: flex; flex-wrap: wrap; gap: .2rem; }
  .theory-toc h2 { width: 100%; }
  .theory-toc a { padding: .25rem .45rem; }
}
@media (max-width: 900px) {
  .hide-sm { display: none !important; }
}
@media (max-width: 680px) {
  .topbar { min-height: 62px; padding: .5rem .7rem; }
  .topbar-brand img { width: 76px; height: 40px; }
  .topbar-brand span { display: none; }
  .topbar-actions { gap: .25rem; }
  .student-chip { padding: .2rem; }
  .student-chip div { display: none; }
  .sync-pill { display: none; }
  .hide-sm { display: none; }
  .main { padding: .7rem; }
  .hero-card { padding: 1.1rem; border-radius: 18px; }
  .hero-number { font-size: 3rem; }
  .step-grid, .info-grid, .importance-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .4rem; }
  .section-heading .muted { max-width: none; }
  .body-tray { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .body-token:last-child { grid-column: span 2; }
  .option-grid { grid-template-columns: 1fr 1fr; }
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-header { flex-direction: column; align-items: stretch; }
  .quiz-footer, .lab-footer { flex-direction: column; align-items: stretch; }
  .question-head { flex-direction: column; gap: .45rem; }
  .status-pill { align-self: flex-start; }
  .result-hero { grid-template-columns: 1fr; text-align: center; }
  .result-ring { width: 150px; height: 150px; }
  .result-ring strong { font-size: 2.8rem; }
  .result-actions { justify-content: center; }
  .field-row { grid-template-columns: 1fr; }
  .teacher-controls { grid-template-columns: 1fr; }
  .teacher-stats { grid-template-columns: 1fr 1fr; }
  .detail-head { flex-direction: column; }
  .teacher-topbar .brand span { display: none; }
  .theory-section { padding: 1.1rem; }
  .compare-grid, .glossary, .misconception { grid-template-columns: 1fr; }
  .theory-cta { flex-direction: column; align-items: flex-start; }
  .modal-card { padding: 1rem; }
  .toast { white-space: normal; border-radius: 12px; }
}
@media (max-width: 420px) {
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .body-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .body-token:last-child { grid-column: span 2; }
}
@media (max-width: 360px) {
  .option-grid, .body-tray { grid-template-columns: 1fr; }
  .body-token:last-child { grid-column: auto; }
}

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .topbar, .sidebar, .teacher-topbar, .teacher-sidebar, .app .btn, .result-actions, .auth-screen, .toast, .modal-root, .teacher-tabs, .teacher-controls, .teacher-toolbar { display: none !important; }
  .app-body, .main { display: block; padding: 0; }
  .view { display: none !important; }
  #view-result { display: block !important; }
  .print-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid #102a3a; }
  .print-header img { width: 120px; height: auto; }
  .print-header div { display: grid; gap: 2px; }
  .print-header strong { font-size: 13pt; color: #102a3a; }
  .print-header span { font-size: 9pt; color: #444; }
  .result-hero { color: #000; background: #fff; border: 2px solid #000; box-shadow: none; break-inside: avoid; }
  .result-hero h1, .result-hero p, .result-ring strong { color: #000; }
  .result-meta { color: #333; }
  .result-level { border-color: #000; color: #000; }
  .result-ring { background: conic-gradient(#000 calc(var(--p) * 1%), #ddd 0); }
  .result-ring::before { background: #fff; }
  .panel, .importance-card, .result-section { box-shadow: none; break-inside: avoid; }
  .result-grid { grid-template-columns: 1fr; }
  .importance-grid { grid-template-columns: repeat(3, 1fr); }
  a { color: #000; text-decoration: none; }
}
