/* ═══════════════════════════════════════════════════════════
   Worksheet Maker Pro — v3 (inline rendering, px-based sizing)
   ═══════════════════════════════════════════════════════════ */

/* Force our own context — isolated from theme CSS */
#wmp-app {
  --p:   #b8391e;
  --a:   #d4872a;
  --ink: #1c1410;
  --bg:  #f0ebe0;
  --sb:  #e8e2d4;
  --card:#ffffff;
  --bdr: #d0c8b0;
  --mut: #7a6d5a;
  --lt:  #f8f4ee;
  --grn: #2e7d32;

  all: initial;               /* reset inherited theme styles */
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  color: #1c1410 !important;
  background: #f0ebe0 !important;
  box-sizing: border-box !important;
  -webkit-font-smoothing: antialiased;
}

/* Box-sizing reset for all children */
#wmp-app *, #wmp-app *::before, #wmp-app *::after {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
}

/* ── Topbar ─────────────────────────────────── */
#wmp-app .wmp-topbar {
  height: 56px;
  background: #1c1410;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 3px solid #d4872a;
  position: sticky;
  top: 0;
  z-index: 9999;
}
#wmp-app .wmp-topbar-left { display: flex; align-items: center; gap: 12px; }
#wmp-app .wmp-logo        { font-size: 16px !important; font-weight: 700; color: #fff; }
#wmp-app .wmp-badge {
  background: #d4872a; color: #fff;
  font-size: 10px !important; font-weight: 800; letter-spacing: 1.5px;
  padding: 2px 9px; border-radius: 20px; text-transform: uppercase;
}
#wmp-app .wmp-topbar-right { display: flex; gap: 8px; }
#wmp-app .wmp-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: #fff; border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px !important; font-weight: 600; cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
#wmp-app .wmp-btn:hover { border-color: #d4872a; color: #d4872a; }
#wmp-app .wmp-btn-primary { background: #b8391e; border-color: #b8391e; }
#wmp-app .wmp-btn-primary:hover { background: #9e2f18; color: #fff; border-color: #9e2f18; }

/* ── Layout ─────────────────────────────────── */
#wmp-app .wmp-layout {
  display: flex;
  height: calc(100vh - 59px);
  min-height: 640px;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
#wmp-app .wmp-sidebar {
  width: 340px;
  min-width: 340px;
  background: #e8e2d4;
  border-right: 1.5px solid #d0c8b0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
#wmp-app .wmp-section {
  padding: 12px 14px;
  border-bottom: 1px solid #d0c8b0;
}
#wmp-app .wmp-section-last {
  border-bottom: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 16px;
}
#wmp-app .wmp-label {
  display: block;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #7a6d5a;
  margin-bottom: 7px;
}

/* ── Inputs ─────────────────────────────────── */
#wmp-app input[type=text],
#wmp-app input[type=number],
#wmp-app input[type=password],
#wmp-app textarea,
#wmp-app select {
  width: 100%;
  background: #fff;
  border: 1.5px solid #d0c8b0;
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 14px !important;
  color: #1c1410;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
}
#wmp-app input:focus,
#wmp-app textarea:focus,
#wmp-app select:focus {
  border-color: #b8391e;
  box-shadow: 0 0 0 3px rgba(184,57,30,0.12);
}
#wmp-app textarea {
  resize: vertical;
  font-size: 13px !important;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
}
#wmp-app #wmp-curriculum { min-height: 130px; }
#wmp-app #wmp-topic { font-size: 15px !important; text-align: center; }

/* ── Output type switcher ─────────────────── */
#wmp-app .wmp-output-switcher { display: flex; gap: 8px; }
#wmp-app .wmp-out-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 6px; background: #fff;
  border: 2px solid #d0c8b0; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
#wmp-app .wmp-out-btn:hover { border-color: #b8391e; }
#wmp-app .wmp-out-btn.active { border-color: #b8391e; background: #fff5f3; box-shadow: 0 0 0 2px rgba(184,57,30,0.15); }
#wmp-app .wmp-out-icon  { font-size: 20px !important; line-height: 1; }
#wmp-app .wmp-out-label { font-size: 12px !important; font-weight: 700; color: #1c1410; }
#wmp-app .wmp-out-btn.active .wmp-out-label { color: #b8391e; }
#wmp-app .wmp-out-sub   { font-size: 10px !important; color: #7a6d5a; }

/* QP extra options */
#wmp-app .wmp-qp-opts textarea { min-height: 52px; }

/* ── Topic box ───────────────────────────── */
#wmp-app .wmp-topic-box {
  background: #fff;
  border: 1.5px solid #d0c8b0;
  border-radius: 8px;
  padding: 18px 14px;
  text-align: center;
}
#wmp-app .wmp-topic-icon { font-size: 28px !important; margin-bottom: 8px; display: block; }

/* ── API key ─────────────────────────────── */
#wmp-app .wmp-api-row { display: flex; gap: 6px; }
#wmp-app .wmp-api-row input { flex: 1; font-family: monospace; }
#wmp-app .wmp-toggle-key {
  background: #f8f4ee; border: 1.5px solid #d0c8b0;
  border-radius: 6px; padding: 0 12px; cursor: pointer;
  font-size: 12px !important; color: #7a6d5a; font-family: inherit;
  white-space: nowrap;
}
#wmp-app .wmp-toggle-key:hover { border-color: #b8391e; }
#wmp-app .wmp-api-status { display: none; margin-top: 5px; font-size: 12px !important; font-family: monospace; padding: 4px 8px; border-radius: 4px; }
#wmp-app .wmp-api-status.ok  { display: block; background: #e8f5e9; color: #2e7d32; }
#wmp-app .wmp-api-status.err { display: block; background: #fdecea; color: #b8391e; }
#wmp-app .wmp-hint { font-size: 11px !important; color: #7a6d5a; margin-top: 5px; line-height: 1.5; }

