:root {
  --test-primary: #6b7280;
  --test-primary-hover: #4b5563;
  --test-danger: #dc2626;
  --test-success: #16a34a;
  --test-warning: #d97706;
  --test-card: var(--color-surface, #262626);
  --test-surface: var(--color-surface-alt, #333333);
  --test-border: var(--color-border, #3d3d3d);
  --test-muted: var(--color-text-muted, #9e9e9e);
}
html[data-theme="light"] {
  --test-primary: #6b7280;
  --test-primary-hover: #4b5563;
  --test-card: var(--color-surface, #f0f0f0);
  --test-surface: var(--color-surface-alt, #eaeaea);
  --test-border: var(--color-border, #cccccc);
  --test-muted: var(--color-text-muted, #666666);
}
.test-shell { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.test-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:24px; flex-wrap:wrap; }
.test-heading h1 { margin:0 0 7px; font-size:clamp(1.7rem,4vw,2.4rem); }
.test-heading p { margin:0; color:var(--test-muted); }
.test-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.test-btn { appearance:none; border:0; border-radius:10px; padding:11px 16px; font:inherit; font-weight:700; text-decoration:none; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:8px; background:var(--test-primary); color:#fff; }
.test-btn:hover { background:var(--test-primary-hover); color:#fff; }
.test-btn.secondary { background:rgba(148,163,184,.14); color:inherit; border:1px solid var(--test-border); }
.test-btn.danger { background:var(--test-danger); color:#fff; }
.test-btn.success { background:var(--test-success); color:#fff; }
.test-btn.warning { background:var(--test-warning); color:#fff; }
.test-btn.small { padding:8px 11px; border-radius:8px; font-size:.9rem; }
.test-btn[disabled] { opacity:.55; cursor:not-allowed; }
.test-grid { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:18px; }
.test-card { grid-column:span 12; background:var(--test-card); border:1px solid var(--test-border); border-radius:16px; padding:21px; box-shadow:0 12px 30px rgba(0,0,0,.08); }
.test-card.half { grid-column:span 6; }
.test-card.third { grid-column:span 4; }
.test-card h2,.test-card h3 { margin-top:0; }
.test-stat { font-size:2rem; font-weight:800; margin-top:6px; }
.test-muted { color:var(--test-muted); }
.test-badge { display:inline-flex; align-items:center; gap:5px; padding:5px 9px; border-radius:999px; font-size:.8rem; font-weight:800; background:rgba(148,163,184,.15); }
.test-badge.unlocked,.test-badge.submitted,.test-badge.passed { background:rgba(22,163,74,.15); color:#4ade80; }
.test-badge.locked,.test-badge.expired { background:rgba(217,119,6,.15); color:#fbbf24; }
.test-badge.closed,.test-badge.terminated,.test-badge.failed { background:rgba(220,38,38,.15); color:#f87171; }
.test-table-wrap { overflow:auto; border:1px solid var(--test-border); border-radius:12px; }
.test-table { width:100%; border-collapse:collapse; min-width:720px; }
.test-table th,.test-table td { padding:12px 13px; border-bottom:1px solid var(--test-border); text-align:left; vertical-align:top; }
.test-table th { color:var(--test-muted); font-size:.82rem; text-transform:uppercase; letter-spacing:.04em; }
.test-table tr:last-child td { border-bottom:0; }
.test-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.test-field { display:flex; flex-direction:column; gap:7px; }
.test-field.full { grid-column:1/-1; }
.test-field label { font-weight:750; }
.test-field small { color:var(--test-muted); }
.test-input,.test-select,.test-textarea { width:100%; box-sizing:border-box; border-radius:10px; border:1px solid var(--test-border); background:var(--test-surface); color:inherit; padding:11px 12px; font:inherit; }
.test-textarea { min-height:120px; resize:vertical; }
.test-check { display:flex; gap:10px; align-items:flex-start; padding:11px 12px; border:1px solid var(--test-border); border-radius:10px; }
.test-check input { margin-top:3px; }
.test-question-picker { max-height:540px; overflow:auto; display:grid; gap:10px; padding-right:4px; }
.test-question-option { display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:start; padding:13px; border:1px solid var(--test-border); border-radius:12px; cursor:pointer; }
.test-question-option:hover { border-color:var(--test-primary); }
.test-code { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:clamp(1.8rem,7vw,3.2rem); letter-spacing:.16em; font-weight:900; text-align:center; padding:20px; border:2px dashed var(--test-primary); border-radius:14px; background:rgba(107,114,128,.12); }
.test-center-card { max-width:720px; margin:40px auto; }
.test-rule-list { display:grid; gap:10px; padding:0; list-style:none; }
.test-rule-list li { display:flex; gap:10px; align-items:flex-start; }
.test-exam-page { min-height:100vh; background:var(--color-bg,#1a1a1a); color:var(--color-text,#eaeaea); padding:18px; box-sizing:border-box; }
.test-exam-frame { max-width:1080px; margin:0 auto; }
.test-exam-top { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:14px; }
.test-timer { font:800 1.25rem ui-monospace,SFMono-Regular,Menlo,monospace; padding:10px 13px; border-radius:10px; background:rgba(107,114,128,.18); }
.test-timer.danger { background:rgba(220,38,38,.18); color:#f87171; }
.test-progress { height:8px; border-radius:999px; background:rgba(148,163,184,.18); overflow:hidden; margin:12px 0 18px; }
.test-progress > div { height:100%; background:var(--test-primary); transition:width .2s ease; }
.test-question-card { background:var(--test-card); border:1px solid var(--test-border); border-radius:18px; padding:clamp(20px,4vw,34px); }
.test-question-text { font-size:clamp(1.15rem,2.5vw,1.55rem); font-weight:750; line-height:1.5; margin:18px 0 24px; white-space:pre-wrap; }
.test-options { display:grid; gap:11px; }
.test-answer-option { display:flex; gap:12px; align-items:flex-start; padding:14px; border:1px solid var(--test-border); border-radius:12px; cursor:pointer; }
.test-answer-option:hover,.test-answer-option:has(input:checked) { border-color:var(--test-primary); background:rgba(107,114,128,.12); }
.test-answer-option input { margin-top:4px; }
.test-exam-controls { display:flex; justify-content:space-between; gap:12px; margin-top:22px; flex-wrap:wrap; }
.test-number-nav { display:flex; flex-wrap:wrap; gap:7px; margin-top:16px; }
.test-number { width:36px; height:36px; border-radius:8px; border:1px solid var(--test-border); background:transparent; color:inherit; cursor:pointer; font-weight:700; }
.test-number.current { border-color:var(--test-primary); box-shadow:0 0 0 2px rgba(107,114,128,.22); }
.test-number.answered { background:rgba(22,163,74,.18); border-color:rgba(22,163,74,.55); }
.test-modal-backdrop { position:fixed; inset:0; z-index:100000; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(2,6,23,.74); backdrop-filter:blur(5px); }
.test-modal { width:min(480px,100%); background:var(--test-card); border:1px solid var(--test-border); border-radius:18px; padding:24px; box-shadow:0 30px 80px rgba(0,0,0,.45); }
.test-modal h2 { margin-top:0; }
.test-result-score { font-size:clamp(3rem,10vw,5.5rem); line-height:1; font-weight:900; }
.test-answer-review { padding:16px; border:1px solid var(--test-border); border-radius:12px; margin-bottom:12px; }
.test-answer-review.correct { border-left:5px solid var(--test-success); }
.test-answer-review.wrong { border-left:5px solid var(--test-danger); }
.test-answer-review.skipped { border-left:5px solid var(--test-warning); }
.test-inline-form { display:inline-flex; gap:8px; align-items:center; margin:0; }
.test-empty { text-align:center; padding:45px 20px; color:var(--test-muted); }
.test-alert { padding:13px 15px; border:1px solid var(--test-border); border-radius:10px; background:rgba(107,114,128,.12); }
.test-alert.danger { background:rgba(220,38,38,.1); border-color:rgba(220,38,38,.35); }

.test-question-editor-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.test-question-editor-heading h2 { margin-bottom:6px; }
.test-question-editor-heading p { margin:0; }
.test-question-editor { margin-top:16px; padding-top:16px; border-top:1px solid var(--test-border); }
.test-question-editor[hidden] { display:none !important; }
.test-question-tools { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:9px; margin-bottom:12px; }
.test-fullscreen-recovery .test-modal { text-align:center; }
.test-recovery-countdown { width:74px; height:74px; margin:16px auto; display:grid; place-items:center; border:2px solid var(--test-border); border-radius:50%; font-size:1.7rem; font-weight:900; background:var(--test-surface); }
@media (max-width:780px) {
  .test-card.half,.test-card.third { grid-column:span 12; }
  .test-form-grid { grid-template-columns:1fr; }
  .test-heading { align-items:stretch; }
  .test-actions .test-btn { flex:1; }
  .test-exam-page { padding:10px; }
  .test-exam-top { align-items:flex-start; }
  .test-question-tools { grid-template-columns:1fr 1fr; }
  .test-question-tools .test-input { grid-column:1/-1; }
}
.test-section-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.test-section-heading h2 { margin:0; }
.test-modal-backdrop[hidden] { display:none !important; }
.test-modal.large { width:min(1000px,96vw); }
.test-modal-scroll { max-height:72vh; overflow:auto; margin-top:18px; }
.test-modal-close { width:40px; height:40px; display:grid; place-items:center; border:1px solid var(--test-border); border-radius:10px; background:var(--test-surface); color:inherit; font-size:1.7rem; cursor:pointer; }
.test-modal-close:hover { background:rgba(148,163,184,.16); }

.test-analysis-toggle { margin-top:14px; }
.test-analysis-content[hidden] { display:none !important; }
.test-analysis-content { margin-top:14px; }
