:root {
  --ink: #344b5b;
  --muted: #6e818e;
  --line: #d9e2e7;
  --blue: #55788f;
  --blue-soft: #edf2f5;
  --purple: #55788f;
  --green: #2f835d;
  --bg: #edf2f5;
  --paper: #fff;
  --orange: #e56a3b;
  --orange-soft: #fff0e2;
  --brand-orange: #e56a3b;
  --brand-yellow: #eab752;
  --brand-red: #df554d;
  --brand-green: #2f835d;
  --brand-cream: #f7f9f8;
  --shadow: 0 10px 28px rgba(47, 67, 80, .08);
}

* { box-sizing: border-box; }
body {
  color: var(--ink);
  background: linear-gradient(180deg, #f1f5f7 0%, #eaf0f3 100%);
}
button, input, textarea { font-family: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(85, 120, 143, .35);
  outline-offset: 2px;
}

/* Calm gray-blue shell; warm school colors stay as restrained accents. */
.topbar, .student-bar {
  background: rgba(255, 255, 255, .98);
  color: var(--ink);
  border-bottom: 4px solid var(--blue);
  box-shadow: 0 5px 18px rgba(46, 68, 82, .10);
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-lockup img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none;
  background: white; box-shadow: 0 0 0 2px rgba(229, 106, 59, .28);
}
.brand-lockup h1, .brand-lockup b {
  margin: 0; color: var(--ink); font-weight: 900;
}
.brand-lockup h1 { font-size: 24px; }
.brand-lockup b { display: block; font-size: 21px; }
.brand-lockup p, .brand-lockup small {
  display: block; margin: 3px 0 0; color: var(--muted); font-weight: 700; letter-spacing: .02em;
}
.topbar-actions, .student-user { display: flex; align-items: center; gap: 12px; }
.student-user form, .topbar-actions form { margin: 0; }
.student-bar nav { display: flex; gap: 8px; }
.student-tab {
  background: #f1f4f6; color: #5f7381;
  border: 1px solid #dce4e8;
}
.student-tab.active {
  background: var(--blue); color: white; border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(85, 120, 143, .20);
}

.hero-panel, .hero {
  background: linear-gradient(125deg, #55788f 0%, #66879b 100%);
  box-shadow: 0 16px 36px rgba(67, 102, 124, .15);
}
.hero-panel .eyebrow, .hero .eyebrow { color: #e6eff4; }
.summary strong { color: #f6c16d; }
.primary, .section-title > span { background: var(--blue); }
.primary { box-shadow: 0 6px 15px rgba(65, 98, 119, .18); }
.primary:hover { background: #45677f; }
.secondary {
  background: var(--orange-soft); color: #a7522f; border: 1px solid #f0c8b3;
}
.secondary:hover { background: #ffe8da; }
.tabs button.active, .dimension-picks button.selected {
  background: var(--blue); border-color: var(--blue); color: white;
  box-shadow: 0 4px 12px rgba(85, 120, 143, .16);
}
.badge { background: #e7f3ed; color: #2f835d; }

.login-page {
  background: radial-gradient(circle at 12% 8%, #e5eff4 0%, transparent 34%),
              radial-gradient(circle at 88% 92%, #fff0e2 0%, transparent 28%),
              #f3f6f7;
}
.login-card {
  border: 1px solid #dce5e9; border-top: 7px solid var(--blue);
  box-shadow: 0 22px 60px rgba(54, 76, 89, .13);
}
.login-card .brand-lockup {
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.login-card .brand-lockup img { width: 86px; height: 86px; }
.login-welcome { margin-top: 22px; }

.teacher-main, .homework-page { color: var(--ink); }
.teacher-main > section, .homework-page > header, .homework-card,
.card, .panel, .metric, .notebook, .solution-card {
  border-color: var(--line);
}
.card, .homework-card, .solution-card, .metric, .notebook { background: var(--paper); }
.homework-page > header {
  border-left: 5px solid var(--blue);
  box-shadow: var(--shadow);
}
.stage-card, .controls-card, .challenge-card, .panel, .metric, .notebook,
.card, .homework-card, .solution-card, .student-card {
  background-color: var(--paper);
}
.stage-card, .controls-card, .challenge-card, .homework-card, .card,
.solution-card, .student-card { border-color: var(--line); }
.stage-card, .controls-card, .challenge-card, .observation-card, .correspond-card {
  background-color: #fff;
}
.relation-banner, .matrix-head, .overlap-status, .observation-head {
  background: #edf2f5; color: #586f7d;
}
.progress .active { background: #fff; color: var(--ink); }
.progress span { border-color: rgba(255, 255, 255, .45); }
.metric.blue { border-top-color: var(--blue); }
.metric.orange { border-top-color: var(--orange); }
.record { background: #e8eff3; color: #496b82; }
.conflict { background: #fff3dd; border-color: #efcf8b; }
.definition {
  background: linear-gradient(135deg, #e9f0f4, #f8fafb);
  border: 1px solid #d8e3e9; color: var(--ink);
}
.definition .first-word, .definition strong { color: #c65f39; }
.correspond-card.active {
  background: #eef3f6; border-color: #9fb5c2;
  box-shadow: 0 7px 20px rgba(85, 120, 143, .10);
}
.correspond-card > span { background: #e7eff3; color: var(--blue); }
.correspond-card.active h3::before { color: var(--brand-green); }
.conclusion.complete { background: #e7f3ed; color: #2f835d; }
.target-dot { stroke: var(--blue); }
.moving-dot { stroke: var(--orange); }
.handle-line, .rotate-handle { stroke: var(--orange); fill: var(--orange); }
.rotate-icon { stroke: white; }
.reference { fill: rgba(85, 120, 143, .56); stroke: var(--blue); }
.record-blue { fill: rgba(85, 120, 143, .56); stroke: var(--blue); }
.experiment, .record-orange { fill: rgba(229, 106, 59, .58); stroke: #c85a32; }
.target-label { fill: #496b82; }
.moving-label { fill: #b4522c; }

.question-row { border-color: var(--line); }
.question-row button { background: #e9f0f4; color: #45677f; }
.draw-toolbar { background: #edf2f5; }
.draw-toolbar button { border-color: #d5e0e5; }
.draw-toolbar button.active {
  background: var(--blue); border-color: var(--blue); color: white;
}
.tool-help {
  margin: 0; padding: 7px 12px; background: #fff3dd; color: #795f31; font-size: 13px;
}
.question-source { border-color: var(--line); }
.homework-card, .homework-card * {
  -webkit-user-select: none;
  user-select: none;
}
.homework-card input, .homework-card textarea {
  -webkit-user-select: text;
  user-select: text;
}
.draw-wrap, .draw-wrap * {
  -webkit-user-select: none;
  user-select: none;
}
.draw-wrap { touch-action: none; }
.draw-canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
}
#overlapSvg {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.student-card.waiting { color: #788892; background: #fff; }
.student-card.done {
  border-color: #9bc9b0; box-shadow: 0 7px 20px rgba(47, 131, 93, .09);
}
.student-card-actions, .question-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.student-card-actions button, .question-actions button { padding: 8px 11px; }
.student-card.has-report { min-height: 210px; }
.archived-questions {
  margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 14px; background: #f3f6f7;
}
.archived-questions > summary { cursor: pointer; color: var(--muted); font-weight: 800; }
.question-row-archived { opacity: .86; }
.archived-badge { background: #e5eaed; color: #657782; }
.review-head, .review-save {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.review-badge {
  padding: 6px 12px; border-radius: 999px; background: #fce9e7; color: #bb403a; font-weight: 800;
}
.review-canvas { height: 600px; }
.review-save { margin-top: 14px; }
.review-save textarea { flex: 1; }
.review-save span { min-width: 90px; }
.solution-card small { color: var(--muted); }
.report-delete-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.report-submit { border-top: 4px solid var(--blue); }
.activity-progress {
  display: inline-block; margin: 0; padding: 8px 12px; border-radius: 10px;
  background: #e9f0f4; color: #496b82; font-weight: 800;
}
.activity-report-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0;
}
.activity-report-card {
  min-width: 0; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 12px; background: #f7f9fa;
}
.activity-report-card h3 { margin: 0 0 8px; color: var(--blue); font-size: 15px; }
.activity-report-card p { margin: 0 0 5px; color: var(--ink); font-weight: 700; }
.activity-report-card small { color: var(--muted); }
.activity-report-card ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.activity-report-card li { margin: 3px 0; }
.danger {
  border: 0; border-radius: 10px; padding: 10px 15px; background: #fce9e7;
  color: #b93f38; font-weight: 800;
}
.danger:hover { background: #f8d9d5; }
.homework-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.homework-header-actions { display: grid; justify-items: end; gap: 8px; }
.sync-notice {
  max-width: 320px; margin: 0; padding: 7px 11px; border-radius: 10px;
  background: #fff3dd; color: #795f31; font-size: 13px; font-weight: 700;
}
.load-error { border-color: #e8aaa5; }
a { color: #496f87; }

dialog { background: #fff; color: var(--ink); }
dialog .close { background: #edf2f5; color: var(--ink); }
.report-table th { background: #edf2f5; }
.report-table td, .report-table th { border-color: var(--line); }
.activity-image-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 12px 0 22px;
}
.activity-image-grid figure {
  min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--line);
  border-radius: 14px; background: #f7f9fa;
}
.activity-image-grid img { display: block; width: 100%; height: auto; border-radius: 8px; }
.activity-image-grid figcaption { padding: 8px 2px 0; color: var(--ink); font-weight: 800; }
.report-thumbnail { display: block; max-width: 680px; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; }
.solution-card { display: flex; flex-direction: column; }
.solution-card-copy { padding: 12px; }
.solution-card-copy p { margin: 8px 0; color: var(--muted); font-size: 13px; }
.solution-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.solution-card-actions button { padding: 8px 10px; }
.review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.review-student-card {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.8fr); gap: 20px;
  padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: white;
}
.review-student-card h2 { margin: 10px 0; }
.review-student-card p { line-height: 1.6; }
.review-student-card figure { margin: 0; }
.review-student-card img { width: 100%; max-height: 540px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; }
.review-student-card figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .activity-image-grid, .review-student-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .brand-lockup img { width: 50px; height: 50px; }
  .brand-lockup b { font-size: 17px; }
  .brand-lockup small { font-size: 11px; }
  .student-bar nav { order: 3; width: 100%; justify-content: center; }
  .student-user { margin-left: auto; }
  .topbar-actions span { display: none; }
  .review-head, .review-save { align-items: stretch; flex-direction: column; }
  .review-actions { align-items: stretch; }
  .review-canvas { height: 480px; }
  .homework-header { align-items: stretch; flex-direction: column; }
  .homework-header-actions { justify-items: start; }
  .report-delete-row { align-items: stretch; flex-direction: column; }
  .question-row { align-items: flex-start; flex-direction: column; }
  .activity-report-grid { grid-template-columns: 1fr; }
}/* v1.6.0: bounded lists and review navigation */
.pagination,.review-navigation{display:flex;align-items:center;justify-content:center;gap:14px;flex-wrap:wrap;margin:20px 0;font-size:14px}
.filter-bar{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;margin:16px 0;padding:16px;background:var(--paper);border:1px solid var(--line);border-radius:14px}
.filter-bar label{margin:0;flex:1;min-width:170px}.filter-bar select{width:100%;padding:11px;border:1px solid var(--line);border-radius:10px;background:white;color:var(--ink);font:inherit}
.is-loading{pointer-events:none;opacity:.6}.question-number{margin-right:6px}.thumbnail-error{padding:18px;min-height:80px}
.review-navigation{justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:16px}.review-navigation span{flex:1;text-align:center;min-width:150px;font-size:13px;color:var(--muted)}
.tool-help a{color:var(--ink);text-decoration:underline}.review-wrap{overflow:hidden}
.review-canvas{height:auto;aspect-ratio:3/2;width:100%;max-height:none}
@media(max-width:560px){.filter-bar{align-items:stretch}.filter-bar label{min-width:100%}.filter-bar button{width:100%}.pagination{gap:8px}.pagination span{font-size:12px}.review-navigation{gap:8px}.review-navigation span{order:3;flex-basis:100%}}
@media(max-width:640px){.hero-panel{flex-direction:column;padding:22px;gap:16px}.hero-panel h1{font-size:26px}.summary{min-width:0;grid-template-columns:auto 1fr;gap:4px 12px}.summary strong{font-size:28px}.teacher-main{width:94vw}.review-head h2{font-size:20px;overflow-wrap:anywhere}dialog{padding:18px}.review-actions button{flex:1}.review-save textarea{width:100%}}