/* ── Tabs ────────────────────────────────── */
#wmp-app .wmp-tabs {
  display: flex;
  border: 1.5px solid #d0c8b0;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
}
#wmp-app .wmp-tab {
  flex: 1; padding: 9px 3px;
  background: #fff; border: none;
  border-right: 1px solid #d0c8b0;
  cursor: pointer;
  font-size: 11px !important; font-weight: 700;
  color: #7a6d5a; font-family: inherit;
  line-height: 1;
}
#wmp-app .wmp-tab:last-child { border-right: none; }
#wmp-app .wmp-tab.active { background: #b8391e; color: #fff; }
#wmp-app .wmp-panel { display: none; }
#wmp-app .wmp-panel.active { display: block; }

/* ── Drop zone ───────────────────────────── */
#wmp-app .wmp-dz {
  border: 2px dashed #d0c8b0;
  border-radius: 7px; background: #fff;
  padding: 22px 12px; text-align: center;
  cursor: pointer; position: relative;
}
#wmp-app .wmp-dz:hover { border-color: #b8391e; }
#wmp-app .wmp-dz input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
#wmp-app .wmp-dz-icon  { font-size: 24px !important; margin-bottom: 6px; display: block; }
#wmp-app .wmp-dz-label { font-size: 13px !important; color: #7a6d5a; }
#wmp-app .wmp-dz-label b { color: #b8391e; }
#wmp-app .wmp-dz small  { font-size: 11px !important; color: #aaa; margin-top: 4px; display: block; }
#wmp-app .wmp-fstat { display: none; margin-top: 6px; padding: 5px 10px; border-radius: 4px; font-size: 12px !important; font-family: monospace; }
#wmp-app .wmp-fstat.ok   { display: block; background: #e8f5e9; color: #2e7d32; }
#wmp-app .wmp-fstat.err  { display: block; background: #fdecea; color: #b8391e; }
#wmp-app .wmp-fstat.wait { display: block; background: #fff8e6; color: #d4872a; }
#wmp-app .wmp-wc-row { display: flex; justify-content: space-between; margin-top: 5px; }
#wmp-app .wmp-wc     { font-size: 11px !important; font-family: monospace; color: #7a6d5a; }
#wmp-app .wmp-wc.good { color: #2e7d32; }
#wmp-app .wmp-wc.warn { color: #d4872a; }

/* ── Pills ───────────────────────────────── */
#wmp-app .wmp-pills { display: flex; flex-wrap: wrap; gap: 5px; }
#wmp-app .wmp-pill {
  padding: 5px 11px; border-radius: 20px;
  border: 1.5px solid #d0c8b0; background: #fff;
  font-size: 12px !important; font-weight: 600;
  cursor: pointer; color: #7a6d5a;
  line-height: 1;
}
#wmp-app .wmp-pill.active { background: #1c1410; color: #fff; border-color: #1c1410; }

/* ── Difficulty ──────────────────────────── */
#wmp-app .wmp-diff-row { display: flex; gap: 4px; }
#wmp-app .wmp-diff {
  flex: 1; padding: 7px 4px; text-align: center;
  border-radius: 5px; border: 1.5px solid #d0c8b0;
  background: #fff; cursor: pointer;
  font-size: 11px !important; font-weight: 700; color: #7a6d5a;
}
#wmp-app .wmp-diff.active { background: #b8391e; color: #fff; border-color: #b8391e; }
#wmp-app .wmp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Checkboxes ──────────────────────────── */
#wmp-app .wmp-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
#wmp-app .wmp-chk {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-size: 13px !important;
  padding: 7px 9px; background: #fff;
  border-radius: 5px; border: 1.5px solid #d0c8b0;
  line-height: 1;
}
#wmp-app .wmp-chk:hover { border-color: #b8391e; }
#wmp-app .wmp-chk input { accent-color: #b8391e; width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
#wmp-app .wmp-chk.on { border-color: #b8391e; background: #fff5f3; }
#wmp-app .wmp-options-stack { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
#wmp-app .wmp-inline-chk { display: flex; align-items: center; gap: 8px; font-size: 13px !important; cursor: pointer; }
#wmp-app .wmp-inline-chk input { accent-color: #b8391e; width: 14px; height: 14px; }

/* ── Generate button ─────────────────────── */
#wmp-app .wmp-gen-btn {
  width: 100%; padding: 15px;
  background: linear-gradient(135deg, #b8391e, #d4872a);
  color: #fff; border: none; border-radius: 8px;
  font-size: 16px !important; font-weight: 700;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 3px 12px rgba(184,57,30,0.35);
  line-height: 1;
}
#wmp-app .wmp-gen-btn:hover { opacity: 0.9; }
#wmp-app .wmp-gen-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#wmp-app .wmp-spinner {
  width: 18px; height: 18px; display: none;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
}
#wmp-app .wmp-spinning { display: inline-block !important; animation: wmp-spin 0.7s linear infinite; }
@keyframes wmp-spin { to { transform: rotate(360deg); } }

#wmp-app .wmp-mode-bar  { font-size: 11px !important; text-align: center; margin-top: 8px; color: #7a6d5a; }
#wmp-app .wmp-mode-ai   { color: #2e7d32; font-weight: 700; }
#wmp-app .wmp-mode-local{ color: #d4872a; font-weight: 700; }

/* ── Output pane ─────────────────────────── */
#wmp-app .wmp-outpane {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  background: #f0ebe0;
  min-width: 0;
}
#wmp-app .wmp-out-hdr {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
#wmp-app .wmp-out-hdr h2 { font-size: 15px !important; color: #7a6d5a; font-weight: 500; margin: 0; }
#wmp-app .wmp-out-actions { display: flex; gap: 8px; }
#wmp-app .wmp-action-btn {
  background: #1c1410; color: #fff;
  border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 13px !important;
  font-weight: 600; cursor: pointer; font-family: inherit;
}
#wmp-app .wmp-action-btn:hover { background: #b8391e; }

/* Stats bar */
#wmp-app .wmp-stats { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
#wmp-app .wmp-stat {
  background: #1c1410; color: #fff;
  border-radius: 20px; padding: 4px 13px;
  font-size: 11px !important; font-weight: 700;
}
#wmp-app .wmp-stat.green { background: #2e7d32; }
#wmp-app .wmp-stat.gold  { background: #d4872a; }

