:root {
  --bg-deep: #060d1a;
  --bg-card: rgba(15, 30, 55, 0.75);
  --bg-card-solid: #0f1e37;
  --accent: #22d3ee;
  --accent-hover: #06b6d4;
  --accent-glow: rgba(34, 211, 238, 0.35);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --danger: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(34, 211, 238, 0.15);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #060d1a 0%, #0a1628 100%);
  z-index: -1;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== LOGIN ===== */
.login-card, .result-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow);
}

.logo-area {
  text-align: center;
  margin-bottom: 28px;
}

.logo-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 0 24px var(--accent-glow);
}

.logo-area h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-area h1 span {
  color: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

.status .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(6, 13, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #fff;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.25);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  width: 100%;
}

.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.5;
}

/* ===== EXAM HEADER ===== */
#exam-screen {
  flex-direction: column;
  padding: 0;
}

.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(15, 30, 55, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.logo-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}

#student-info {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 320px;
}

.progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

#question-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-right {
  min-width: 80px;
  text-align: right;
}

.timer {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  padding: 6px 12px;
  border-radius: 8px;
}

.timer.warning {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.15);
}

.timer.danger {
  color: var(--danger);
  background: rgba(244, 63, 94, 0.15);
  animation: pulse 1s infinite;
}

/* ===== QUESTION ===== */
.exam-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.question-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.q-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.q-text {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 24px;
  font-weight: 500;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(6, 13, 26, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.option:hover {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
}

.option.selected {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.15);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.option input {
  display: none;
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

.option.selected .option-letter {
  background: var(--accent);
  color: #0a1628;
}

.option-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.45;
  padding-top: 3px;
}

/* ===== FOOTER NAV ===== */
.exam-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(15, 30, 55, 0.9);
  border-top: 1px solid var(--border);
  justify-content: center;
  flex-wrap: wrap;
}

.exam-footer .btn {
  min-width: 140px;
}

/* ===== RESULT ===== */
.score-display {
  text-align: center;
  margin: 20px 0 28px;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 30px var(--accent-glow);
}

.score-circle span {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.score-circle small {
  font-size: 0.9rem;
  color: var(--text-muted);
}

#score-percent {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
}

#score-message {
  color: var(--text-muted);
  margin-top: 4px;
}

.result-details {
  background: rgba(6, 13, 26, 0.5);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.7;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.review-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child {
  border-bottom: none;
}

.review-item.correct {
  border-left: 3px solid var(--success);
  padding-left: 12px;
}

.review-item.wrong {
  border-left: 3px solid var(--danger);
  padding-left: 12px;
}

.review-q {
  font-weight: 500;
  margin-bottom: 6px;
}

.review-ans {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .exam-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-left {
    min-width: auto;
  }
  #student-info {
    max-width: 120px;
    font-size: 0.8rem;
  }
  .question-card {
    padding: 20px 16px;
  }
  .q-text {
    font-size: 0.98rem;
  }
  .exam-footer .btn {
    min-width: 120px;
    font-size: 0.9rem;
  }
}

/* ===== ESSAY ===== */
.essay-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  background: rgba(6, 13, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.essay-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.essay-textarea::placeholder {
  color: var(--text-muted);
}

/* ===== LOGIN EXTRA ===== */
.login-extra {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 4px 0;
}
.btn-link:hover { color: var(--accent-hover); }
.sep { color: var(--text-muted); font-size: 0.85rem; }

/* ===== NAV STRIP ===== */
.nav-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(15, 30, 55, 0.85);
  border-bottom: 1px solid var(--border);
  justify-content: center;
  max-height: 90px;
  overflow-y: auto;
}
.nav-dot {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(6, 13, 26, 0.6);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.nav-dot:hover { border-color: var(--accent); color: var(--text); }
.nav-dot.current {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.2);
  color: var(--accent);
}
.nav-dot.answered {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--success);
  color: #6ee7b7;
}
.nav-dot.unanswered {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.4);
}

/* ===== ADMIN ===== */
.admin-card {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.admin-actions .btn { width: auto; flex: 1; min-width: 120px; }
.admin-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.admin-list {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 13, 26, 0.4);
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.admin-row:last-child { border-bottom: none; }
.admin-row .info { flex: 1; min-width: 160px; }
.admin-row .score { font-weight: 600; color: var(--accent); min-width: 70px; }
.admin-row .btn-del {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.admin-row .btn-del:hover { background: rgba(244, 63, 94, 0.35); }

@media (max-width: 600px) {
  .exam-footer { gap: 8px; }
  .exam-footer .btn { min-width: 90px; font-size: 0.8rem; padding: 10px 12px; }
  .nav-dot { width: 28px; height: 28px; font-size: 0.7rem; }
}

.login-card-wide { max-width: 480px; }

.pack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.pack-item {
  text-align: left;
  padding: 12px 14px;
  background: rgba(6, 13, 26, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-family: inherit;
  width: 100%;
}

.pack-item:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
}

.pack-item.selected {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.15);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.pack-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pack-item .pack-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.pack-item .pack-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.pack-item .pack-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.pack-item .pack-badge.invalid {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
}

/* Anti-cheat overlay */
.anticheat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.anticheat-box {
  background: var(--bg-card-solid, #0f1e37);
  border: 1px solid var(--danger, #f43f5e);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 0 40px rgba(244, 63, 94, 0.3);
}
.anticheat-box h2 {
  color: #fda4af;
  margin-bottom: 12px;
}
.anticheat-box p {
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Admin tabs */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.admin-tab {
  flex: 1;
  min-width: 100px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(6, 13, 26, 0.5);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.admin-tab.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.admin-tab-panel input[type="text"],
.admin-tab-panel input[type="password"],
.admin-tab-panel input[type="number"],
.admin-tab-panel input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  background: rgba(6, 13, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.analisis-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.analisis-row .bar {
  height: 6px;
  background: rgba(148,163,184,0.2);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.analisis-row .bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}
.toggle-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}
