/* Rehearsal Online Homework — Student Portal & Engine-Reuse Spike Styles
   Loaded after styles.css so VexFlow, OSMD, grading marks, and playhead rules
   stay 100% consistent with the desktop app without modifying styles.css. */

body.hw-page {
  overflow: auto;
  height: auto;
  min-height: 100vh;
  background: #f3f5f9;
  color: #182235;
  --bg: #ffffff;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #182235;
  --muted: #5a6578;
  --line: #dce2ec;
  --accent: #2563eb;
}

.hw-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #142238;
  color: #ffffff;
  padding: 11px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(10, 20, 38, .22);
}

.hw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hw-brand img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.hw-brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.hw-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(96, 165, 250, .2);
  color: #bfdbfe;
  border: 1px solid rgba(147, 197, 253, .35);
  padding: 2px 8px;
  border-radius: 999px;
}

.hw-header-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.hw-chip {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
}

.hw-chip.ok { border-color: rgba(74, 222, 128, .45); color: #bbf7d0; }
.hw-chip.warn { border-color: rgba(251, 191, 36, .6); color: #fde68a; }
.hw-chip-btn {
  cursor: pointer;
  background: rgba(255, 255, 255, .14);
  font-weight: 600;
}
.hw-chip-btn:hover { background: rgba(255, 255, 255, .24); }
.hw-chip-btn.on { background: #2563eb; border-color: #60a5fa; color: #fff; }

.hw-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 18px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Collapsible Teacher Preview Configurator (hidden from students in production; toggleable for testing) */
.hw-teacher-drawer {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hw-teacher-drawer[hidden] { display: none; }
.hw-teacher-drawer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #475569;
}

.hw-teacher-drawer .gr-strict-wrap {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
}

.gr-strict-wrap input[type="range"] {
  accent-color: #2563eb;
  cursor: pointer;
}

.gr-strict-wrap .gr-strict-lbl {
  color: #1d4ed8;
  font-weight: 700;
}

.gr-strict-wrap .gr-strict-info {
  color: #475569;
  font-size: 12px;
}

.hw-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hw-tab {
  border: 1px solid #d5dce8;
  background: #ffffff;
  color: #334155;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .12s, border-color .12s, color .12s;
}

.hw-tab:hover { background: #f8fafc; }
.hw-tab.on {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .24);
}

.hw-card {
  background: #ffffff;
  border: 1px solid #dce2ec;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  overflow: hidden;
}

.hw-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid #e6ebf2;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hw-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.hw-submeta {
  font-size: 13px;
  color: #475569;
  margin-top: 3px;
}

.hw-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.hw-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334155;
}

.hw-controls select,
.hw-controls input[type="number"],
.hw-controls input[type="text"] {
  background: #ffffff;
  color: #182235;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
}

.hw-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #182235;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.hw-btn:hover:not(:disabled) { background: #f1f5f9; }
.hw-btn:disabled { opacity: .48; cursor: not-allowed; }
.hw-btn.primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.hw-btn.primary:hover:not(:disabled) { background: #1d4ed8; }
.hw-btn.danger { background: #dc2626; border-color: #dc2626; color: #ffffff; }
.hw-btn.danger:hover:not(:disabled) { background: #b91c1c; }
.hw-btn.good { background: #15803d; border-color: #15803d; color: #ffffff; }
.hw-btn.good:hover:not(:disabled) { background: #166534; }
.hw-btn.pitch { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.hw-btn.pitch:hover:not(:disabled) { background: #dbeafe; }

/* Clean Student Action Bar */
.hw-student-bar {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid #e6ebf2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hw-student-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hw-zoom-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}
.hw-zoom-pill button {
  border: 0;
  background: transparent;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #334155;
}
.hw-zoom-pill button:hover { background: #e2e8f0; }

/* Mounted engine host containers */
.hw-stage {
  position: relative;
  height: 440px;
  min-height: 360px;
  background: #ffffff;
}

/* When Teacher Setup is open, expand stage so full Rehearsal Settings panels fit comfortably */
.hw-teacher-mode .hw-stage {
  height: 680px;
  min-height: 540px;
}

.hw-stage .sr-host,
.hw-stage .score-host {
  position: absolute;
  inset: 0;
}

.hw-submit-banner {
  padding: 11px 18px;
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  color: #166534;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.hw-submit-banner.draft {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #1e3a8a;
}

.hw-pill.submitted {
  background: #15803d;
  color: #ffffff;
}

.hw-pill.draft {
  background: #e2e8f0;
  color: #334155;
}

/* STUDENT VIEW: hide teacher-only authoring & classroom toolbars inside mounted engines */
.hw-student-view .sr-top,
.hw-student-view .sr-sub,
.hw-student-view .sr-settings,
.hw-student-view .sr-build,
.hw-student-view .sp-top,
.hw-student-view .sp-sub,
.hw-student-view .sp-choir,
.hw-student-view .sp-settings,
.hw-student-view .sp-spots,
.hw-student-view .sp-custom {
  display: none !important;
}

.hw-student-view .sr-staff {
  margin: 10px 14px 14px;
}

.hw-student-view .sp-score {
  margin: 8px 12px 12px;
}

/* True Sight-Read study bar & cover */
.hw-study-bar {
  padding: 12px 18px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #78350f;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.hw-study-bar[hidden] { display: none; }

.hw-study-bar.live {
  background: #fef2f2;
  border-bottom-color: #fecaca;
  color: #991b1b;
}

.hw-study-bar.done {
  background: #f0fdf4;
  border-bottom-color: #bbf7d0;
  color: #166534;
}

.hw-study-bar.done .hw-study-timer {
  color: #15803d;
}

.hw-study-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hw-study-timer {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  min-width: 58px;
}

.hw-study-bar.live .hw-study-timer {
  color: #dc2626;
}

.hw-study-pitches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hw-study-cover {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(248, 250, 252, .97);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px;
}

.hw-study-cover h3 { margin: 0; font-size: 21px; color: #0f172a; }
.hw-study-cover p { margin: 0; max-width: 500px; color: #475569; font-size: 14px; line-height: 1.55; }

/* Mandatory Session Audio Sync Gate Modal */
.hw-sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.hw-sync-overlay[hidden] { display: none; }

.hw-sync-card {
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 500px;
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.hw-sync-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.hw-sync-card p {
  margin: 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

.hw-sync-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.hw-sync-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: transform .1s, background .1s;
}

.hw-sync-dot.lead { background: #fef08a; border: 1px solid #eab308; }
.hw-sync-dot.lead.active { background: #eab308; transform: scale(1.25); }
.hw-sync-dot.tap.active { background: #2563eb; transform: scale(1.3); }
.hw-sync-dot.done { background: #22c55e; }

.hw-sync-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 12px;
  color: var(--muted, #475569);
}
.hw-sync-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hw-dot-sample { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e2e8f0; }
.hw-dot-sample.lead { background: #fef08a; border: 1px solid #eab308; }
.hw-dot-sample.tap { background: #cbd5e1; border: 1px solid #94a3b8; }

.hw-sync-pad {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 4px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
  touch-action: manipulation;
  transition: transform .06s, background .08s;
}

.hw-sync-pad small { font-size: 11px; font-weight: 600; color: #3b82f6; }
.hw-sync-pad:disabled { opacity: .45; cursor: not-allowed; }
.hw-sync-pad.hit { transform: scale(.93); background: #2563eb; color: #ffffff; }
.hw-sync-pad.hit small { color: #dbeafe; }

.hw-sync-status {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  min-height: 22px;
}

/* Audio-Only Recorder Panel */
.hw-audio-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hw-audio-prompt {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #334155;
}

.hw-wave-box {
  position: relative;
  background: #0f172a;
  border-radius: 12px;
  height: 130px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hw-wave-box canvas { width: 100%; height: 100%; display: block; }

.hw-rec-time {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(15, 23, 42, .8);
  color: #f8fafc;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hw-rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-right: 6px;
  animation: hwPulse 1s infinite;
}

@keyframes hwPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.hw-level-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #475569;
}

.hw-level-bar {
  flex: 1;
  max-width: 260px;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.hw-level-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308 75%, #ef4444);
  transition: width .06s linear;
}

/* Saved Takes Drawer */
.hw-takes-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hw-take-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hw-take-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hw-take-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #475569;
}

.hw-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
}

.hw-pill.score { background: #dcfce7; color: #166534; }
.hw-pill.flag { background: #fef3c7; color: #92400e; }
.hw-pill.offline { background: #dbeafe; color: #1e40af; }
.hw-pill.queued { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.hw-pill.locked { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.hw-pill.type { background: #eff6ff; color: #1d4ed8; }
.hw-pill.truesr { background: #fef3c7; color: #92400e; }

.hw-chip-btn.offline-on {
  background: #d97706;
  border-color: #fbbf24;
  color: #ffffff;
}

.hw-take-audio { width: 100%; height: 36px; }

.hw-json-pre {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hw-empty {
  padding: 24px 16px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

/* ---------- Milestone 3: Offline Banner, Student Sign-In, Assignment List, Back Bar */
[hidden] { display: none !important; }

.hw-offline-banner {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 16px;
  color: #78350f;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(217, 119, 6, .12);
}

.hw-auth-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0 32px;
}

.hw-auth-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #dce2ec;
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .08);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hw-auth-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.hw-auth-head p {
  margin: 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

.hw-auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.hw-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hw-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.hw-field input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  box-sizing: border-box;
}

.hw-field input:focus {
  outline: 2px solid #93c5fd;
  border-color: #2563eb;
}

.hw-code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px !important;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}

.hw-auth-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.hw-btn-full {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 14px;
}

.hw-btn-google {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.hw-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.hw-divider::before,
.hw-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.hw-google-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hw-google-classes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

.hw-demo-bar {
  background: #f0f9ff;
  border: 1px dashed #7dd3fc;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: #0369a1;
}

.hw-demo-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* My Assignments List */
.hw-list-head {
  background: #ffffff;
  border: 1px solid #dce2ec;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}

.hw-list-head h2 {
  margin: 0 0 3px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.hw-asgn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.hw-asgn-card {
  background: #ffffff;
  border: 1px solid #dce2ec;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.hw-asgn-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hw-asgn-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.hw-asgn-desc {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}

.hw-asgn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--muted, #64748b);
}
.hw-asgn-meta .hw-meta-dot::before {
  content: '·';
  margin-right: 10px;
  opacity: .75;
}

.hw-asgn-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line, #e2e8f0);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hw-asgn-foot .hw-asgn-file {
  flex: 1 1 140px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hw-asgn-foot .hw-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.hw-empty-card {
  grid-column: 1 / -1;
  background: var(--card, #fff);
  border: 1px solid var(--line, #dce2ec);
  border-radius: 14px;
}

.hw-part-select {
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--card, #fff);
  color: var(--text, #182235);
}

.hw-teacher-feedback {
  background: rgba(37, 99, 235, .07);
  border: 1px solid rgba(37, 99, 235, .24);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text, #1e293b);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (prefers-color-scheme: dark) {
  body.hw-page {
    background: #0f172a;
    color: #e2e8f0;
    --bg: #0f172a;
    --surface: #162032;
    --card: #162032;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #2b384f;
    --accent: #60a5fa;
  }
  body.hw-page .hw-card,
  body.hw-page .hw-auth-card,
  body.hw-page .hw-list-head,
  body.hw-page .hw-asgn-card,
  body.hw-page .hw-back-bar,
  body.hw-page .hw-sync-card,
  body.hw-page .hw-study-cover,
  body.hw-page .hw-empty-card {
    background: #162032;
    border-color: #2b384f;
    color: #e2e8f0;
  }
  body.hw-page .hw-card-head,
  body.hw-page .hw-student-bar,
  body.hw-page .hw-audio-prompt,
  body.hw-page .hw-teacher-drawer {
    background: #1b273c;
    border-color: #2b384f;
    color: #e2e8f0;
  }
  body.hw-page .hw-card-head h2,
  body.hw-page .hw-auth-head h2,
  body.hw-page .hw-list-head h2,
  body.hw-page .hw-asgn-card h3,
  body.hw-page .hw-back-title,
  body.hw-page .hw-sync-status,
  body.hw-page .hw-study-cover h3 {
    color: #f1f5f9;
  }
  body.hw-page .hw-submeta,
  body.hw-page .hw-auth-head p,
  body.hw-page .hw-field,
  body.hw-page .hw-asgn-desc,
  body.hw-page .hw-sync-card p,
  body.hw-page .hw-study-cover p,
  body.hw-page .hw-controls label {
    color: #cbd5e1;
  }
  body.hw-page .hw-field input,
  body.hw-page .hw-controls select,
  body.hw-page .hw-controls input[type="number"],
  body.hw-page .hw-controls input[type="text"],
  body.hw-page .hw-part-select,
  body.hw-page .hw-btn:not(.primary):not(.danger):not(.good) {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
  }
  body.hw-page .hw-sync-pad {
    background: #172554;
    border-color: #60a5fa;
    color: #dbeafe;
  }
  body.hw-page .hw-teacher-feedback {
    background: rgba(96, 165, 250, .12);
    border-color: rgba(96, 165, 250, .35);
    color: #e2e8f0;
  }
  body.hw-page .hw-auth-err {
    background: #3f1818;
    border-color: #7f1d1d;
    color: #fecaca;
  }
}

/* Runner workspace back bar */
#hw-runner-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hw-back-bar {
  background: #ffffff;
  border: 1px solid #dce2ec;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hw-back-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
  min-width: 180px;
}

@media (max-width: 720px) {
  .hw-header { padding: 10px 14px; }
  .hw-main { padding: 12px 10px 44px; }
  .hw-stage { height: 400px; }
  .hw-field-row { grid-template-columns: 1fr; }
}