/* Thinking */
#wmp-app .wmp-thinking {
  display: none; background: #fff;
  border: 1.5px solid #d0c8b0; border-radius: 10px;
  padding: 48px; text-align: center;
}
#wmp-app .wmp-thinking.active { display: block; }
#wmp-app .wmp-think-dots { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
#wmp-app .wmp-dot {
  width: 10px; height: 10px; background: #d4872a;
  border-radius: 50%; animation: wmp-bounce 1.2s ease infinite;
}
#wmp-app .wmp-dot:nth-child(2) { animation-delay: 0.2s; background: #b8391e; }
#wmp-app .wmp-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes wmp-bounce {
  0%,80%,100% { transform: translateY(0); opacity: 0.5; }
  40%          { transform: translateY(-10px); opacity: 1; }
}
#wmp-app .wmp-think-label { font-size: 14px !important; color: #7a6d5a; font-style: italic; }

/* Empty state */
#wmp-app .wmp-empty { text-align: center; padding: 72px 24px; color: #7a6d5a; }
#wmp-app .wmp-empty-icon  { font-size: 52px !important; opacity: 0.2; margin-bottom: 16px; display: block; }
#wmp-app .wmp-empty-title { font-size: 18px !important; font-weight: 600; margin-bottom: 8px; }
#wmp-app .wmp-empty-hint  { font-size: 14px !important; color: #aaa; line-height: 1.8; }

/* Branding */
#wmp-app .wmp-branding { text-align: center; font-size: 11px !important; color: #ccc; padding: 8px; }

/* ═══════════════════════════════════════════════
   THE WHITE WORKSHEET SHEET — spacious & polished
   ═══════════════════════════════════════════════ */

#wmp-app .wmp-sheet {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 56px 64px;           /* generous breathing room */
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 4px 30px rgba(0,0,0,0.09);
  font-size: 15px !important;
  line-height: 1.6;
}

/* ── Worksheet header ── */
#wmp-app .wmp-ws-eyebrow {
  font-size: 11px !important; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase;
  color: #7a6d5a; margin-bottom: 8px;
}
#wmp-app .wmp-ws-title {
  font-size: 32px !important; font-weight: 800;
  letter-spacing: -0.5px; line-height: 1.2;
  color: #1c1410; margin-bottom: 6px;
}
#wmp-app .wmp-ws-sub {
  font-size: 14px !important; color: #7a6d5a; margin-bottom: 20px;
}
#wmp-app .wmp-ws-rule {
  height: 4px;
  background: linear-gradient(90deg, #1c1410, #d4872a, transparent);
  border: none; border-radius: 2px;
  margin-bottom: 28px;
}

/* Student info row */
#wmp-app .wmp-ws-meta {
  display: flex; flex-wrap: wrap;
  gap: 0 32px; margin-bottom: 40px;
}
#wmp-app .wmp-ws-field {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #eee;
  min-width: 200px; flex: 1;
}
#wmp-app .wmp-ws-field label {
  font-size: 11px !important; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: #7a6d5a; white-space: nowrap;
}
#wmp-app .wmp-fl {
  flex: 1; border-bottom: 1.5px solid #1c1410; height: 22px;
}

/* ── Sections ── */
#wmp-app .wmp-ws-section { margin-bottom: 44px; }    /* was tight — now roomy */

#wmp-app .wmp-sec-hdr {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
#wmp-app .wmp-sec-n {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1c1410; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px !important; font-weight: 800; flex-shrink: 0;
}
#wmp-app .wmp-sec-name { font-size: 16px !important; font-weight: 800; }
#wmp-app .wmp-sec-pts  { margin-left: auto; font-size: 12px !important; color: #7a6d5a; font-weight: 600; }
#wmp-app .wmp-sec-rule {
  border: none; border-top: 2px solid #f0ebe0;
  margin: 10px 0 18px;                               /* more breathing room */
}
#wmp-app .wmp-sec-inst {
  font-size: 13px !important; color: #555; font-style: italic;
  background: #f8f4ee;
  border-left: 4px solid #d4872a;
  padding: 9px 14px; border-radius: 0 5px 5px 0;
  margin-bottom: 20px;                               /* more space before questions */
  line-height: 1.6;
}

/* ── Individual questions ── */
#wmp-app .wmp-q { margin-bottom: 28px; }             /* was tiny — now spacious */

#wmp-app .wmp-q-row {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 12px;
}
#wmp-app .wmp-q-n {
  width: 28px; height: 28px; flex-shrink: 0;
  border: 2px solid #1c1410; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px !important; font-weight: 800;
}
#wmp-app .wmp-q-text {
  font-size: 15px !important; line-height: 1.7; flex: 1;
}
#wmp-app .wmp-q-marks {
  min-width: 70px; text-align: right;
  font-size: 12px !important; color: #7a6d5a;
  flex-shrink: 0; border-left: 1px dashed #ddd;
  padding-left: 12px; padding-top: 4px;
}

/* MC options — 2-col grid, properly spaced */
#wmp-app .wmp-mc-opts {
  margin-left: 40px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 24px; margin-top: 8px;
}
#wmp-app .wmp-mc-opt {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px !important; line-height: 1.55;
}
#wmp-app .wmp-mc-circle {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 1.5px solid #999; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px !important; font-weight: 700; color: #888;
  margin-top: 1px;
}

/* Fill-in-blank */
#wmp-app .wmp-blank {
  display: inline-block;
  min-width: 120px;
  border-bottom: 1.5px solid #1c1410;
  margin: 0 4px; vertical-align: bottom; height: 20px;
}

/* Short answer lines */
#wmp-app .wmp-sa-lines { margin-left: 40px; margin-top: 8px; }
#wmp-app .wmp-sa-line  { border-bottom: 1px solid #ddd; height: 32px; margin-bottom: 4px; }

/* True / False */
#wmp-app .wmp-tf-opts {
  display: flex; gap: 20px;
  margin-left: 40px; margin-top: 8px;
}
#wmp-app .wmp-tf-opt  { display: flex; align-items: center; gap: 8px; font-size: 14px !important; }
#wmp-app .wmp-tf-box  { width: 20px; height: 20px; border: 1.5px solid #999; border-radius: 3px; flex-shrink: 0; }

