/* ============================================================
   LexChem Homework Practice pages (vanilla, no build step)
   Brand tokens mirror public/css/style.css.
   ============================================================ */
:root {
  --hw-primary: #0F5C97;
  --hw-primary-dark: #0B4570;
  --hw-accent: #2FA84F;
  --hw-bg: #F5F7F9;
  --hw-card: #FFFFFF;
  --hw-text: #1B2430;
  --hw-muted: #667085;
  --hw-border: #E3E8EE;
  --hw-danger: #D64545;
  --hw-warn-bg: #FEF3F2;
  --hw-ok-bg: #EDF9F0;
}

.hw-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--hw-bg);
  color: var(--hw-text);
  margin: 0;
  min-height: 100vh;
}

.hw-topbar {
  background: var(--hw-card);
  border-bottom: 1px solid var(--hw-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hw-brand {
  font-weight: 800;
  font-size: 20px;
  color: var(--hw-primary);
  text-decoration: none;
}
.hw-topbar .hw-lesson-tag {
  font-size: 13px;
  color: var(--hw-muted);
}

.hw-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hw-intro h1 { font-size: 24px; margin: 8px 0 6px; }
.hw-intro p { color: var(--hw-muted); margin: 4px 0 18px; }

.hw-card {
  background: var(--hw-card);
  border: 1px solid var(--hw-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.hw-progress {
  height: 6px;
  background: var(--hw-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.hw-progress-fill {
  height: 100%;
  background: var(--hw-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.hw-qcount { font-size: 12px; color: var(--hw-muted); margin-bottom: 10px; }
.hw-cat {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--hw-primary-dark);
  background: #E8F1F8;
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}
.hw-prompt { font-size: 18px; line-height: 1.55; margin-bottom: 14px; }
.hw-prompt .hw-blist { margin: 8px 0; padding-left: 24px; }
.hw-quote {
  display: inline-block;
  background: #F8FAFC;
  border-left: 3px solid var(--hw-primary);
  padding: 8px 12px;
  margin: 8px 0;
  font-style: italic;
}

/* figures */
.hw-fig { margin: 6px 0 16px; text-align: center; }
.hw-fig-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hw-mol-card {
  border: 2px solid var(--hw-border);
  border-radius: 12px;
  padding: 10px 14px 6px;
  background: #FBFCFE;
}
.hw-mol-card-cap { font-size: 11px; color: var(--hw-muted); margin-top: 2px; }
.hw-mol-sep { width: 14px; }
.hw-mol-label-chip {
  display: inline-block;
  font-weight: 800;
  font-size: 18px;
  border: 2px dashed var(--hw-danger);
  color: var(--hw-danger);
  border-radius: 8px;
  padding: 2px 14px;
  margin-bottom: 8px;
}
.hw-mol { display: inline-block; vertical-align: middle; }

/* choices */
.hw-options { display: grid; gap: 10px; margin-top: 6px; }
.hw-opt {
  text-align: left;
  font-size: 16px;
  padding: 12px 16px;
  border: 2px solid var(--hw-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  color: var(--hw-text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.hw-opt:hover { border-color: var(--hw-primary); background: #F4F9FD; }
.hw-opt-molbtn { display: flex; align-items: center; justify-content: center; padding: 10px; }
.hw-opt-correct { border-color: var(--hw-accent) !important; background: var(--hw-ok-bg) !important; }
.hw-opt-wrong-pick { border-color: var(--hw-danger) !important; background: var(--hw-warn-bg) !important; }

/* numeric */
.hw-numeric-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.hw-num {
  width: 110px;
  font-size: 20px;
  padding: 10px 12px;
  border: 2px solid var(--hw-border);
  border-radius: 10px;
  text-align: center;
  font-family: inherit;
}
.hw-num:focus { outline: none; border-color: var(--hw-primary); }

/* buttons */
.hw-btn {
  font-size: 15px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 10px;
  border: 2px solid var(--hw-border);
  background: #fff;
  color: var(--hw-text);
  cursor: pointer;
  font-family: inherit;
}
.hw-btn-primary {
  background: var(--hw-primary);
  border-color: var(--hw-primary);
  color: #fff;
}
.hw-btn-primary:hover { background: var(--hw-primary-dark); }
.hw-btn:disabled { opacity: 0.55; cursor: default; }
.hw-actions { margin-top: 18px; }
.hw-actions-row { display: flex; gap: 10px; margin-top: 16px; }
.hw-hint { font-size: 13px; color: var(--hw-muted); margin-top: 10px; }

/* feedback */
.hw-feedback {
  margin-top: 16px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.5;
}
.hw-fb-ok { background: var(--hw-ok-bg); border: 1px solid #BFE6C9; }
.hw-fb-wrong { background: var(--hw-warn-bg); border: 1px solid #F5C6C2; }
.hw-fb-title { font-weight: 800; margin-bottom: 4px; }
.hw-fb-ok .hw-fb-title { color: #1C7A34; }
.hw-fb-wrong .hw-fb-title { color: var(--hw-danger); }

/* match / drag */
.hw-match-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.hw-match-col { display: grid; gap: 10px; align-content: start; }
.hw-token {
  border: 2px solid var(--hw-border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}
.hw-token:hover { border-color: var(--hw-primary); }
.hw-token.hw-selected { border-color: var(--hw-primary); background: #E8F1F8; }
.hw-token.hw-docked { border-style: dashed; cursor: default; }
.hw-token-text { display: block; margin-bottom: 4px; }
.hw-match-target {
  border: 2px dashed var(--hw-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #FBFCFE;
  text-align: center;
  min-height: 64px;
  cursor: pointer;
}
.hw-match-target .hw-paired-slot { display: block; margin-top: 6px; min-height: 4px; }
.hw-match-target .hw-paired-slot .hw-token { margin: 0; }
.hw-pair-ok { border-color: var(--hw-accent) !important; border-style: solid !important; background: var(--hw-ok-bg); }
.hw-pair-bad { border-color: var(--hw-danger) !important; border-style: solid !important; background: var(--hw-warn-bg); }
.hw-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.92;
  margin: 0;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.25);
}

/* match3 */
.hw-m3-head, .hw-m3-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
}
.hw-m3-head { font-size: 13px; font-weight: 700; color: var(--hw-muted); text-align: center; }
.hw-m3-fixed {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  border: 2px solid var(--hw-primary);
  border-radius: 10px;
  background: #EFF6FC;
  padding: 8px;
}
.hw-m3-slot {
  border: 2px dashed var(--hw-border);
  border-radius: 10px;
  background: #FBFCFE;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
}
.hw-m3-slot-label { font-size: 11px; color: var(--hw-muted); }
.hw-m3-slot .hw-token { width: 100%; box-sizing: border-box; }
.hw-m3-trays { display: grid; gap: 10px; margin-top: 14px; }
.hw-tray {
  display: flex; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--hw-border);
  border-radius: 10px;
  padding: 10px;
  background: #F8FAFC;
  min-height: 60px;
}
.hw-tray .hw-token { flex: 1 1 120px; }

/* dragslot */
.hw-ds-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hw-ds-slot {
  border: 2px solid var(--hw-border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  background: #fff;
}
.hw-ds-label { font-size: 13px; color: var(--hw-muted); margin-bottom: 6px; }
.hw-ds-drop { margin-top: 8px; min-height: 52px; display: flex; align-items: center; justify-content: center; }
.hw-ds-ph { font-size: 13px; color: #A6B0BE; border: 2px dashed var(--hw-border); border-radius: 8px; padding: 8px 14px; }
.hw-ds-drop .hw-token { width: 100%; box-sizing: border-box; }

/* sort */
.hw-sort-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hw-sort-card {
  flex: 1 1 140px;
  border: 2px solid var(--hw-border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
.hw-sort-card .hw-token-text { font-size: 18px; font-weight: 800; }
.hw-sort-arrows { position: absolute; top: 4px; right: 6px; display: flex; gap: 2px; }
.hw-sort-arrows button {
  border: 1px solid var(--hw-border);
  background: #F8FAFC;
  border-radius: 6px;
  width: 24px; height: 24px;
  font-size: 14px; line-height: 1;
  cursor: pointer;
  color: var(--hw-primary);
  font-weight: 800;
}

/* multistep */
.hw-stepcount { font-size: 13px; font-weight: 700; color: var(--hw-primary-dark); margin-bottom: 8px; }
.hw-step-prompt { font-size: 16px; margin-bottom: 10px; }

/* completion */
.hw-done { text-align: center; padding: 40px 24px; }
.hw-done-check {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--hw-accent);
  color: #fff;
  font-size: 34px;
  line-height: 64px;
}
.hw-done h2 { margin: 0 0 10px; }
.hw-done-sub { color: var(--hw-muted); margin-bottom: 6px; }
.hw-done-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.hw-done-list li {
  background: #EFF6FC;
  color: var(--hw-primary-dark);
  font-size: 13px; font-weight: 700;
  border-radius: 999px;
  padding: 5px 14px;
}

/* self-test output */
#selftest-results { font-family: monospace; font-size: 13px; white-space: pre-wrap; }

/* tablet / small screens */
@media (max-width: 640px) {
  .hw-card { padding: 18px 14px; }
  .hw-prompt { font-size: 16px; }
  .hw-match-wrap { grid-template-columns: 1fr; }
  .hw-ds-slots { grid-template-columns: 1fr; }
  .hw-m3-head, .hw-m3-row { grid-template-columns: 84px 1fr 1fr; gap: 6px; }
  .hw-m3-fixed { font-size: 16px; }
  .hw-numeric-row { flex-wrap: wrap; }
}

/* ---- Concept badges (shared: demo review page + classroom demos) ---- */
.concept-legend{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 4px}
.concept-chip{display:inline-flex;align-items:center;gap:8px;border-radius:999px;padding:6px 14px;font-size:.92rem;font-weight:600;color:#fff}
.concept-chip small{font-weight:400;opacity:.9}
.concept-badges{display:flex;gap:6px;flex-wrap:wrap}
.concept-badge{display:inline-block;border-radius:999px;padding:1px 10px;font-size:.8em;font-weight:700;color:#fff;white-space:nowrap;vertical-align:baseline}
.c-element{background:#7c5cd6}.c-formula{background:#2b7de9}.c-composition{background:#c0457c}
.c-atom{background:#0e9f8a}.c-molecule{background:#e07b39}.c-model{background:#546e7a}

.hw-brand { display: flex; align-items: center; gap: 8px; }
.hw-logo { width: 32px; height: 32px; }
.hw-brand .chem-orange { color: #e67e22; }
