/* practice.css — styling for the iGCSE practice screen. */
:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #15803d;
  --bad: #b91c1c;
  --bg: #f9fafb;
  --card: #ffffff;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--brand); }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.brand-title { font-weight: 700; font-size: 1.15rem; }
.brand-tagline { font-size: 0.8rem; color: var(--muted); }
.site-nav { display: flex; gap: 16px; margin-left: auto; }
.site-nav a { text-decoration: none; color: var(--ink); font-weight: 500; }
.site-nav a:hover { color: var(--brand); }
.lang-toggle { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.lang-toggle:hover { border-color: var(--brand); color: var(--brand); }
.site-main { max-width: 960px; margin: 0 auto; padding: 16px; }
.site-footer { max-width: 960px; margin: 24px auto; padding: 0 16px 24px; color: var(--muted); font-size: 0.85rem; }

.practice-page { display: flex; flex-direction: column; gap: 16px; }
.crumb { margin: 0; }
.question-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.question-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; font-size: 0.9rem; }
.q-number { font-weight: 800; font-size: 1.1rem; }
.q-paper, .q-marks { background: #eff6ff; border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.q-topic { color: var(--muted); }
.question-stem { font-size: 1.05rem; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); }
.tab-btn { border: none; background: none; padding: 10px 18px; font-size: 1rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { background: var(--card); border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 18px; }
.tab-panel[hidden] { display: none; }

/* Forms & buttons */
.field-label, .sub-label { display: block; font-weight: 600; margin: 14px 0 6px; }
.sub-label { font-size: 0.95rem; }
.field-hint { color: var(--muted); font-size: 0.88rem; margin: 6px 0; }
.muted { color: var(--muted); }
textarea, input[type="text"], select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-link { border: none; background: none; color: var(--brand); padding: 4px 8px; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.status-msg { font-size: 0.9rem; }
.status-msg.is-ok { color: var(--ok); }
.status-msg.is-error { color: var(--bad); }
.inline-error { color: var(--bad); font-size: 0.9rem; }

/* Tab 1 */
.working-preview { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; min-height: 64px; background: #fff; overflow-x: auto; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; }
.dropzone.is-dragging { border-color: var(--brand); background: #eff6ff; }
.image-preview-wrap { margin: 12px 0 0; }
.image-preview-wrap img { max-width: 100%; max-height: 320px; border: 1px solid var(--line); border-radius: 8px; }

/* Tab 2 */
.sketch-toolbar, .mode-switch { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-label { font-weight: 600; margin-right: 4px; }
.tool-btn, .mode-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; }
.tool-btn.is-active, .mode-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.function-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.function-row input { flex: 1 1 200px; width: auto; }
.fn-prefix { font-family: "KaTeX_Math", serif; font-style: italic; }
.board-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.jxgbox { touch-action: none; }
.freehand-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* Tab 3 */
.template-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.step-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.step-row-head { display: flex; justify-content: space-between; align-items: center; }
.step-row-title { font-weight: 700; }
.progress-wrap { margin: 12px 0; }
.progress-label { font-weight: 600; font-size: 0.9rem; }
.progress-bar { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--brand); transition: width 0.3s ease; }
.step-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step-prompt { font-size: 1.05rem; margin-top: 0; }
.hint-box { background: #fefce8; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; }
.feedback { border-radius: 8px; padding: 10px 12px; font-weight: 600; }
.feedback.is-right { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.feedback.is-wrong { background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; }
.choice-option { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.choice-option:hover { border-color: var(--brand); }
.complete-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 16px; margin-top: 16px; }

@media (max-width: 640px) {
  .site-main { padding: 12px; }
  .tab-btn { padding: 10px 10px; font-size: 0.92rem; }
  .tab-panel { padding: 14px; }
  .header-inner { gap: 10px; }
  .site-nav { margin-left: 0; }
}