/* Matching — 2 columns */
#wmp-app .wmp-match-wrap {
  margin-left: 40px; margin-top: 10px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px 32px;
}
#wmp-app .wmp-match-col-title {
  font-size: 11px !important; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: #7a6d5a; margin-bottom: 10px;
}
#wmp-app .wmp-match-item {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 14px !important;
  padding: 7px 0; border-bottom: 1px solid #eee;
}
#wmp-app .wmp-match-letter { font-weight: 800; color: #b8391e; min-width: 18px; }
#wmp-app .wmp-match-blank  { width: 34px; border-bottom: 1.5px solid #1c1410; height: 18px; flex-shrink: 0; }

/* Essay lines */
#wmp-app .wmp-essay-lines { margin-left: 40px; margin-top: 10px; }
#wmp-app .wmp-essay-line  { border-bottom: 1px solid #ddd; height: 32px; margin-bottom: 4px; }

/* Answer key */
#wmp-app .wmp-ans-key {
  margin-top: 40px; padding-top: 20px;
  border-top: 2px dashed #ddd;
}
#wmp-app .wmp-ans-key-title {
  font-size: 11px !important; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  color: #7a6d5a; margin-bottom: 12px;
}
#wmp-app .wmp-ans-items { display: flex; flex-wrap: wrap; gap: 6px; }
#wmp-app .wmp-ans-chip  {
  background: #f8f4ee; border: 1px solid #d0c8b0;
  border-radius: 4px; padding: 4px 11px;
  font-size: 13px !important; font-family: monospace;
}

/* ── Question Paper header ── */
#wmp-app .wmp-qp-header {
  border: 2px solid #1c1410; border-radius: 6px;
  padding: 24px 28px; margin-bottom: 32px;
}
#wmp-app .wmp-qp-school {
  font-size: 11px !important; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: #7a6d5a; text-align: center; margin-bottom: 6px;
}
#wmp-app .wmp-qp-title {
  font-size: 26px !important; font-weight: 900;
  text-align: center; margin-bottom: 6px;
}
#wmp-app .wmp-qp-sub { font-size: 13px !important; color: #7a6d5a; text-align: center; margin-bottom: 20px; }
#wmp-app .wmp-qp-meta {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; border-top: 1px solid #eee; padding-top: 16px;
}
#wmp-app .wmp-qp-meta-label {
  font-size: 10px !important; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: #7a6d5a;
  margin-bottom: 4px;
}
#wmp-app .wmp-qp-meta-value {
  font-size: 14px !important; font-weight: 600;
  border-bottom: 1.5px solid #1c1410; padding-bottom: 4px;
}
#wmp-app .wmp-qp-instructions {
  background: #f8f4ee; border-left: 4px solid #d4872a;
  padding: 14px 18px; border-radius: 0 6px 6px 0;
  margin-bottom: 32px; font-size: 14px !important; line-height: 1.7;
}
#wmp-app .wmp-qp-instructions strong {
  display: block; margin-bottom: 6px;
  font-size: 10px !important;
  text-transform: uppercase; letter-spacing: 1px; color: #7a6d5a;
}

/* ── PRINT ────────────────────────────────── */

/* ── Export bar ──────────────────────────── */
#wmp-app .wmp-export-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}
#wmp-app .wmp-export-bar.visible { display: flex; }
#wmp-app .wmp-export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 7px; border: none;
  font-size: 13px !important; font-weight: 600;
  cursor: pointer; font-family: inherit;
  text-decoration: none; line-height: 1;
}
#wmp-app .wmp-export-btn-pdf  { background: #b8391e; color: #fff; }
#wmp-app .wmp-export-btn-pdf:hover  { background: #9e2f18; }
#wmp-app .wmp-export-btn-teacher { background: #2e7d32; color: #fff; }
#wmp-app .wmp-export-btn-teacher:hover { background: #1b5e20; }
#wmp-app .wmp-export-btn-word { background: #1565c0; color: #fff; }
#wmp-app .wmp-export-btn-word:hover { background: #0d47a1; }
#wmp-app .wmp-export-btn-print{ background: #1c1410; color: #fff; }
#wmp-app .wmp-export-btn-print:hover{ background: #3d2b1f; }
#wmp-app .wmp-export-btn-history { background: #f5f0e8; color: #7a6d5a; border: 1px solid #d0c8b0; }
#wmp-app .wmp-export-btn-history:hover { background: #ede5d4; }

/* School branding header — preview */
#wmp-app .wmp-school-hdr {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 14px;
  border-bottom: 2px solid #1c1410;
  margin-bottom: 14px;
}
#wmp-app .wmp-school-logo {
  max-height: 52px;
  max-width: 140px;
  object-fit: contain;
  flex-shrink: 0;
}
#wmp-app .wmp-school-name {
  font-size: 15px;
  font-weight: 900;
  color: #1c1410;
  line-height: 1.2;
}
#wmp-app .wmp-school-tagline {
  font-size: 11px;
  color: #7a6d5a;
  margin-top: 2px;
}

/* History FAB button */
#wmp-app .wmp-history-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1c1410;
  color: #fff;
  font-size: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: transform 0.15s, box-shadow 0.15s;
}
#wmp-app .wmp-history-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
#wmp-app .wmp-history-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #b8391e;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* History panel */
#wmp-app .wmp-history-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  background: #fff;
  border-left: 1px solid #ddd;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#wmp-app .wmp-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: #1c1410;
  color: #fff;
  flex-shrink: 0;
}
#wmp-app .wmp-history-title {
  font-size: 14px;
  font-weight: 700;
}
#wmp-app .wmp-history-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
  padding: 0 4px;
}
#wmp-app .wmp-history-close:hover { opacity: 1; }

#wmp-app .wmp-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}
#wmp-app .wmp-history-empty {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 40px 20px;
  line-height: 1.6;
}
#wmp-app .wmp-history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f0ebe0;
  transition: background 0.1s;
}
#wmp-app .wmp-history-item:hover { background: #faf7f2; }
#wmp-app .wmp-history-item-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
#wmp-app .wmp-history-item-body {
  flex: 1;
  min-width: 0;
}
#wmp-app .wmp-history-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #1c1410;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#wmp-app .wmp-history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
#wmp-app .wmp-history-item-meta span {
  font-size: 10px;
  background: #f0ebe0;
  color: #7a6d5a;
  border-radius: 4px;
  padding: 1px 6px;
}
#wmp-app .wmp-history-item-date {
  font-size: 10px;
  color: #bbb;
  margin-top: 3px;
}
#wmp-app .wmp-history-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
#wmp-app .wmp-history-restore {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #b8391e;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
#wmp-app .wmp-history-restore:hover { background: #9e2f18; }
#wmp-app .wmp-history-delete {
  padding: 4px 8px;
  font-size: 11px;
  background: #f5f0e8;
  color: #999;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
}
#wmp-app .wmp-history-delete:hover { background: #ffe0e0; color: #c0392b; }

