* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
}

/* Screens */
.screen {
  display: none;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}
.screen.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  text-align: center;
}

/* Logo */
.logo {
  font-size: 2.2rem;
  font-weight: 800;
  color: #5b21b6;
  margin-bottom: 8px;
  letter-spacing: -1px;
}

.subtitle {
  color: #6b7280;
  font-size: 1rem;
  margin-bottom: 28px;
}

/* Role Buttons */
.role-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.role-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  transition: all 0.2s ease;
}
.role-btn:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.15);
}
.role-icon {
  font-size: 2.4rem;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  color: #1f2937;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}
input:focus {
  border-color: #7c3aed;
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 13px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn.primary {
  background: #7c3aed;
  color: #fff;
}
.btn.primary:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}
.btn.outline {
  background: transparent;
  border: 2px solid #7c3aed;
  color: #7c3aed;
  width: auto;
}
.btn.outline:hover {
  background: #f5f3ff;
}
.btn.small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

/* Back Button */
.back-btn {
  background: none;
  border: none;
  color: #7c3aed;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  display: block;
  text-align: left;
  margin-bottom: 20px;
  padding: 0;
}
.back-btn:hover { text-decoration: underline; }

/* Error / Success */
.error-msg {
  color: #dc2626;
  font-size: 0.875rem;
  min-height: 20px;
  margin-bottom: 10px;
}
.success-msg {
  color: #16a34a;
  font-size: 0.9rem;
  min-height: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}

/* Quiz Header */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
  color: #fff;
}
.quiz-title-text {
  font-weight: 700;
  font-size: 1.05rem;
}
.progress-text {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Quiz Body */
.quiz-body {
  width: 100%;
}
.question-card {
  text-align: left;
}
.question-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: 0.95rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.option-btn:hover:not(:disabled) {
  border-color: #7c3aed;
  background: #f5f3ff;
}
.option-btn.correct {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
  font-weight: 600;
}
.option-btn.wrong {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 600;
}
.option-btn:disabled {
  cursor: default;
}

/* Feedback */
.feedback-msg {
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 24px;
  margin-bottom: 12px;
}
.feedback-msg.correct { color: #16a34a; }
.feedback-msg.wrong   { color: #dc2626; }

/* Result Screen */
.result-card {
  text-align: center;
}
.result-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}
.result-name {
  color: #6b7280;
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(124,58,237,0.4);
}
.result-msg {
  color: #6b7280;
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* Dashboard */
.dashboard {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  max-width: 700px;
  margin: 0 auto;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dash-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1f2937;
}

/* Tabs */
.dash-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 28px;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: inherit;
}
.tab-btn.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section Card */
.section-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: left;
}
.section-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

/* Question Builder */
.question-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: left;
  position: relative;
}
.question-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.question-block-header span {
  font-weight: 700;
  color: #374151;
}
.remove-q-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.remove-q-btn:hover { background: #fef2f2; }

.options-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.option-row input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}
.option-row input[type="radio"] {
  accent-color: #7c3aed;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.option-label {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

/* Results Table */
.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.results-table th {
  background: #f3f4f6;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.results-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  font-size: 0.95rem;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: #faf5ff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red { background: #fee2e2; color: #b91c1c; }

.empty-state {
  text-align: center;
  padding: 48px 0;
  color: #9ca3af;
}
.empty-state p { font-size: 1rem; margin-top: 8px; }

@media (max-width: 480px) {
  .card { padding: 28px 20px; }
  .role-buttons { flex-direction: column; }
  .dashboard { padding: 20px 16px; }
}
