/* Chalkloom — clean modern edtech theme.
   Crisp white page, cool-dark ink, confident chalk-green, soft shadows. */

:root {
  --paper: #f6faf8;
  --panel: #ffffff;
  --ink: #13271f;
  --muted: #5b6a63;
  --faint: #93a29b;
  --line: #e5ece9;
  --line-strong: #d2e0d9;
  --green: #0e7c5b;
  --green-dark: #0b6349;
  --green-soft: #e7f5ef;
  --mint: #e7f5ef;
  --mint-line: #d3ebe0;
  --gold: #f3b23e;
  --gold-soft: #fdf3df;
  /* category hues (small dot on each card) */
  --c-assess: #0e7c5b;
  --c-teach: #3f6fa8;
  --c-reach: #c26a44;
  --c-spark: #8a67c0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 40, 32, 0.04), 0 8px 24px rgba(16, 40, 32, 0.07);
}

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

/* the hidden attribute always wins, even over display:flex/grid rules */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Nunito', 'Inter', -apple-system, sans-serif; letter-spacing: -0.02em; }
.brand-name { font-family: 'Fraunces', Georgia, serif; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

button { font-family: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(14, 124, 91, 0.35);
  outline-offset: 1px;
}

/* ============ top bar ============ */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246, 250, 248, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 14px; padding: 12px 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark { display: flex; }
.brand-name { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.top-tag { flex: 1; color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.acct-email { color: var(--muted); font-size: 0.82rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-pill {
  background: var(--green-soft); color: var(--green-dark);
  font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 99px;
}
.usage-pill.low { background: #fdeaea; color: #b04437; }
.usage-pill.trial { background: var(--gold-soft, #f4ead1); color: #8a5f14; }
.plan-badge {
  background: var(--gold-soft); color: #8a5f14; text-transform: capitalize;
  font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 99px;
}

/* ============ main ============ */
.main { padding: 26px 20px 60px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

textarea {
  width: 100%; resize: vertical; min-height: 150px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; font: inherit; color: var(--ink); background: #f8fbfa;
}
textarea::placeholder, input::placeholder { color: var(--faint); }

.quick-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
  border: 1px solid var(--line); background: #f8fbfa; border-radius: 10px;
  padding: 7px 12px; font-size: 0.85rem; font-weight: 600; color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}
.mini-btn:hover { border-color: var(--green); color: var(--green-dark); }
.mini-btn svg { width: 15px; height: 15px; }
.file-name { color: var(--green-dark); font-size: 0.82rem; font-weight: 600; }

.basics { display: flex; gap: 10px; margin-top: 12px; align-items: end; flex-wrap: wrap; }
.basics label, .extra label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
  flex: 1; min-width: 130px;
}
.basics input, .basics select, .extra input {
  border: 1px solid var(--line); border-radius: 10px; background: #f8fbfa;
  padding: 10px 12px; font: inherit; color: var(--ink); min-height: 42px;
}
.more-toggle {
  min-height: 42px; border: none; background: none; color: var(--green-dark);
  font-size: 0.85rem; font-weight: 700; white-space: nowrap; padding: 0 4px;
}
.extra { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.extra .full { flex-basis: 100%; }

/* ============ pick ============ */
.pick-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 2px 14px; }
.pick-head h2 { font-size: 1.45rem; font-weight: 700; }
.selected-count { color: var(--green-dark); font-size: 0.85rem; font-weight: 700; }

.demo-link {
  margin-left: auto; border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--green-dark); font-weight: 700; font-size: 0.82rem; border-radius: 99px;
  padding: 7px 14px; min-height: 38px; transition: all 0.15s;
}
.demo-link:hover { border-color: var(--green); background: var(--green-soft); }

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }

.mat-card {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.mat-card:hover { border-color: var(--line-strong); }
.mat-card.on { border-color: var(--green); background: var(--green-soft); }

.mat-main { display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none; padding: 0; min-height: 44px; }
.mat-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--line); color: var(--muted);
}
.mat-card.on .mat-icon { background: var(--green); border-color: var(--green); color: #fff; }
.mat-icon svg { width: 20px; height: 20px; }
.mat-txt { flex: 1; min-width: 0; }
.mat-txt strong { display: block; font-size: 0.95rem; letter-spacing: -0.01em; }
.mat-txt span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.78rem; margin-top: 1px; }
.cat-dot { width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; }
.mat-check {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  border: 1.5px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; color: transparent;
  transition: all 0.15s;
}
.mat-card.on .mat-check { background: var(--green); border-color: var(--green); color: #fff; }
.mat-check svg { width: 14px; height: 14px; }

/* variant chips inside a selected card */
.variants { margin-top: 11px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vchip {
  border: 1.5px solid var(--line); background: #f8fbfa; color: var(--muted);
  border-radius: 99px; padding: 6px 12px; min-height: 34px;
  font-size: 0.8rem; font-weight: 600;
  transition: all 0.13s;
}
.vchip:hover { border-color: var(--green); color: var(--green-dark); }
.vchip.on { background: var(--green); border-color: var(--green); color: #fff; }
.vresearch {
  margin-top: 8px; color: var(--muted); font-size: 0.75rem; line-height: 1.45;
  display: flex; gap: 6px; align-items: baseline;
}
.vresearch::before { content: '📚'; font-size: 0.8rem; }

/* ============ My Classes bar ============ */
.class-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 12px; }
.class-bar:empty { display: none; }
.class-label { color: var(--faint); font-size: 0.78rem; font-weight: 700; }
.class-chip {
  display: inline-flex; align-items: stretch; border: 1.5px solid var(--line);
  border-radius: 99px; background: #f8fbfa; overflow: hidden;
}
.class-chip.on { border-color: var(--green); background: var(--green-soft); }
.class-apply {
  border: none; background: none; color: var(--ink); font-weight: 700; font-size: 0.82rem;
  padding: 8px 4px 8px 13px; min-height: 38px;
}
.class-chip.on .class-apply { color: var(--green-dark); }
.class-del {
  border: none; background: none; color: var(--faint); font-size: 1rem; font-weight: 700;
  padding: 0 10px 0 6px;
}
.class-del:hover { color: #b04437; }
.class-save {
  border: 1.5px dashed var(--line-strong); background: none; color: var(--green-dark);
  border-radius: 99px; padding: 8px 14px; min-height: 38px; font-size: 0.82rem; font-weight: 700;
  transition: border-color 0.15s;
}
.class-save:hover { border-color: var(--green); }

.chip-group-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--faint); margin: 10px 0 6px;
}
.chip-group-label:first-child { margin-top: 0; }
.vchip.acc.on { background: var(--gold); border-color: var(--gold); color: #4a3607; }

/* ============ owner dashboard ============ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; text-align: center;
}
.sc-num { font-family: 'Nunito', 'Inter', sans-serif; font-size: 2rem; font-weight: 700; color: var(--green-dark); }
.sc-label { color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-top: 2px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.admin-sec {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.admin-sec h3 { font-size: 1.02rem; margin-bottom: 10px; }
.admin-empty { color: var(--faint); font-size: 0.85rem; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.bar-label { flex: 0 0 44%; font-size: 0.8rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 10px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.bar-num { flex: 0 0 34px; text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--green-dark); }
.admin-key {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfa;
  padding: 11px 12px; font: inherit; color: var(--ink);
}

.more-materials {
  display: block; margin: 12px auto 0; min-height: 42px;
  background: none; border: 1px dashed var(--line-strong); border-radius: 99px;
  color: var(--muted); font-size: 0.85rem; font-weight: 700; padding: 8px 20px;
  transition: all 0.15s;
}
.more-materials:hover { color: var(--green-dark); border-color: var(--green); }
#moreGrid { margin-top: 10px; }

/* ============ go ============ */
.results-label { display: block; margin: 18px 2px 6px; font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.results-label .opt-note { font-weight: 400; }
.privacy-note {
  margin: 10px 2px 0; padding: 10px 12px; font-size: 0.82rem; color: var(--muted);
  background: var(--wash, #f3f7f4); border: 1px solid var(--line); border-radius: 10px;
}
.privacy-note strong { color: var(--ink); }
/* Landing hero — frames the tool for first-time visitors */
.lp-hero { text-align: center; margin: 8px 0 24px; padding: 34px 22px 30px; background: linear-gradient(180deg, #eef8f3 0%, var(--paper) 82%); border: 1px solid var(--mint-line); border-radius: 22px; }
.studio-head .lp-trust, .lp-hero .lp-trust { margin-top: 14px; }
.lp-h1 { font-family: 'Nunito', 'Inter', sans-serif; font-weight: 700; font-size: clamp(1.7rem, 4.6vw, 2.55rem); line-height: 1.12; letter-spacing: -.01em; color: var(--ink); margin: 0 0 12px; }
.lp-sub { max-width: 620px; margin: 0 auto 14px; color: var(--muted); font-size: 1.02rem; line-height: 1.5; }
.lp-trust { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: center; margin: 0; font-size: .82rem; font-weight: 600; color: var(--green-dark); }
.lp-trust span { white-space: nowrap; }
.studio-head .lp-trust { justify-content: flex-start; margin-top: 14px; }

/* "Why teachers trust it" — honest proof block + repeat CTA */
.value { margin: 42px 0 6px; padding-top: 30px; border-top: 1px solid var(--line); }
.value-h2 { text-align: center; font-family: 'Nunito', 'Inter', sans-serif; font-weight: 700; font-size: 1.5rem; color: var(--ink); margin: 0 0 22px; }
.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.value-card { background: #ffffff; border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; box-shadow: 0 6px 18px rgba(16, 40, 32, 0.06); }
.value-ic { display: block; font-size: 1.5rem; margin-bottom: 8px; }
.value-card h3 { font-size: 1rem; margin: 0 0 6px; color: var(--ink); }
.value-card p { font-size: .9rem; line-height: 1.5; color: var(--muted); margin: 0; }
.value-diff { text-align: center; max-width: 640px; margin: 22px auto 0; font-size: .92rem; line-height: 1.55; color: var(--muted); }
.value-diff strong { color: var(--ink); }
.value-cta { text-align: center; margin-top: 22px; }

/* "Continue with Google" button in the auth modal */
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-bottom: 4px; min-height: 46px;
  background: #fff; color: #3c4043; border: 1px solid var(--line-strong);
  border-radius: 12px; font-size: 0.95rem; font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.google-btn:hover { background: #f6faf8; border-color: var(--green); }
.google-btn .g-ic { width: 18px; height: 18px; flex: 0 0 auto; }
.auth-or {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 6px;
  color: var(--faint); font-size: 0.8rem; font-weight: 600;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Two-factor / security panel */
.sec-note { color: var(--muted); font-size: 0.92rem; line-height: 1.5; margin: 4px 0 14px; }
.sec-steps { margin: 0 0 12px 18px; padding: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.sec-steps li { margin-bottom: 8px; }
.sec-key {
  margin: 8px 0 2px; padding: 10px 12px; background: var(--green-soft);
  border: 1px solid var(--mint-line); border-radius: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 1.05rem;
  font-weight: 700; letter-spacing: 0.08em; color: var(--green-dark); word-break: break-all;
}
.sec-sub { display: block; color: var(--faint); font-size: 0.78rem; margin-top: 4px; }
.sec-backup {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px;
  margin: 8px 0 10px; padding: 12px 14px;
  background: var(--green-soft); border: 1px solid var(--mint-line); border-radius: 10px;
}
.sec-backup code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.92rem; font-weight: 600; color: var(--green-dark); }

/* ============ owner dashboard ============ */
.owner-link {
  text-decoration: none; font-size: 0.82rem; font-weight: 700; color: var(--green-dark);
  background: var(--green-soft); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 12px; white-space: nowrap;
}
.owner-link:hover { border-color: var(--green); }
.backlink { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.backlink:hover { text-decoration: underline; }

.dash-head { margin: 6px 2px 20px; }
.dash-head h1 { font-size: 1.9rem; margin: 10px 0 6px; }
.dash-sub { color: var(--muted); font-size: 0.9rem; }
.dash-loading, .dash-none { color: var(--faint); font-size: 0.9rem; padding: 8px 0; }
.dash-empty { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; color: var(--muted); }
.dash-empty strong { color: var(--ink); font-size: 1.05rem; }
.dash-empty code { background: var(--green-soft); padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }

.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.stat-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.stat-value { font-family: 'Nunito', sans-serif; font-size: 1.7rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-sub { font-size: 0.75rem; color: var(--faint); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.panel-title { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }

.barlist { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 42px; align-items: center; gap: 10px; }
.bar-label { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--green-soft); border-radius: 99px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.bar-val { font-size: 0.82rem; font-weight: 700; color: var(--ink); text-align: right; }

.daychart { display: flex; align-items: flex-end; gap: 2px; height: 90px; padding-top: 6px; }
.day-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.day-fill { width: 100%; min-height: 2px; background: var(--green); border-radius: 3px 3px 0 0; }
.day-fill:hover { background: var(--green-dark); }
.daychart-x { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--faint); margin-top: 6px; }

.fb-block { text-align: center; padding: 6px 0; }
.fb-big { font-family: 'Nunito', sans-serif; font-size: 2.2rem; font-weight: 800; color: var(--green-dark); }
.fb-big span { font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.fb-counts { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }

.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dash-table th { text-align: left; color: var(--faint); font-weight: 700; font-size: 0.75rem; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink); }
.dash-table .tag { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); text-transform: capitalize; }
.dash-table .tag.paid { background: var(--green-soft); color: var(--green-dark); }
.dash-table .tag.trial { background: var(--gold-soft); color: #8a5f14; }

.go-row { margin: 22px 0 8px; text-align: center; }
.btn-primary {
  background: var(--green); color: #fff; border: none;
  border-radius: 12px; font-weight: 700; font-size: 0.95rem;
  padding: 12px 22px; min-height: 44px;
  box-shadow: 0 4px 14px rgba(14, 124, 91, 0.25);
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:active { transform: scale(0.98); }

/* One-button path — the calm default for teachers new to AI */
.make-lesson { text-align: center; margin: 26px 0 10px; }
.make-lesson .btn-primary.lg { font-size: 1.05rem; padding: 15px 30px; }
.make-lesson-sub {
  max-width: 520px; margin: 14px auto 0; color: var(--muted);
  font-size: 0.92rem; line-height: 1.55;
}
.make-lesson-sub strong { color: var(--ink, #1a1a1a); }
.make-lesson-links {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  justify-content: center; align-items: center; margin-top: 14px;
}
.pick-toggle { font-size: 0.9rem; font-weight: 600; }
#pickerSection { margin-top: 6px; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.btn-primary.lg { font-size: 1.05rem; padding: 15px 34px; border-radius: 14px; }
.btn-primary.small { padding: 8px 14px; min-height: 38px; font-size: 0.85rem; }
.ghost-btn {
  background: none; border: 1px solid var(--line-strong); color: var(--muted);
  border-radius: 10px; padding: 8px 14px; min-height: 38px; font-size: 0.85rem; font-weight: 600;
}
.ghost-btn:hover { color: var(--green-dark); border-color: var(--green); }
.linklike { background: none; border: none; color: var(--green-dark); font-size: 0.88rem; font-weight: 600; text-decoration: underline; }
.go-hint { color: #b04437; font-size: 0.88rem; font-weight: 600; margin-top: 10px; min-height: 1.2em; }

/* ============ results (tabs) ============ */
#results { margin-top: 34px; }
.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-bar h3 { font-size: 1.3rem; }

.result-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  border-bottom: 2px solid var(--line);
}
.rtab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  background: none; border: none; border-bottom: 3px solid transparent;
  margin-bottom: -2px; padding: 10px 12px; min-height: 44px;
  color: var(--muted); font-size: 0.88rem; font-weight: 600;
}
.rtab.on { color: var(--green-dark); border-bottom-color: var(--green); }
.rtab .st { width: 8px; height: 8px; border-radius: 99px; background: var(--line-strong); flex-shrink: 0; }
.rtab .st.working { background: var(--gold); animation: blink 1s ease-in-out infinite; }
.rtab .st.done { background: var(--green); }
.rtab .st.error { background: #c0392b; }
@keyframes blink { 50% { opacity: 0.35; } }

.result-panel { display: none; }
.result-panel.on { display: block; }

.result-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.result-actions button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 10px; padding: 8px 13px; min-height: 40px; font-size: 0.84rem; font-weight: 600;
}
.result-actions button:hover { border-color: var(--green); color: var(--green-dark); }
.result-actions button.act-primary { background: var(--green); border-color: var(--green); color: #fff; }
.result-actions button.act-primary:hover { background: var(--green-dark); color: #fff; }
.result-actions svg { width: 15px; height: 15px; }
.copy-mode {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-right: 4px;
}
.copy-mode button {
  border: none; background: none; color: var(--muted); font-size: 0.8rem; font-weight: 700;
  padding: 8px 12px; min-height: 40px; border-radius: 0;
}
.copy-mode button.on { background: var(--green); color: #fff; }
.result-actions [data-act="edit"].on { background: var(--gold-soft); border-color: var(--gold); color: #8a5f14; }
.feedback { display: inline-flex; align-items: center; gap: 2px; }
.feedback button {
  border: 1px solid transparent; background: none; font-size: 1rem; line-height: 1;
  padding: 7px 8px; min-height: 40px; border-radius: 9px; filter: grayscale(1); opacity: 0.6;
}
.feedback button:hover { opacity: 1; }
.feedback button.on { filter: none; opacity: 1; border-color: var(--line-strong); background: var(--panel); }
.result-body.editing {
  outline: 2px dashed var(--gold); outline-offset: 3px; background: #f8fbfa;
}
.remix-row {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; padding-left: 12px; border-left: 1px dashed var(--line-strong);
}
.remix-label { font-size: 0.78rem; font-weight: 700; color: var(--faint); }

/* "More" overflow — keeps the results screen calm */
.more-btn { color: var(--muted); }
.more-menu {
  flex-basis: 100%; margin-top: 8px; padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  display: flex; flex-direction: column; gap: 10px;
}
.more-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.more-row.secondary { gap: 6px 16px; }
.act-teach { border-color: var(--green) !important; color: var(--green-dark) !important; font-weight: 600; }
.act-teach:hover { background: var(--wash, #f3f7f4) !important; }
.more-row.access { border-top: 1px dashed var(--line-strong); padding-top: 10px; align-items: center; }
.access-label { font-size: 0.78rem; font-weight: 700; color: var(--faint); }
.translate-select {
  font: inherit; font-size: 0.82rem; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card, #fff); color: var(--ink); cursor: pointer;
}
.translate-select:hover { border-color: var(--green); }
.fb-label { font-size: 0.78rem; font-weight: 700; color: var(--faint); margin-right: 2px; }

@media (max-width: 640px) {
  .remix-row { margin-left: 0; padding-left: 0; border-left: none; flex-basis: 100%; }
}

.result-body {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px;
}
.result-body.status-working { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.result-body.status-error { color: #b04437; font-weight: 600; }
.spinner {
  width: 16px; height: 16px; border-radius: 99px; flex-shrink: 0;
  border: 2.5px solid var(--line); border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* generated document typography */
.result-body h1, .result-body h2, .result-body h3 { color: var(--green-dark); margin: 1.1em 0 0.45em; line-height: 1.25; }
.result-body h1 { font-size: 1.35rem; } .result-body h2 { font-size: 1.15rem; } .result-body h3 { font-size: 1rem; }
.result-body p, .result-body li { margin: 0.35em 0; }
.result-body ul, .result-body ol { padding-left: 1.4em; }
.result-body table { border-collapse: collapse; margin: 0.7em 0; width: 100%; }
.result-body th, .result-body td { border: 1px solid var(--line-strong); padding: 7px 10px; text-align: left; font-size: 0.9rem; }
.result-body th { background: var(--paper); }
.result-body blockquote { border-left: 3px solid var(--green); padding-left: 12px; color: var(--muted); }
.result-body hr { border: none; border-top: 1px dashed var(--line-strong); margin: 1em 0; }
.result-body code { background: var(--paper); border-radius: 5px; padding: 1px 5px; font-size: 0.88em; }

/* ============ recents ============ */
#recents { margin-top: 34px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; margin-bottom: 8px;
}
.recent-item .mat-icon { width: 34px; height: 34px; }
.recent-info { flex: 1; min-width: 0; }
.recent-info strong { display: block; font-size: 0.9rem; }
.recent-info span { color: var(--muted); font-size: 0.78rem; }

.foot { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 16px; }
.foot p { color: var(--faint); font-size: 0.78rem; max-width: 560px; }

.slogan em { font-style: normal; color: var(--green-dark); font-weight: 700; }

.grade-tune {
  margin-top: 10px; color: var(--green-dark); font-size: 0.8rem; font-weight: 600;
  background: var(--green-soft); border-radius: 9px; padding: 7px 12px;
}

/* ============ PBL Studio ============ */
.pbl-link {
  color: var(--green-dark); text-decoration: none; font-weight: 700; font-size: 0.88rem;
  border: 1px solid var(--line-strong); border-radius: 99px; padding: 7px 14px;
  transition: all 0.15s; white-space: nowrap;
}
.pbl-link:hover { border-color: var(--green); background: var(--green-soft); }

.other-tools { margin: 40px 0 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.other-tools-head { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); margin: 0 2px 12px; }
.foot-links { margin-top: 10px; }
.foot-links a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.studio-strip {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  background: var(--panel); border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  padding: 13px 16px; text-decoration: none; color: var(--ink);
  transition: border-color 0.15s;
}
.studio-strip:hover { border-color: var(--green); }
.studio-strip-txt { flex: 1; font-size: 0.88rem; color: var(--muted); }
.studio-strip-txt strong { color: var(--ink); }
.studio-strip-go { color: var(--green-dark); font-weight: 700; font-size: 1.1rem; }

.studio-badge {
  background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 99px; white-space: nowrap;
}

.studio-head { margin: 6px 2px 18px; }
.studio-head h1 { font-size: 1.9rem; margin: 12px 0 8px; }
.studio-head p { color: var(--muted); max-width: 640px; }

.studio-tabs {
  display: inline-flex; gap: 4px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px;
}
.stab {
  border: none; background: none; color: var(--muted); font-weight: 700; font-size: 0.88rem;
  border-radius: 99px; padding: 9px 18px; min-height: 40px; transition: all 0.15s;
}
.stab.on { background: var(--green); color: #fff; }

.build-mode {
  display: inline-flex; gap: 4px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px;
}
.bmode {
  border: none; background: none; color: var(--muted); font-weight: 700; font-size: 0.86rem;
  border-radius: 99px; padding: 8px 16px; min-height: 38px; transition: all 0.15s; cursor: pointer;
}
.bmode.on { background: var(--green); color: #fff; }
.build-mode-note {
  margin: -4px 0 16px; color: var(--muted); font-size: 0.9rem; max-width: 620px; line-height: 1.5;
}

.learn-sec {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
.learn-sec summary {
  cursor: pointer; list-style: none; padding: 15px 18px;
  font-family: 'Nunito', 'Inter', sans-serif; font-size: 1.05rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.learn-sec summary::before { content: '+'; color: var(--green-dark); font-weight: 700; width: 16px; }
.learn-sec[open] summary::before { content: '–'; }
.learn-sec summary::-webkit-details-marker { display: none; }
.learn-body { padding: 0 18px 16px 44px; color: var(--ink); font-size: 0.92rem; }
.learn-body p, .learn-body li { margin: 0.45em 0; }
.learn-body ul, .learn-body ol { padding-left: 1.3em; }
.learn-body strong { color: var(--green-dark); }

.learn-locked {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 13px 18px; margin-bottom: 10px; color: var(--muted);
}
.learn-locked .lk-title { flex: 1; font-family: 'Nunito', 'Inter', sans-serif; font-weight: 700; font-size: 1.02rem; }
.learn-foot { color: var(--faint); font-size: 0.78rem; margin-top: 14px; }

.backlink { color: var(--green-dark); text-decoration: none; font-weight: 600; }
.backlink:hover { text-decoration: underline; }
.opt-note { font-weight: 500; color: var(--faint); text-transform: none; }
.studio-note { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-top: 8px; }

/* ============ modals ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(50, 40, 24, 0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: 18px; box-shadow: 0 24px 70px rgba(50, 40, 20, 0.3);
  max-width: 430px; width: 100%; padding: 26px;
}
.modal h2 { font-size: 1.3rem; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-top: 12px; }
.field input, .modal > input {
  border: 1px solid var(--line); border-radius: 10px; background: #f8fbfa;
  padding: 11px 12px; font: inherit; color: var(--ink); width: 100%;
}
.modal > input { margin-top: 12px; }
.setup-steps { margin: 12px 0 0 18px; color: var(--muted); font-size: 0.9rem; }
.setup-steps li { margin: 4px 0; }
.setup-steps a { color: var(--green-dark); }
.plan-perks { margin: 12px 0 0 18px; color: var(--ink); font-size: 0.92rem; }
.plan-perks li { margin: 4px 0; }
.price-line { margin-top: 14px; color: var(--muted); }
.price-line .price { font-family: 'Nunito', 'Inter', sans-serif; font-size: 1.7rem; font-weight: 700; color: var(--ink); margin-right: 6px; }

.plan-pick { display: flex; gap: 10px; margin: 18px 0 4px; }
.plan-pick button {
  position: relative; flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  border: 1.5px solid var(--line-strong); background: var(--panel); border-radius: 12px;
  padding: 18px 14px 12px; cursor: pointer; text-align: left; transition: all 0.15s;
}
.plan-pick .plan-badge-top {
  position: absolute; top: -9px; left: 12px;
  background: var(--green); color: #fff; font-size: 0.62rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px;
  box-shadow: 0 2px 6px rgba(14, 124, 91, 0.3);
}
.price-anchor { margin: 12px 2px 0; text-align: center; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.upgrade-reassure { margin: 12px 0 0; text-align: center; font-size: 0.76rem; color: var(--faint); }

/* Word-of-mouth share nudge (shown once, after materials are made) */
.share-prompt {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--green-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin: 16px 0 0;
}
.share-txt { font-weight: 600; color: var(--green-dark); font-size: 0.92rem; max-width: 46ch; }
.share-actions { display: inline-flex; align-items: center; gap: 12px; }

/* Contextual nudge banner (trial ending / near the free limit) */
.top-notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--gold-soft, #f4ead1); border: 1px solid #e6d6ac; color: #6f4e12;
  border-radius: 12px; padding: 10px 16px; margin: 0 0 16px; font-size: 0.9rem; font-weight: 600;
}
.top-notice .notice-msg { flex: 1; min-width: 180px; }
.notice-cta {
  border: none; background: var(--green); color: #fff; font-weight: 700; font-size: 0.84rem;
  padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.notice-cta:hover { background: var(--green-dark); }
.notice-x { border: none; background: none; color: #9a7b3a; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 2px; }

.trust-row strong { color: var(--green-dark); }

/* Chalkloom for Schools page */
.school-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin: 8px 0 26px;
}
.school-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.school-card h3 { font-family: 'Nunito', 'Inter', sans-serif; font-size: 1.08rem; color: var(--green-dark); margin: 0 0 6px; }
.school-card p { color: var(--muted); font-size: 0.92rem; margin: 0; line-height: 1.5; }
.school-inquiry h2 { font-family: 'Nunito', 'Inter', sans-serif; margin: 0 0 4px; }
.school-sub { color: var(--muted); margin: 0 0 16px; }
.school-inquiry textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 0.95rem; resize: vertical; margin-top: 4px;
}
.school-reassure { margin: 10px 0 0; color: var(--faint); font-size: 0.82rem; }
.school-done { text-align: center; padding: 16px 0 8px; }
.school-done h3 { font-family: 'Nunito', 'Inter', sans-serif; font-size: 1.4rem; color: var(--green-dark); margin: 0 0 8px; }
.school-done p { color: var(--muted); max-width: 46ch; margin: 0 auto; }
.school-plan-link { display: block; margin: 6px auto 0; font-size: 0.84rem; color: var(--muted); }
.plan-pick button strong { font-size: 1.02rem; color: var(--ink); }
.plan-pick button span { font-size: 0.78rem; color: var(--muted); }
.plan-pick button.on { border-color: var(--green); background: var(--green-soft); }
.plan-pick button.on strong { color: var(--green-dark); }
.summer-opt {
  display: flex; align-items: flex-start; gap: 8px; margin: 10px 2px 0;
  font-size: 0.86rem; color: var(--muted); cursor: pointer; line-height: 1.4;
}
.summer-opt input { margin-top: 2px; accent-color: var(--green); }

.school-code-link {
  display: block; margin: 14px auto 0; font-size: 0.86rem; font-weight: 600; color: var(--muted);
}
.school-code-row { display: flex; gap: 8px; margin-top: 10px; }
.school-code-row input {
  flex: 1; border: 1.5px solid var(--line-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 0.92rem; min-height: 42px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.school-code-row input:focus { outline: none; border-color: var(--green); }
.school-code-row .btn-primary.small { white-space: nowrap; }
.modal-error { color: #b04437; font-size: 0.85rem; font-weight: 600; min-height: 1.2em; margin-top: 8px; }
.modal-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }

@media (max-width: 640px) {
  .top-tag { display: none; }
  .result-body { padding: 18px; }
}