#wmp-app .wmp-history-footer {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
#wmp-app .wmp-history-clear-btn {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  background: #fff;
  color: #c0392b;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  cursor: pointer;
}
#wmp-app .wmp-history-clear-btn:hover { background: #fff5f5; }
#wmp-app .wmp-export-spinner { width:14px;height:14px;border:2px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;display:none;animation:none; }
#wmp-app .wmp-export-spinner.spin { display:inline-block;animation:wmp-spin 0.7s linear infinite; }
#wmp-app .wmp-export-spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; display: none;
}
#wmp-app .wmp-export-spinner.spin { display: inline-block !important; animation: wmp-spin 0.7s linear infinite; }

@media print {
  /* Hide everything except the sheet */
  body > *,
  #wmp-app > *,
  #wmp-app .wmp-topbar,
  #wmp-app .wmp-sidebar,
  #wmp-app .wmp-out-hdr,
  #wmp-app .wmp-stats,
  #wmp-app .wmp-thinking,
  #wmp-app .wmp-empty,
  #wmp-app .wmp-export-bar { display: none !important; }

  /* Flatten layout completely */
  html, body { margin: 0 !important; padding: 0 !important; height: auto !important; overflow: visible !important; background: #fff !important; }
  #wmp-app { all: unset !important; display: block !important; }
  #wmp-app .wmp-layout  { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; }
  #wmp-app .wmp-outpane { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  #wmp-app .wmp-ws-out  { display: block !important; height: auto !important; overflow: visible !important; }

  #wmp-app .wmp-sheet {
    display: block !important;
    box-shadow: none !important; border: none !important; border-radius: 0 !important;
    padding: 0 !important; margin: 0 !important; max-width: 100% !important; width: 100% !important;
    font-size: 11pt !important; background: #fff !important; font-family: Arial, sans-serif !important;
  }

  #wmp-app .wmp-ws-title { font-size: 18pt !important; }
  #wmp-app .wmp-sec-n,
  #wmp-app .wmp-inst { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  #wmp-app .wmp-q          { page-break-inside: avoid; margin-bottom: 12pt !important; }
  #wmp-app .wmp-ws-section { page-break-inside: avoid; margin-bottom: 18pt !important; }
  #wmp-app .wmp-sec-hdr    { page-break-after: avoid; }
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 800px) {
  #wmp-app .wmp-layout { flex-direction: column; height: auto; min-height: none; }
  #wmp-app .wmp-sidebar { width: 100% !important; min-width: 0 !important; }
  #wmp-app .wmp-outpane { padding: 18px !important; }
  #wmp-app .wmp-sheet   { padding: 28px 22px !important; font-size: 14px !important; }
  #wmp-app .wmp-mc-opts { grid-template-columns: 1fr !important; }
  #wmp-app .wmp-match-wrap { grid-template-columns: 1fr !important; }
  #wmp-app .wmp-output-switcher { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════
   NEW QUESTION TYPE STYLES
   ═══════════════════════════════════════════════════════════════ */

/* ── Word Bank (FITB Word Pool) ─────────────────────────────── */
#wmp-app .wmp-word-bank {
  background: #f8f4ee;
  border: 1.5px solid #d4872a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
#wmp-app .wmp-word-bank-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a6d5a;
  white-space: nowrap;
}
#wmp-app .wmp-word-chip {
  background: #fff;
  border: 1.5px solid #d4872a;
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 13px;
  font-weight: 600;
  color: #1c1410;
}

/* ── Sentence Transformation ────────────────────────────────── */
#wmp-app .wmp-st-instr {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b8391e;
  margin-bottom: 4px;
}
#wmp-app .wmp-st-original {
  font-style: italic;
  color: #1c1410;
  line-height: 1.6;
}
#wmp-app .wmp-st-answer-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px 32px;
}
#wmp-app .wmp-st-arrow {
  font-size: 18px;
  color: #d4872a;
  flex-shrink: 0;
}

/* ── Error Correction ───────────────────────────────────────── */
#wmp-app .wmp-error-word {
  background: #fff3cd;
  border-bottom: 2px solid #b8391e;
  color: #b8391e;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}
#wmp-app .wmp-ec-row {
  display: flex;
  gap: 24px;
  margin: 8px 0 4px 32px;
  flex-wrap: wrap;
}
#wmp-app .wmp-ec-label {
  font-size: 12px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}
#wmp-app .wmp-blank-short {
  min-width: 80px !important;
  display: inline-block;
}
#wmp-app .wmp-blank-wide {
  min-width: 160px !important;
  display: inline-block;
}

/* ── Ordering / Sequencing ──────────────────────────────────── */
#wmp-app .wmp-ordering-instr {
  font-style: italic;
  color: #555;
}
#wmp-app .wmp-ordering-items {
  margin: 10px 0 4px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#wmp-app .wmp-ordering-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8f4ee;
  border: 1px solid #e8e0d0;
  border-radius: 6px;
  font-size: 13px;
}
#wmp-app .wmp-ordering-num {
  width: 28px;
  height: 28px;
  border: 2px solid #d4872a;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fff;
}
#wmp-app .wmp-ordering-text { flex: 1; line-height: 1.5; }

/* ── Numerical Problems ─────────────────────────────────────── */
#wmp-app .wmp-num-working {
  margin: 10px 0 4px 32px;
  border: 1.5px solid #e8e0d0;
  border-radius: 6px;
  padding: 10px 14px;
  background: #fafafa;
}
#wmp-app .wmp-num-working-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7a6d5a;
  margin-bottom: 6px;
}
#wmp-app .wmp-num-answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}
#wmp-app .wmp-num-answer-label {
  font-size: 12px;
  font-weight: 700;
  color: #1c1410;
  white-space: nowrap;
}

