/* RapidMeta Evidence Paper Studio — pilot stylesheet.
   Scoped under #tab-paper / .paper-studio-page so it never touches the
   dark RapidMeta workbench UI. The paper itself is a white "sheet" sitting
   on the dark bench. */

#tab-paper {
  --paper-bg: #1e2530;            /* bench behind the sheet (matches dark UI) */
  --paper-surface: #ffffff;
  --paper-ink: #1f2933;
  --paper-muted: #667085;
  --paper-border: #e5e7eb;
  --paper-soft-blue: #eef6ff;
  --paper-soft-yellow: #fff8df;
  --paper-soft-green: #eefaf2;
  --paper-soft-red: #fff1f1;
  --paper-accent: #2454a6;
  --paper-radius-lg: 22px;
  --paper-radius-md: 14px;
  --paper-shadow: 0 18px 50px rgba(15, 23, 42, 0.45);
  --paper-max-width: 920px;
  background: var(--paper-bg);
}

/* ---- toolbar ---- */
.paper-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: #131c2b;   /* opaque (no backdrop-filter: it would make a containing block
                            that traps the position:fixed dropdown menus) */
  border-bottom: 1px solid #334155;
}
.paper-toolbar .ps-title {
  font-weight: 800;
  color: #e2e8f0;
  margin-right: auto;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.paper-toolbar button {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 0.7rem;
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.paper-toolbar button:hover { background: #475569; }
.paper-toolbar button.primary { background: var(--paper-accent); border-color: var(--paper-accent); color: #fff; }
.paper-toolbar button.primary:hover { background: #1d4486; }
.paper-toolbar .ps-save-status { font-size: 0.72rem; color: #94a3b8; margin-left: 0.4rem; }

/* "More" overflow + download menus */
.toolbar-more, .download-menu { position: relative; }
.toolbar-more > summary { list-style: none; cursor: pointer; font-size: 0.78rem; font-weight: 700; padding: 0.5rem 0.9rem; border-radius: 0.7rem; background: #334155; color: #e2e8f0; border: 1px solid #475569; }
.toolbar-more > summary::-webkit-details-marker { display: none; }
.toolbar-more[open] > summary { background: #475569; }
/* Fixed-position (viewport-anchored) so they escape the tab's overflow:auto scroll
   container and never clip; internal scroll handles long menus. */
.toolbar-more-body { position: fixed; left: 14px; top: 54px; z-index: 60; width: 230px; max-height: calc(100vh - 70px); overflow-y: auto; background: #0f172a; border: 1px solid #334155; border-radius: 0.8rem; padding: 0.5rem; box-shadow: 0 18px 50px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 0.3rem; }
.toolbar-more-body button { text-align: left; font-size: 0.8rem; font-weight: 600; padding: 0.45rem 0.6rem; border-radius: 0.5rem; background: #1e293b; color: #e2e8f0; border: 1px solid #334155; cursor: pointer; }
.toolbar-more-body button:hover { background: #334155; }
.toolbar-more-body button.danger { color: #fca5a5; border-color: #7f1d1d; background: #2a1414; margin-top: 0.2rem; }
.toolbar-more-body button.danger:hover { background: #3a1a1a; }

/* download menu */
.download-menu { position: relative; }
.download-menu > summary { list-style: none; cursor: pointer; font-size: 0.78rem; font-weight: 700; padding: 0.5rem 0.9rem; border-radius: 0.7rem; background: #334155; color: #e2e8f0; border: 1px solid #475569; }
.download-menu > summary::-webkit-details-marker { display: none; }
.download-menu[open] > summary { background: #475569; }
.download-menu-body { position: fixed; right: 14px; top: 54px; z-index: 60; width: 260px; max-height: calc(100vh - 70px); overflow-y: auto; background: #0f172a; border: 1px solid #334155; border-radius: 0.8rem; padding: 0.6rem; box-shadow: 0 18px 50px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 0.3rem; }
/* On phones, render menus as a centered bottom sheet so nothing is clipped. */
@media (max-width: 640px) {
  .download-menu-body, .toolbar-more-body { left: 50%; right: auto; top: auto; bottom: 0; transform: translateX(-50%); width: min(94vw, 380px); max-height: 75vh; border-radius: 0.9rem 0.9rem 0 0; }
}
.download-menu-body strong { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; margin-top: 0.2rem; }
.download-menu-body button { text-align: left; font-size: 0.8rem; font-weight: 600; padding: 0.4rem 0.6rem; border-radius: 0.5rem; background: #1e293b; color: #e2e8f0; border: 1px solid #334155; cursor: pointer; }
.download-menu-body button:hover { background: #334155; }
.download-menu-body hr { border: none; border-top: 1px solid #334155; margin: 0.3rem 0; }
.download-menu-body .fig-fmt { font-size: 0.72rem; color: #94a3b8; display: flex; align-items: center; gap: 0.4rem; }
.download-menu-body .fig-fmt select { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 0.4rem; padding: 0.2rem; font-size: 0.78rem; }

/* ---- layout ---- */
.paper-studio-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.5rem;
}
.paper-sidebar {
  flex: 0 0 290px;
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.paper-sidebar section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: var(--paper-radius-md);
  padding: 1rem;
}
.paper-sidebar h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #94a3b8;
  margin-bottom: 0.7rem;
}
.paper-mission {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #cbd5e1;
}
.paper-mission strong { color: #f8fafc; }

/* ---- canvas ---- */
.paper-canvas {
  flex: 1 1 auto;
  max-width: var(--paper-max-width);
  margin: 0 auto;
  background: var(--paper-surface);
  color: var(--paper-ink);
  border-radius: var(--paper-radius-lg);
  box-shadow: var(--paper-shadow);
  padding: 3rem;
  line-height: 1.65;
  font-size: 17px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.paper-canvas h1 { font-size: 2.2rem; line-height: 1.32; letter-spacing: -0.03em; margin-bottom: 0.5rem; color: var(--paper-ink); }
/* Give the wrapped editable title breathing room so highlighted lines never collide. */
.paper-canvas h1 .student-editable { line-height: 1.4; }
.paper-canvas h2 {
  margin-top: 2.5rem; font-size: 1.35rem; letter-spacing: -0.015em;
  border-bottom: 1px solid var(--paper-border); padding-bottom: 0.4rem; color: var(--paper-ink); font-weight: 700;
}
.paper-canvas h3 { font-size: 1.05rem; font-weight: 700; color: var(--paper-ink); }
.paper-canvas p { margin: 0.8rem 0; }
.paper-kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 800; color: var(--paper-accent); }

/* ---- editable fields ---- */
.student-writing-box, .student-editable {
  display: block;
  background: var(--paper-soft-yellow);
  border: 1px dashed #e0c768;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.4rem 0;
  min-height: 2.4em;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
/* Inline editables (title, captions): small vertical padding + per-line-fragment
   background so a wrapped multi-line value doesn't overlap the line above/below. */
.student-editable {
  display: inline;
  padding: 0.04em 0.3rem;
  min-height: 0;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.student-writing-box:focus, .student-editable:focus { background: #fffdf3; border-color: var(--paper-accent); }
.student-writing-box:empty::before, .student-editable:empty::before { content: attr(data-placeholder); color: #7a6411; } /* AA contrast on the yellow box */
.student-task-label {
  display: inline-block; font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: #705a0f; background: #fdf0c9; padding: 0.1rem 0.5rem;
  border-radius: 999px; margin-bottom: 0.2rem;
}
.word-target { font-size: 0.72rem; color: var(--paper-muted); font-style: italic; }
.live-wc { font-style: normal; font-weight: 700; }
.live-wc.wc-low { color: #b45309; }
.live-wc.wc-ok { color: #15803d; }
.confirm-note { color: var(--paper-muted); }
.paper-toolbar button.primary.locked { background: #51607a; opacity: 0.85; }
.paper-toolbar button.primary.locked:hover { background: #5b6b87; }

/* ---- instructional guidance (novice writers) ---- */
.onboard-card {
  position: relative; background: var(--paper-soft-blue); border: 1px solid #cfe3fb;
  border-radius: var(--paper-radius-md); padding: 1.1rem 1.4rem; margin: 0 0 1.5rem;
}
.onboard-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--paper-accent); }
.onboard-card ol { margin: 0.3rem 0 0.3rem 1.1rem; padding: 0; }
.onboard-card li { margin: 0.3rem 0; font-size: 0.9rem; line-height: 1.5; }
.onboard-card .onboard-tip { font-size: 0.82rem; color: var(--paper-muted); margin: 0.6rem 0 0; }
.onboard-card .onboard-privacy { font-size: 0.8rem; color: #166534; background: var(--paper-soft-green); border: 1px solid #bbf7d0; border-radius: 8px; padding: 0.5rem 0.7rem; margin: 0.5rem 0 0; }
.onboard-dismiss {
  position: absolute; top: 0.6rem; right: 0.7rem; background: transparent; border: none;
  font-size: 1rem; color: var(--paper-muted); cursor: pointer; line-height: 1;
}
.onboard-dismiss:hover { color: var(--paper-ink); }

.section-help {
  font-size: 0.84rem; line-height: 1.5; color: #475569; background: #f8fafc;
  border-left: 3px solid var(--paper-accent); border-radius: 0 8px 8px 0;
  padding: 0.5rem 0.8rem; margin: 0.4rem 0 0.7rem;
}
.section-help .help-ico { margin-right: 0.2rem; }
.field-help { font-size: 0.78rem; color: var(--paper-muted); margin: 0.1rem 0 0.3rem; line-height: 1.45; }
.section-example {
  font-size: 0.8rem; line-height: 1.5; background: var(--paper-soft-green);
  border: 1px solid #bbf7d0; border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0.3rem 0 0.8rem; color: #14532d;
}
.section-example .ex-good { font-weight: 700; color: #15803d; }
.section-example .ex-weak { font-weight: 700; color: #b45309; }
/* Decorative marker only — the actual guidance is shown as visible .field-help text. */
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05em; height: 1.05em; border-radius: 999px; background: var(--paper-accent);
  color: #fff; font-size: 0.7rem; font-weight: 700; vertical-align: middle; margin-left: 0.2rem;
}

/* The toggle collapses the EXTRA guidance (onboarding, section notes, examples) but
   NEVER the per-box .field-help — that is the core instruction for a first-time writer. */
body.tips-hidden .onboard-card,
body.tips-hidden .section-help,
body.tips-hidden .glossary-card,
body.tips-hidden .story-card,
body.tips-hidden .section-example { display: none !important; }

/* short-story teaching cards (secular parables) */
.story-card { background: #fbf7ef; border: 1px solid #ece0c8; border-left: 4px solid #c9a84a; border-radius: 0 10px 10px 0; padding: 0.2rem 0.9rem; margin: 0.4rem 0 0.9rem; }
.story-card > summary { cursor: pointer; font-size: 0.82rem; font-weight: 700; color: #92702a; padding: 0.4rem 0; }
.story-card p { font-size: 0.9rem; line-height: 1.6; color: #5b4a26; font-style: italic; margin: 0.2rem 0 0.6rem; }
.live-wc.wc-thin { color: #a16207; font-weight: 600; }

/* glossary card + inline "30-second" term chips */
.glossary-card { background: #f8fafc; border: 1px solid var(--paper-border); border-radius: var(--paper-radius-md); padding: 0.6rem 1rem; margin: 0 0 1.25rem; }
.glossary-card > summary { cursor: pointer; font-weight: 700; color: var(--paper-accent); font-size: 0.9rem; }
.glossary-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.learn-chip {
  font-size: 0.72rem; padding: 0.2rem 0.6rem; border-radius: 999px; cursor: pointer;
  background: var(--paper-soft-blue); color: var(--paper-accent); border: 1px solid #cfe3fb;
  vertical-align: middle; white-space: nowrap;
}
.learn-chip:hover { background: #dceafb; }
.export-clean-pdf .learn-chip { display: none !important; }

/* Examples: stronger amber for the "weak" line (red-green friendly with the ✗ word). */
.section-example .ex-weak { color: #92400e; }

/* a11y: dismiss control ≥24px touch target (WCAG 2.2). */
.onboard-dismiss { padding: 0.35rem; min-width: 24px; min-height: 24px; }

/* ---- cards ---- */
.clinical-question-card, .evidence-summary-card, .cover-summary-card {
  background: var(--paper-soft-blue);
  border: 1px solid #cfe3fb;
  border-radius: var(--paper-radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}
.cover-summary-card { background: #f8fafc; border-color: var(--paper-border); }
.evidence-summary-card { background: #fff; border-color: var(--paper-border); }

.evidence-chip {
  display: inline-flex; gap: 0.35rem; align-items: center;
  border: 1px solid var(--paper-border); border-radius: 999px;
  padding: 0.35rem 0.65rem; margin: 0.2rem; background: #fff; font-size: 0.85rem; color: var(--paper-ink);
}
.evidence-chip strong { color: var(--paper-accent); }
.paper-sidebar .evidence-chip { background: rgba(255,255,255,0.06); color: #e2e8f0; border-color: #475569; }
.paper-sidebar .evidence-chip strong { color: #93c5fd; }

/* ---- figure cards ---- */
.paper-figure-card {
  border: 1px solid var(--paper-border);
  border-radius: var(--paper-radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
  background: #fff;
  break-inside: avoid;
  page-break-inside: avoid;
}
.figure-card-header { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 0.75rem; }
.figure-label { font-size: 0.8rem; font-weight: 700; color: var(--paper-accent); text-transform: uppercase; letter-spacing: 0.08em; }
.figure-card-header h3 { margin: 0; }
.figure-learning-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.figure-learning-row button {
  font-size: 0.74rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  background: var(--paper-soft-blue); color: var(--paper-accent); border: 1px solid #cfe3fb; cursor: pointer;
}
.figure-learning-row button:hover { background: #dceafb; }
.figure-visual { overflow-x: auto; margin: 1rem 0; min-height: 40px; }
.figure-visual svg { max-width: 100%; }
/* own forest/funnel + x-range controls */
.fig-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.5rem; font-size: 0.78rem; color: var(--paper-muted); }
.fig-controls-label { font-weight: 700; }
.fig-controls .fig-x { width: 5.5rem; padding: 0.2rem 0.4rem; border: 1px solid var(--paper-border); border-radius: 6px; font-size: 0.78rem; }
.fig-controls button { font-size: 0.74rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 6px; border: 1px solid #cfe3fb; background: var(--paper-soft-blue); color: var(--paper-accent); cursor: pointer; min-height: 24px; }
.fig-controls button:hover { background: #dceafb; }
.ps-figbox { width: 100%; min-height: 240px; }
.fig-controls-wrap > summary { cursor: pointer; font-size: 0.76rem; color: var(--paper-muted); margin-bottom: 0.3rem; }
.fig-controls-wrap .fig-opt { font-size: 0.66rem; background: #eef2f7; color: #64748b; border-radius: 999px; padding: 0.05rem 0.4rem; }
.fig-controls-note { flex: 1 1 100%; font-size: 0.7rem; color: var(--paper-muted); }
.readiness-honesty { font-size: 0.72rem; color: #94a3b8; line-height: 1.45; margin: 0.6rem 0 0; border-top: 1px solid #334155; padding-top: 0.5rem; }
.tutor-copy-btn { width: 100%; margin-top: 0.5rem; font-size: 0.76rem; font-weight: 700; padding: 0.5rem; border-radius: 0.6rem; background: #1e293b; color: #cbd5e1; border: 1px solid #475569; cursor: pointer; }
.tutor-copy-btn:hover { background: #334155; color: #fff; }

/* outcomes manager */
.outcome-manager { background: #f8fafc; border: 1px solid var(--paper-border); border-radius: var(--paper-radius-md); padding: 0.8rem 1.1rem; margin: 0.5rem 0 1.25rem; }
.outcome-manager h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-accent); margin: 0 0 0.5rem; }
.outcome-list { list-style: none; padding: 0; margin: 0 0 0.5rem; font-size: 0.88rem; }
.outcome-list li { padding: 0.2rem 0; }
.oc-remove { font-size: 0.72rem; color: #b91c1c; background: #fff1f1; border: 1px solid #fecaca; border-radius: 6px; padding: 0.1rem 0.5rem; cursor: pointer; margin-left: 0.4rem; min-height: 24px; }
.add-outcome > summary { cursor: pointer; font-weight: 700; color: var(--paper-accent); font-size: 0.85rem; }
.add-outcome-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-top: 0.7rem; }
.add-outcome-form label { display: flex; flex-direction: column; font-size: 0.72rem; color: var(--paper-muted); gap: 0.15rem; }
.add-outcome-form input, .add-outcome-form select { padding: 0.25rem 0.4rem; border: 1px solid var(--paper-border); border-radius: 6px; font-size: 0.82rem; width: 6rem; }
.add-outcome-form input#ocf-label { width: 12rem; }
.add-outcome-form button { background: var(--paper-accent); color: #fff; border: none; border-radius: 7px; padding: 0.4rem 0.9rem; font-weight: 700; font-size: 0.8rem; cursor: pointer; min-height: 32px; }
.add-outcome-note { flex: 1 1 100%; font-size: 0.75rem; color: var(--paper-muted); margin: 0.3rem 0 0; }
.illus-badge { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 999px; padding: 0.05rem 0.45rem; vertical-align: middle; }
.outcome-section { margin-top: 1.5rem; }
.dropped-warning { background: var(--paper-soft-red); border: 1px solid #fecaca; border-left: 4px solid #ef4444; border-radius: 8px; padding: 0.7rem 1rem; margin: 0.6rem 0; font-size: 0.9rem; color: #7f1d1d; }

/* Methods/Results format selector */
.style-control { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; background: var(--paper-soft-blue); border: 1px solid #cfe3fb; border-radius: var(--paper-radius-md); padding: 0.6rem 0.9rem; margin: 0.4rem 0 0.9rem; font-size: 0.82rem; }
.style-control-label { font-weight: 700; color: var(--paper-accent); }
.style-control label { display: inline-flex; flex-direction: column; gap: 0.1rem; font-size: 0.7rem; color: var(--paper-muted); }
.style-control select { padding: 0.25rem 0.4rem; border: 1px solid var(--paper-border); border-radius: 6px; font-size: 0.8rem; background: #fff; }
.style-control-note { flex: 1 1 100%; font-size: 0.72rem; color: var(--paper-muted); }

/* a11y: visible focus ring on every interactive element (review/Sam blocker) */
.paper-studio-page button:focus-visible,
.paper-studio-page select:focus-visible,
.paper-studio-page summary:focus-visible,
.paper-studio-page input:focus-visible,
.paper-studio-page [contenteditable="true"]:focus-visible,
.learning-drawer button:focus-visible,
.learning-drawer a:focus-visible,
.paper-toolbar button:focus-visible,
.paper-toolbar summary:focus-visible {
  outline: 3px solid var(--paper-accent) !important;
  outline-offset: 2px;
  border-radius: 4px;
}
.student-writing-box:focus-visible, .student-editable:focus-visible { outline: 3px solid var(--paper-accent) !important; outline-offset: 1px; }

.missing-visual {
  color: var(--paper-muted); font-size: 0.85rem; background: #f8fafc;
  border: 1px dashed var(--paper-border); border-radius: 8px; padding: 1rem; text-align: center;
}
.paper-plot-image { max-width: 100%; height: auto; }

/* ---- references builder ---- */
.refs-build-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.refs-build-row button {
  font-size: 0.8rem; font-weight: 700; padding: 0.45rem 0.85rem; border-radius: 0.6rem;
  background: var(--paper-soft-blue); color: var(--paper-accent); border: 1px solid #cfe3fb; cursor: pointer;
}
.refs-build-row button:hover { background: #dceafb; }
.refs-note { font-size: 0.78rem; color: var(--paper-muted); flex: 1 1 240px; }
#paperCanvas [data-field="studentText.references"] { white-space: pre-wrap; font-variant-numeric: tabular-nums; }
figcaption { font-size: 0.95rem; color: var(--paper-muted); border-top: 1px solid var(--paper-border); padding-top: 0.8rem; margin-top: 0.6rem; }

/* ---- checklist ---- */
.checklist-item { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.8rem; padding: 0.2rem 0; }
.checklist-item.complete { color: #4ade80; }
.checklist-item.incomplete { color: #fcd34d; }   /* lighter amber → AA on dark panel */
.checklist-item .sr-prefix { font-weight: 700; }
.readiness-score { font-size: 1.4rem; font-weight: 800; color: #e2e8f0; }
.readiness-bar { height: 8px; background: #334155; border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.readiness-bar > span { display: block; height: 100%; background: linear-gradient(90deg,#3b82f6,#22c55e); transition: width 0.3s; }
.readiness-level { font-size: 0.78rem; color: #94a3b8; }
.readiness-gate { font-size: 0.74rem; font-weight: 700; padding: 0.35rem 0.6rem; border-radius: 8px; margin: 0.5rem 0; }
.readiness-gate.ready { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.4); }
.readiness-gate.blocked { background: rgba(234,179,8,0.12); color: #fcd34d; border: 1px solid rgba(234,179,8,0.4); }

/* ---- issues panel ---- */
.ps-issue { font-size: 0.8rem; padding: 0.5rem 0.7rem; border-radius: 8px; margin: 0.35rem 0; border-left: 3px solid; }
.ps-issue.error { background: var(--paper-soft-red); border-color: #ef4444; color: #7f1d1d; }
.ps-issue.warn  { background: var(--paper-soft-yellow); border-color: #eab308; color: #854d0e; }

/* ---- learning drawer ---- */
.learning-drawer {
  position: fixed; top: 0; right: 0; width: min(420px, 92vw); height: 100vh; z-index: 60;
  background: #0f172a; color: #e2e8f0; border-left: 1px solid #334155;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5); padding: 1.75rem; overflow-y: auto;
}
.learning-drawer[hidden] { display: none; }
.learning-drawer h2 { font-size: 1.25rem; font-weight: 800; margin: 1rem 0 0.5rem; }
.learning-drawer p { font-size: 0.9rem; line-height: 1.6; color: #cbd5e1; }
.learning-common-mistake { background: #422006; border: 1px solid #854d0e; border-radius: 10px; padding: 0.9rem; margin: 1rem 0; }
.learning-common-mistake strong { color: #fbbf24; }
.learning-drawer a#learningCourseLink {
  display: inline-block; margin-top: 1rem; background: var(--paper-accent); color: #fff;
  padding: 0.6rem 1.1rem; border-radius: 0.7rem; font-weight: 700; font-size: 0.85rem; text-decoration: none;
}
#closeLearningDrawer { background: #334155; color: #e2e8f0; border: none; border-radius: 0.6rem; padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.8rem; }

/* ---- toast ---- */
.paper-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #e2e8f0; padding: 0.6rem 1.2rem; border-radius: 999px;
  border: 1px solid #334155; font-size: 0.82rem; z-index: 70; opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.paper-toast.show { opacity: 1; }

/* ---- author transparency ---- */
.author-transparency {
  background: var(--paper-soft-green); border: 1px solid #bbf7d0; border-radius: var(--paper-radius-md);
  padding: 1rem 1.25rem; margin: 1.5rem 0; font-size: 0.85rem; color: #166534;
}
.author-transparency strong { color: #14532d; }

/* ---- preview mode: hide scaffolding on the canvas ---- */
#paperCanvas.paper-mode-preview .student-task-label,
#paperCanvas.paper-mode-preview .word-target,
#paperCanvas.paper-mode-preview .figure-learning-row,
#paperCanvas.paper-mode-preview .author-transparency.working-only { display: none !important; }
#paperCanvas.paper-mode-preview .student-writing-box,
#paperCanvas.paper-mode-preview .student-editable {
  background: transparent; border: none; padding: 0;
}
#paperCanvas.paper-mode-preview .student-writing-box:empty,
#paperCanvas.paper-mode-preview .student-editable:empty { display: none; }

/* ---- responsive ---- */
@media (max-width: 1024px) {
  .paper-studio-layout { flex-direction: column; }
  .paper-sidebar { flex-basis: auto; width: 100%; position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .paper-sidebar section { flex: 1 1 240px; }
  .paper-canvas { padding: 1.5rem; }
}

/* ---- print / PDF export ---- */
.export-clean-pdf .no-clean-pdf,
.export-clean-pdf .figure-learning-row,
.export-clean-pdf .student-task-label,
.export-clean-pdf .word-target,
.export-clean-pdf .author-transparency.working-only { display: none !important; }
.export-clean-pdf .student-writing-box,
.export-clean-pdf .student-editable { border: none; background: transparent; padding: 0; }
.export-clean-pdf .student-writing-box:empty,
.export-clean-pdf .student-editable:empty { display: none; }
