* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; background: #f5f5f5; padding: 20px; }
.container { max-width: 900px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
h1 { margin-bottom: 30px; color: #333; }
h2 { margin: 25px 0 15px; color: #555; font-size: 1.3em; }

.exam-type-tabs { display: flex; gap: 10px; margin-bottom: 30px; }
.exam-type-tabs button { flex: 1; padding: 12px; border: 2px solid #ddd; background: white; cursor: pointer; border-radius: 8px; font-size: 1em; transition: all 0.3s; }
.exam-type-tabs button.active { background: #007bff; color: white; border-color: #007bff; }
.exam-type-tabs button:hover { border-color: #007bff; }

.controls { display: none; }
.controls.active { display: block; }

.single-topic-controls label { display: inline-block; margin-right: 20px; margin-bottom: 15px; }
.single-topic-controls select, .single-topic-controls input { margin-left: 8px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; }

.multi-topic-section { margin-top: 20px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; max-height: 400px; overflow-y: auto; padding: 15px; background: #f9f9f9; border-radius: 8px; }

.topic-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: white; border: 2px solid #e0e0e0; border-radius: 6px; transition: all 0.2s; }
.topic-item:hover { border-color: #007bff; }
.topic-item.selected { border-color: #007bff; background: #f0f7ff; }

.topic-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.topic-item label { flex: 1; cursor: pointer; font-size: 0.9em; }
.topic-item select { padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85em; }

.quick-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.quick-actions button { padding: 10px 20px; background: #6c757d; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9em; }
.quick-actions button:hover { background: #5a6268; }

.selection-summary { background: #e7f3ff; padding: 15px; border-radius: 8px; margin-bottom: 20px; }
.selection-summary h3 { font-size: 1.1em; margin-bottom: 8px; color: #0056b3; }
.selection-summary p { margin: 5px 0; color: #333; }

.start-button { background: #28a745; color: white; padding: 15px 40px; border: none; border-radius: 8px; font-size: 1.1em; cursor: pointer; font-weight: 600; margin-top: 20px; width: 100%; }
.start-button:hover { background: #218838; }
.start-button:disabled { background: #6c757d; cursor: not-allowed; }

.qbox { margin: 20px 0; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; }
.qbox strong { display: block; margin-bottom: 12px; color: #333; font-size: 1.05em; }
.options { margin-top: 10px; }
.options label { display: block; padding: 10px; margin: 8px 0; background: white; border: 2px solid #e0e0e0; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.options label:hover { border-color: #007bff; background: #f8f9fa; }
.options input[type="radio"] { margin-right: 10px; cursor: pointer; }

.feedback-correct { color: #28a745; font-weight: bold; margin-top: 8px; padding: 8px; background: #d4edda; border-radius: 4px; }
.feedback-wrong { color: #dc3545; font-weight: bold; margin-top: 8px; padding: 8px; background: #f8d7da; border-radius: 4px; }

#resultArea .qbox { background: white; }
#resultArea h3 { color: #28a745; font-size: 1.5em; margin-bottom: 20px; padding: 15px; background: #d4edda; border-radius: 8px; text-align: center; }

.topic-wise-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; margin: 20px 0; }
.topic-score-card { padding: 15px; background: #f8f9fa; border-left: 4px solid #007bff; border-radius: 6px; }
.topic-score-card h4 { margin-bottom: 8px; color: #333; }
.topic-score-card p { margin: 4px 0; font-size: 0.9em; color: #666; }

.search-topics { width: 100%; padding: 10px; margin-bottom: 15px; border: 2px solid #ddd; border-radius: 6px; font-size: 1em; }
.search-topics:focus { outline: none; border-color: #007bff; }


/* hide exam controls by default to avoid flash on URL auto-start */
.exam-type-tabs,
#singleTopicControls,
#multiTopicControls {
  display: none;
}

.exam-type-tabs.visible {
  display: flex;
}

#singleTopicControls.visible,
#multiTopicControls.visible {
  display: block;
}