/* ── Reading Comprehension ──────────────────────────────────── */
#wmp-app .wmp-rc-passage {
  background: #f8f4ee;
  border-left: 4px solid #1c1410;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.75;
  color: #1c1410;
}
#wmp-app .wmp-rc-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #1c1410;
}
#wmp-app .wmp-rc-text { white-space: pre-line; }
#wmp-app .wmp-rc-qlabel {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a6d5a;
  margin-bottom: 12px;
  padding-top: 4px;
}

/* ── Odd One Out ────────────────────────────────────────────── */
#wmp-app .wmp-ooo-items {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#wmp-app .wmp-ooo-chip {
  background: #fff;
  border: 2px solid #1c1410;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#wmp-app .wmp-ooo-answer-row {
  display: flex;
  gap: 24px;
  margin: 10px 0 4px 32px;
  flex-wrap: wrap;
}

/* ── Define Terms ───────────────────────────────────────────── */
#wmp-app .wmp-def-rows { margin: 8px 0 4px 32px; }
#wmp-app .wmp-def-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
#wmp-app .wmp-def-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7a6d5a;
  white-space: nowrap;
  padding-top: 4px;
  min-width: 80px;
}

/* ── Shared inline blank ─────────────────────────────────────── */
#wmp-app .wmp-blank {
  display: inline-block;
  min-width: 110px;
  border-bottom: 1.5px solid #1c1410;
  height: 16px;
  margin: 0 3px;
  vertical-align: bottom;
}

/* ── Cloze Test ─────────────────────────────────────────────── */
#wmp-app .wmp-rc-text { white-space: pre-line; line-height: 1.9; }

/* ── Cause & Effect ─────────────────────────────────────────── */
#wmp-app .wmp-ce-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 4px 32px;
}
#wmp-app .wmp-ce-label {
  font-size: 13px;
  font-weight: 800;
  color: #d4872a;
  white-space: nowrap;
  padding-top: 4px;
  min-width: 70px;
}

/* ── Picture Description ────────────────────────────────────── */
#wmp-app .wmp-pic-frame {
  margin: 12px 32px 8px;
  border: 2px dashed #bbb;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#wmp-app .wmp-pic-icon { font-size: 28px; }
#wmp-app .wmp-pic-label {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   PER-TYPE QUESTION COUNT UI
   ═══════════════════════════════════════════════════════════════ */

#wmp-app .wmp-qtype-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
#wmp-app .wmp-qtype-hint {
  font-size: 11px;
  color: #999;
  font-style: italic;
}
#wmp-app .wmp-qtype-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Each row: checkbox label on left, count stepper on right */
#wmp-app .wmp-qtype-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.5px solid #e8e0d0;
  background: #fafafa;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  opacity: 0.55;
}
#wmp-app .wmp-qtype-row.on {
  background: #fff;
  border-color: #d4872a;
  opacity: 1;
}

/* Checkbox + icon + name */
#wmp-app .wmp-qtype-chk-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
#wmp-app .wmp-qtype-chk-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #d4872a;
}
#wmp-app .wmp-qtype-icon { font-size: 15px; flex-shrink: 0; }
#wmp-app .wmp-qtype-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1c1410;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Count stepper: − [n] + label */
#wmp-app .wmp-qtype-count-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
#wmp-app .wmp-cnt-btn {
  width: 26px;
  height: 26px;
  border: 1.5px solid #d4872a;
  border-radius: 6px;
  background: #fff;
  color: #d4872a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.12s;
}
#wmp-app .wmp-cnt-btn:hover { background: #fff4e6; }
#wmp-app .wmp-cnt-input {
  width: 36px !important;
  text-align: center;
  border: 1.5px solid #e8e0d0;
  border-radius: 5px;
  padding: 3px 2px;
  font-size: 13px;
  font-weight: 700;
  color: #1c1410;
  -moz-appearance: textfield;
}
#wmp-app .wmp-cnt-input::-webkit-outer-spin-button,
#wmp-app .wmp-cnt-input::-webkit-inner-spin-button { -webkit-appearance: none; }
#wmp-app .wmp-cnt-label {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dim the stepper when row is unchecked */
#wmp-app .wmp-qtype-row:not(.on) .wmp-qtype-count-wrap {
  opacity: 0.35;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   PASTE COUNTER & PROGRESS BAR
   ═══════════════════════════════════════════════════════════════ */

/* Tip banner above textarea */
#wmp-app .wmp-paste-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fffbf0;
  border: 1.5px solid #f0d080;
  border-radius: 8px;
  padding: 9px 13px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #5a4a1a;
}
#wmp-app .wmp-paste-tip-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* Counter bar: badges left, tip right */
#wmp-app .wmp-counter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
#wmp-app .wmp-counter-left { display: flex; align-items: center; gap: 6px; }
#wmp-app .wmp-counter-right { flex: 1; text-align: right; }

/* Word / char badges */
#wmp-app .wmp-cnt-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  background: #e8e0d0;
  color: #7a6d5a;
  transition: background 0.2s, color 0.2s;
}
#wmp-app .wmp-cnt-badge.secondary {
  background: #f0ece5;
  font-weight: 500;
}
#wmp-app .wmp-cnt-badge.zone-ideal    { background: #d4edda; color: #155724; }
#wmp-app .wmp-cnt-badge.zone-building { background: #fff3cd; color: #856404; }
#wmp-app .wmp-cnt-badge.zone-too-short{ background: #fde8e8; color: #8b1a1a; }
#wmp-app .wmp-cnt-badge.zone-long     { background: #d1ecf1; color: #0c5460; }
#wmp-app .wmp-cnt-badge.zone-over     { background: #f8d7da; color: #721c24; }
#wmp-app .wmp-cnt-sep { color: #ccc; font-size: 13px; }

/* Counter tip text */
#wmp-app .wmp-counter-tip {
  font-size: 11.5px;
  color: #999;
  font-style: italic;
  transition: color 0.2s;
}
#wmp-app .wmp-counter-tip.zone-ideal     { color: #28a745; font-style: normal; font-weight: 600; }
#wmp-app .wmp-counter-tip.zone-building  { color: #856404; }
#wmp-app .wmp-counter-tip.zone-too-short { color: #dc3545; }
#wmp-app .wmp-counter-tip.zone-long      { color: #17a2b8; }
#wmp-app .wmp-counter-tip.zone-over      { color: #dc3545; font-weight: 700; font-style: normal; }

