*{box-sizing:border-box} body{margin:0;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;color:#0f172a;background:#f8fafc} .hidden{display:none!important}.muted{color:#64748b}.small{font-size:12px}.locked{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#0f172a;color:white}.lock-card{background:#111827;border:1px solid #334155;padding:32px;border-radius:18px;max-width:680px}.lock-card code{background:#020617;padding:3px 6px;border-radius:6px}.topbar{height:88px;background:white;border-bottom:1px solid #dbe3ef;display:flex;align-items:center;justify-content:space-between;padding:14px 18px;gap:16px}.title-block h1{margin:0;font-size:24px}.subtitle{font-size:13px;color:#64748b;margin-top:6px}.top-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.mode-switch{display:flex;border:1px solid #cbd5e1;border-radius:12px;overflow:hidden;background:#f8fafc}.mode-switch button{border:0;border-right:1px solid #cbd5e1;border-radius:0;background:transparent}.mode-switch button:last-child{border-right:0}button{border:1px solid #cbd5e1;background:white;border-radius:10px;padding:9px 13px;font-weight:700;color:#1e293b;cursor:pointer}button:hover{background:#f1f5f9}button.active,button.primary{background:#1e3a68;color:white;border-color:#1e3a68}button.danger{background:#fff1f2;color:#be123c;border-color:#fecdd3}button.danger:hover{background:#ffe4e6}input{border:1px solid #cbd5e1;border-radius:10px;padding:10px 12px;font-size:14px;background:white}#searchInput{width:280px}.layout{height:calc(100vh - 88px);display:grid;grid-template-columns:280px 8px minmax(360px,1fr) 8px 44%;overflow:hidden}.pane{height:100%;overflow:auto;background:white}.left-pane{border-right:1px solid #dbe3ef;padding:14px}.middle-pane{padding:16px}.right-pane{border-left:1px solid #dbe3ef;padding:16px;background:#fbfdff}.splitter{background:#e2e8f0;cursor:col-resize}.splitter:hover{background:#94a3b8}.pane-header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;border-bottom:1px solid #e2e8f0;padding-bottom:12px;margin-bottom:14px}.pane-header h2{margin:0;font-size:18px}.tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}.tabs button{font-size:13px;padding:9px 7px}.category-list{display:flex;flex-direction:column;gap:8px}.cat-item{border:1px solid #d7dfed;border-radius:12px;padding:10px 12px;background:white;cursor:pointer}.cat-item:hover,.cat-item.active{border-color:#1e3a68;background:#eef5ff}.cat-name{font-weight:800;font-size:14px}.cat-num{color:#64748b;font-size:12px;margin-top:4px}.db-panel{display:flex;flex-direction:column;gap:8px;margin-top:16px}.db-panel h3{margin:0 0 4px 0}.question-list,.related-list{display:flex;flex-direction:column;gap:16px}.card{border:1px solid #d7dfed;border-radius:16px;background:white;padding:16px;box-shadow:0 1px 2px rgba(15,23,42,.04)}.card.related{background:#fff}.badges{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}.badge{display:inline-block;background:#e2e8f0;color:#334155;border-radius:999px;padding:4px 8px;font-weight:800;font-size:12px}.badge.official{background:#dbeafe;color:#1e3a8a}.badge.id{background:#e0e7ff;color:#1e3a68}.question-text{white-space:pre-wrap;line-height:1.48;font-size:15px;margin:8px 0 12px}.options{display:flex;flex-direction:column;gap:7px;margin:10px 0}.option{padding:9px 10px;background:#f8fafc;border:1px solid transparent;border-radius:10px;line-height:1.35}.practice .option{cursor:pointer;border-color:#e2e8f0}.option.selected{border-color:#1e3a68;background:#eef5ff}.option.correct{border-color:#16a34a;background:#ecfdf5}.option.wrong{border-color:#dc2626;background:#fff1f2}.answer-box{border-top:1px solid #e2e8f0;margin-top:12px;padding-top:12px}.answer-box strong{color:#166534}.explanation{white-space:pre-wrap;line-height:1.48;margin-top:8px}.card-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.pipe-table{border-collapse:collapse;margin:10px 0;width:max-content;min-width:55%;font-size:14px}.table-wrap{overflow:auto;max-width:100%}.pipe-table th,.pipe-table td{border:1px solid #cbd5e1;padding:6px 9px;text-align:left}.pipe-table th{background:#f1f5f9}.exam-setup,.exam-panel,.exam-result{border:1px solid #d7dfed;border-radius:16px;background:white;padding:18px;margin-bottom:16px}.setup-grid{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr));gap:12px;margin:12px 0}.setup-grid label{font-weight:800;font-size:13px}.setup-grid input{width:100%;margin-top:6px}.allocation-table{width:100%;border-collapse:collapse;margin:14px 0}.allocation-table th,.allocation-table td{border:1px solid #d7dfed;padding:9px;text-align:left}.allocation-table th{background:#f1f5f9}.allocation-table input{width:90px}.exam-actions,.exam-nav{display:flex;gap:10px;flex-wrap:wrap}.exam-status{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e2e8f0;padding-bottom:12px;margin-bottom:14px}.exam-question-num{font-size:13px;color:#64748b;margin-bottom:10px}.exam-option{display:block;width:100%;text-align:left;margin:8px 0}.exam-option.selected{background:#1e3a68;color:white;border-color:#1e3a68}.result-summary{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:14px}.result-stat{background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:12px}.result-stat b{display:block;font-size:22px}.review-list{display:flex;flex-direction:column;gap:12px}.review-item{border:1px solid #e2e8f0;border-radius:12px;padding:12px}.review-item.good{border-color:#86efac;background:#f0fdf4}.review-item.bad{border-color:#fecaca;background:#fff7f7}@media(max-width:1000px){.topbar{height:auto;align-items:flex-start;flex-direction:column}.layout{height:auto;min-height:calc(100vh - 120px);display:block}.pane{height:auto;max-height:none}.splitter{display:none}.setup-grid,.result-summary{grid-template-columns:1fr 1fr}#searchInput{width:100%}}

/* v5.1 additions */
.badge.bad{background:#fee2e2;color:#991b1b}.badge.star{background:#fef3c7;color:#92400e}.badge.muted-badge{background:#e5e7eb;color:#6b7280}.mode-note{border:1px dashed #cbd5e1;border-radius:12px;padding:10px;margin-bottom:8px;background:#f8fafc}.check-row{display:flex;align-items:center;gap:8px;font-weight:700;font-size:13px}.check-row input{width:auto}.empty-state{border:1px dashed #cbd5e1;border-radius:16px;padding:24px;color:#64748b;background:#f8fafc}.review-item.unanswered{border-color:#fde68a;background:#fffbeb}.mobile-menu-btn,.mobile-overlay,.close-related-btn{display:none}.mode-switch{max-width:100%;flex-wrap:wrap}.mode-switch button{white-space:nowrap}.topbar{position:sticky;top:0;z-index:20;transition:transform .25s ease, opacity .25s ease}.left-pane{transition:transform .25s ease}.right-pane{transition:transform .25s ease}.mobile-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:40}

@media(max-width:1000px){
  body{overflow-x:hidden}.topbar{padding:12px 12px 12px 56px;position:sticky;top:0;z-index:30;box-shadow:0 2px 8px rgba(15,23,42,.08)}.topbar-hidden .topbar{transform:translateY(-110%);opacity:.05}.mobile-menu-btn{display:block;position:fixed;top:12px;left:12px;z-index:60;border-radius:12px;background:#1e3a68;color:#fff;border-color:#1e3a68;font-size:20px;padding:8px 11px;line-height:1}.top-controls{width:100%;justify-content:flex-start}.mode-switch{width:100%;display:grid;grid-template-columns:repeat(3,1fr);border-radius:12px}.mode-switch button{font-size:12px;padding:8px 4px;border-bottom:1px solid #cbd5e1}.mode-switch button:nth-child(3n){border-right:0}.mode-switch button:nth-last-child(-n+2){border-bottom:0}#searchInput{width:100%;box-sizing:border-box}.layout{display:block;height:auto;min-height:100vh;overflow:visible}.middle-pane{padding:12px;min-height:100vh}.pane-header{align-items:flex-start}.left-pane{position:fixed;top:0;bottom:0;left:0;width:min(86vw,340px);max-width:340px;height:100vh;z-index:50;transform:translateX(-105%);box-shadow:8px 0 24px rgba(15,23,42,.25);border-right:1px solid #cbd5e1;overflow:auto;padding-top:64px}.mobile-menu-open .left-pane{transform:translateX(0)}.mobile-menu-open .mobile-overlay{display:block}.right-pane{position:fixed;right:10px;left:10px;bottom:10px;top:70px;height:auto;z-index:55;border:1px solid #cbd5e1;border-radius:18px;box-shadow:0 12px 36px rgba(15,23,42,.28);padding:12px;background:#fff;transform:translateY(110%);overflow:auto}.related-open .right-pane{transform:translateY(0)}.related-open .mobile-overlay{display:block}.close-related-btn{display:inline-block;margin-left:8px;padding:5px 9px;font-size:12px}.splitter{display:none!important}.setup-grid,.result-summary{grid-template-columns:1fr 1fr}.allocation-table{font-size:12px}.allocation-table input{width:72px}.card{padding:12px;border-radius:14px}.question-text{font-size:15px}.option,.exam-option{font-size:14px}.card-actions button,.exam-actions button,.exam-nav button{flex:1 1 auto}.pipe-table{font-size:12px;min-width:620px}.table-wrap{margin-left:-2px;margin-right:-2px}.badge{font-size:11px}.title-block h1{font-size:20px}.subtitle{font-size:12px}.db-panel input{width:100%;box-sizing:border-box}
}

@media(max-width:520px){.setup-grid,.result-summary{grid-template-columns:1fr}.mode-switch{grid-template-columns:repeat(2,1fr)}.mode-switch button:nth-child(3n){border-right:1px solid #cbd5e1}.mode-switch button:nth-child(2n){border-right:0}.top-controls>button{flex:1 1 calc(50% - 8px)}.exam-status{align-items:flex-start;gap:6px;flex-direction:column}.right-pane{top:58px;left:6px;right:6px;bottom:6px}.middle-pane{padding:10px}.card{padding:11px}}
button:disabled{opacity:.45;cursor:not-allowed}button:disabled:hover{background:white}

.related-controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.related-controls button{font-size:12px;padding:6px 9px}.related-options{margin-top:10px}

.history-action-bar{display:flex;gap:8px;align-items:center;padding:10px 14px;border-bottom:1px solid #e5e7eb;background:#fff;position:sticky;top:0;z-index:5;}
.history-action-bar.hidden{display:none;}
.history-action-bar button{font-size:13px;}
