/* ROUGHPAD — shared rough-work scratchpad for Just Practice numerical MCQs.
   Brand-aware: uses each page's --accent / --accent-soft (falls back to --brand
   then a default blue). Styled to the Just Practice design system. */

.roughpad {
  --rp-accent: var(--accent, var(--brand, #2563eb));
  --rp-accent-soft: var(--accent-soft, var(--brand-soft, #eff4ff));
  --rp-border: var(--border, #e1e4ea);
  --rp-border-strong: var(--border-strong, #c9cfd8);
  --rp-surface: var(--surface, #ffffff);
  --rp-surface2: var(--surface2, #f0f2f5);
  --rp-text: var(--text, #1a1d23);
  --rp-muted: var(--muted, #6b7280);

  margin-top: 16px;
  border: 1.5px dashed var(--rp-border);
  border-radius: 12px;
  background: var(--rp-surface);
  transition: border-color 0.18s;
  font-family: inherit;
}
.roughpad.open { border-style: solid; border-color: var(--rp-accent); }

.roughpad-toggle {
  width: 100%; padding: 12px 16px;
  background: transparent; border: none; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--rp-accent);
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  border-radius: 12px;
}
.roughpad-toggle:hover { background: var(--rp-accent-soft); }
.roughpad-toggle .rp-left { display: inline-flex; align-items: center; gap: 8px; }
.roughpad-toggle .rp-chev { font-size: 11px; transition: transform 0.18s; }
.roughpad.open .roughpad-toggle .rp-chev { transform: rotate(180deg); }
.roughpad-toggle svg { width: 15px; height: 15px; }

.roughpad-body { display: none; padding: 0 16px 16px; }
.roughpad.open .roughpad-body { display: block; }

.roughpad-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 2px 0 12px; flex-wrap: wrap;
}
.rp-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--rp-muted); }
.rp-tools { display: flex; gap: 6px; }
.rp-tool {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--rp-border); border-radius: 8px;
  background: var(--rp-surface); color: var(--rp-muted); cursor: pointer; transition: all 0.12s;
  padding: 0;
}
.rp-tool:hover { border-color: var(--rp-border-strong); color: var(--rp-text); }
.rp-tool.active { background: var(--rp-accent); border-color: var(--rp-accent); color: #fff; }
.rp-tool.danger { color: #dc2626; }
.rp-tool.danger:hover { background: #fef2f2; border-color: #fca5a5; }
.rp-tool svg { width: 17px; height: 17px; }

.roughpad-grid {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: 0;
  border: 1px solid var(--rp-border); border-radius: 10px; overflow: hidden;
}
.rp-canvas { width: 100%; height: 230px; background: var(--rp-surface); touch-action: none; cursor: crosshair; display: block; }
.rp-canvas.eraser { cursor: cell; }
.rp-text {
  width: 100%; height: 230px; resize: none; border: none; border-left: 1px solid var(--rp-border);
  padding: 12px 14px; font-family: inherit; font-size: 14px; color: var(--rp-text); background: var(--rp-surface); outline: none;
}
.rp-text::placeholder { color: var(--rp-muted); }

@media (max-width: 620px) {
  .roughpad-grid { grid-template-columns: 1fr; }
  .rp-text { border-left: none; border-top: 1px solid var(--rp-border); height: 150px; }
}