/* Progress bar */
#wmp-app .wmp-progress-wrap {
  margin: 8px 0 4px;
}
#wmp-app .wmp-progress-track {
  position: relative;
  height: 8px;
  background: #f0ece5;
  border-radius: 99px;
  overflow: hidden;
}
/* Ideal zone highlight (green band in background) */
#wmp-app .wmp-progress-ideal {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(40,167,69,0.15);
  pointer-events: none;
}
/* Actual fill bar */
#wmp-app .wmp-progress-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 99px;
  background: #d4872a;
  transition: width 0.25s ease, background 0.25s;
  min-width: 0;
}
#wmp-app .wmp-progress-bar.zone-too-short { background: #dc3545; }
#wmp-app .wmp-progress-bar.zone-building  { background: #ffc107; }
#wmp-app .wmp-progress-bar.zone-ideal     { background: #28a745; }
#wmp-app .wmp-progress-bar.zone-long      { background: #17a2b8; }
#wmp-app .wmp-progress-bar.zone-over      { background: #dc3545; }

/* Progress labels row */
#wmp-app .wmp-progress-labels {
  position: relative;
  height: 16px;
  margin-top: 2px;
  font-size: 9.5px;
  color: #bbb;
}
#wmp-app .wmp-progress-labels span:first-child  { position: absolute; left: 0; }
#wmp-app .wmp-progress-labels span:last-child   { position: absolute; right: 0; }
#wmp-app .wmp-progress-ideal-label {
  position: absolute;
  transform: translateX(-50%);
  color: #28a745;
  font-weight: 700;
}

/* Over-limit status message */
#wmp-app .wmp-counter-status { margin-top: 4px; }
#wmp-app .wmp-status-over {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 11.5px;
  color: #721c24;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   KNOWLEDGE BASE INDICATOR
   ═══════════════════════════════════════════════════════════════ */

#wmp-app .wmp-kb-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f8e8 100%);
  border: 1.5px solid #a8d5f5;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  animation: wmp-kb-fadein 0.3s ease;
}
#wmp-app .wmp-sys-indicator {
  background: linear-gradient(135deg, #fff4e6 0%, #fef9f0 100%);
  border-color: #f0c070;
}
@keyframes wmp-kb-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
#wmp-app .wmp-kb-icon { font-size: 18px; flex-shrink: 0; }
#wmp-app .wmp-kb-indicator-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#wmp-app .wmp-kb-indicator-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a5276;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#wmp-app .wmp-sys-indicator .wmp-kb-indicator-title { color: #7d4e00; }
#wmp-app .wmp-kb-indicator-sub {
  font-size: 11px;
  color: #5d8aa8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#wmp-app .wmp-sys-indicator .wmp-kb-indicator-sub { color: #a0710a; }
#wmp-app .wmp-kb-badge {
  flex-shrink: 0;
  background: #1a5276;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
}
#wmp-app .wmp-sys-indicator .wmp-kb-badge { background: #d4872a; }

/* ═══════════════════════════════════════════════════════════════
   INDIVIDUAL CLASS GRADE PILLS
   ═══════════════════════════════════════════════════════════════ */

/* Tighter pills for the larger grade list */
#wmp-app .wmp-pills-wrap { gap: 4px; }
#wmp-app .wmp-pills-wrap .wmp-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
}
/* Nursery/KG get a soft green tint to distinguish early years */
#wmp-app .wmp-pills-wrap .wmp-pill:nth-child(1),
#wmp-app .wmp-pills-wrap .wmp-pill:nth-child(2) {
  border-color: #a8d5b0;
  color: #2d6a4f;
}
#wmp-app .wmp-pills-wrap .wmp-pill:nth-child(1):not(.active),
#wmp-app .wmp-pills-wrap .wmp-pill:nth-child(2):not(.active) {
  background: #f0faf3;
}
/* College pill gets a subtle blue tint */
#wmp-app .wmp-pills-wrap .wmp-pill:last-child {
  border-color: #a8c8e8;
  color: #1a4a6e;
}
#wmp-app .wmp-pills-wrap .wmp-pill:last-child:not(.active) {
  background: #f0f6fc;
}

/* General Mode indicator (neutral grey style) */
#wmp-app .wmp-general-indicator {
  background: linear-gradient(135deg, #f5f5f5 0%, #ececec 100%);
  border-color: #ccc;
}
#wmp-app .wmp-general-indicator .wmp-kb-indicator-title { color: #555; }
#wmp-app .wmp-general-indicator .wmp-kb-indicator-sub   { color: #888; }
#wmp-app .wmp-general-indicator .wmp-kb-badge {
  background: #888;
}

/* ═══════════════════════════════════════════════════════════════
   GRADE DROPDOWN
   ═══════════════════════════════════════════════════════════════ */
#wmp-app .wmp-grade-wrap { position: relative; width: 100%; }

#wmp-app .wmp-grade-select,
#wmp-app .wmp-chapter-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 9px 36px 9px 12px;
  border: 2px solid #e8e0d4;
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b8391e' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  font-size: 13px;
  font-weight: 600;
  color: #3a2e24;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
#wmp-app .wmp-grade-select:focus,
#wmp-app .wmp-chapter-select:focus {
  outline: none;
  border-color: #b8391e;
  box-shadow: 0 0 0 3px rgba(184,57,30,0.12);
}
#wmp-app .wmp-grade-select:hover,
#wmp-app .wmp-chapter-select:hover { border-color: #c8a882; }

#wmp-app .wmp-grade-select optgroup,
#wmp-app .wmp-chapter-select optgroup {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  background: #f5f5f5;
}
#wmp-app .wmp-grade-select option,
#wmp-app .wmp-chapter-select option {
  font-size: 13px;
  font-weight: 500;
  color: #2c2c2c;
  padding: 4px 8px;
  background: #fff;
  white-space: normal;
  overflow: visible;
}

/* ═══════════════════════════════════════════════════════════════
   CHAPTER MULTI-SELECT CHIPS
   ═══════════════════════════════════════════════════════════════ */
#wmp-app .wmp-chapter-hint {
  font-size: 10.5px;
  font-weight: 400;
  color: #999;
  margin-left: 6px;
  font-style: italic;
}
#wmp-app .wmp-chapter-required {
  font-size: 10.5px;
  font-weight: 700;
  color: #c0392b;
  margin-left: 6px;
  animation: wmp-pulse 1s ease-in-out infinite;
}
@keyframes wmp-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Chip container */
#wmp-app .wmp-chapter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* Each chip = hidden checkbox + visible label */
#wmp-app .wmp-chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid #d0c8b0;
  border-radius: 20px;
  background: #fff;
  font-size: 11.5px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.3;
}
#wmp-app .wmp-chapter-chip:hover {
  border-color: #b8391e;
  color: #b8391e;
  background: #fdf5f3;
}
#wmp-app .wmp-chapter-chip.selected {
  border-color: #b8391e;
  background: #b8391e;
  color: #fff;
  font-weight: 600;
}
#wmp-app .wmp-chapter-chip.selected:hover {
  background: #9c2d15;
  border-color: #9c2d15;
  color: #fff;
}
#wmp-app .wmp-chapter-chip .wmp-chip-check {
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.1s;
}
#wmp-app .wmp-chapter-chip.selected .wmp-chip-check {
  opacity: 1;
}

/* Actions row: All / None + count */
#wmp-app .wmp-chapter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
#wmp-app .wmp-chap-action-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #f5f5f5;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}
#wmp-app .wmp-chap-action-btn:hover {
  background: #e8e0d4;
  border-color: #b8391e;
  color: #b8391e;
}
#wmp-app .wmp-chapter-count-label {
  font-size: 11px;
  color: #888;
  margin-left: 4px;
}

#wmp-app .wmp-chapter-token-tip {
  margin-top: 8px;
  font-size: 11px;
  color: #2d6a4f;
  background: #f0f8e8;
  border: 1px solid #c3e6cb;
  border-radius: 6px;
  padding: 5px 10px;
}
#wmp-app .wmp-chapter-token-tip.warn {
  color: #856404;
  background: #fff3cd;
  border-color: #ffc107;
}

/* Validation shake animation */
@keyframes wmp-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
#wmp-app .wmp-chapter-shake {
  animation: wmp-shake 0.4s ease;
}
/* Admin KB chapter input */

/* ═══════════════════════════════════════════════════════════════
   FEATURE 2 — ANSWER KEY TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════ */
#wmp-app .wmp-ans-toggle-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid #2e7d32;
  border-radius: 8px;
  background: #fff;
  color: #2e7d32;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
#wmp-app .wmp-ans-toggle-btn:hover,
#wmp-app .wmp-ans-toggle-btn.active {
  background: #2e7d32;
  color: #fff;
}
#wmp-app .wmp-ans-key {
  margin-top: 24px;
  padding: 16px 20px;
  background: #f0f8e8;
  border: 1.5px solid #a5d6a7;
  border-radius: 10px;
  page-break-inside: avoid;
}
#wmp-app .wmp-ans-key-title {
  font-size: 14px;
  font-weight: 700;
  color: #2e7d32;
  margin-bottom: 10px;
}
#wmp-app .wmp-ans-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#wmp-app .wmp-ans-chip {
  display: inline-block;
  padding: 3px 10px;
  background: #fff;
  border: 1px solid #a5d6a7;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1b5e20;
}

/* ═══════════════════════════════════════════════════════════════
   FEATURE 4 — MARKS TALLY (SIDEBAR LIVE + POST-GEN)
   ═══════════════════════════════════════════════════════════════ */
#wmp-app .wmp-marks-hint {
  font-size: 10.5px;
  color: #aaa;
  margin-top: 4px;
  font-style: italic;
}
#wmp-app .wmp-marks-tally-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
#wmp-app .wmp-marks-total {
  font-size: 20px;
  font-weight: 800;
  color: #b8391e;
}
#wmp-app .wmp-marks-total.over { color: #c0392b; }
#wmp-app .wmp-marks-target {
  font-size: 13px;
  color: #888;
}
#wmp-app .wmp-marks-diff {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff3cd;
  color: #856404;
}
#wmp-app .wmp-marks-diff.over {
  background: #fde8e8;
  color: #c0392b;
}
#wmp-app .wmp-marks-diff.ok {
  background: #d4edda;
  color: #155724;
}
#wmp-app .wmp-marks-bar-wrap {
  height: 6px;
  background: #e8e0d4;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
#wmp-app .wmp-marks-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}
#wmp-app .wmp-marks-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#wmp-app .wmp-marks-chip {
  font-size: 10.5px;
  background: #f5f0e8;
  border: 1px solid #d0c8b0;
  border-radius: 10px;
  padding: 2px 8px;
  color: #555;
}
/* Post-generation marks breakdown */
#wmp-app #wmp-marks-tally-post {
  padding: 8px 16px;
  background: #f8f4ee;
  border-bottom: 1px solid #e0d8cc;
  font-size: 12px;
}
#wmp-app .wmp-marks-tally-post-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #666;
}
#wmp-app .wmp-marks-total-post {
  margin-left: auto;
  font-size: 13px;
  color: #b8391e;
}

/* ═══════════════════════════════════════════════════════════════
   FEATURE 5 — REGENERATE SINGLE QUESTION BUTTON
   ═══════════════════════════════════════════════════════════════ */
#wmp-app .wmp-regen-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: 3px 9px;
  font-size: 15px;
  font-weight: 700;
  border: 1.5px solid #d0c8b0;
  border-radius: 6px;
  background: #fff;
  color: #b8391e;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.15s;
  line-height: 1;
}
#wmp-app .wmp-q:hover .wmp-regen-btn { opacity: 1; }
#wmp-app .wmp-regen-btn:hover {
  background: #b8391e;
  color: #fff;
  border-color: #b8391e;
}
#wmp-app .wmp-regen-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
@keyframes wmp-regen-flash {
  0%   { background: #fff9e6; }
  50%  { background: #ffe082; }
  100% { background: transparent; }
}
#wmp-app .wmp-regen-flash {
  animation: wmp-regen-flash 0.8s ease;
  border-radius: 6px;
}
@media print {
  #wmp-app .wmp-regen-btn { display: none !important; }
}
