:root {
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-600: #5558ee;
  --success: #22c55e;
  --danger: #ef4444;
  --outline: rgba(255,255,255,0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1000px 600px at 20% 0%, #111827, #0b1021), var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-header, .app-footer {
  width: 100%;
  max-width: 920px;
  padding: 16px 20px;
}
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.header-left { display: grid; gap: 4px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.user-email { align-self: center; font-size: 0.9rem; opacity: 0.8; }
.admin-btn { white-space: nowrap; }
.app-title { margin: 8px 0 0; font-weight: 700; letter-spacing: 0.3px; }
.progress { color: var(--muted); margin-top: 4px; }

.quiz, .result {
  width: 100%;
  max-width: 920px;
  padding: 20px;
  margin-left: auto;
  margin-right: auto;
}

.notice {
  margin: 8px 0 16px;
  color: var(--muted);
}

.question-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 18px 18px 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.question-meta { color: var(--muted); margin-bottom: 6px; font-size: 14px; }
.question-text { margin: 8px 0 12px; font-size: 20px; line-height: 1.35; }
.question-text { word-break: break-word; overflow-wrap: anywhere; }

.options { display: grid; gap: 10px; margin: 10px 0 6px; }
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--outline);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.option:hover { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.04); }
.option input { width: 18px; height: 18px; accent-color: var(--primary); }
.option span { flex: 1; word-break: break-word; overflow-wrap: anywhere; }

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  color: white;
  cursor: pointer;
  font-weight: 600;
}
.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-600); }
.btn.secondary { background: #334155; }
.btn.secondary:hover { background: #283548; }
.btn.success { background: var(--success); }
.btn.success:hover { filter: brightness(0.95); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { filter: brightness(0.95); }
.btn.outline { background: transparent; border: 1px solid var(--outline); color: var(--text); }

.hidden { display: none; }

.result { text-align: left; }
.result h2 { margin: 12px 0; }
.result-actions { display: flex; gap: 10px; margin-top: 8px; }
.mistakes { margin-top: 12px; border-top: 1px solid var(--outline); padding-top: 12px; }
.mistakes-item { margin: 8px 0; padding: 10px; border: 1px solid var(--outline); border-radius: 10px; background: rgba(255,255,255,0.02); }
.mistakes-item h3 { margin: 0 0 6px; font-size: 16px; }
.mistakes-item .answer-row { font-size: 14px; color: var(--muted); }
.mistakes-item .label { color: var(--text); }

.app-footer { color: var(--muted); text-align: center; }

.login-section { width: 100%; max-width: 920px; padding: 20px; margin-left: auto; margin-right: auto; }
.login-card { background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); border: 1px solid var(--outline); border-radius: 14px; padding: 18px; margin: 0 auto; }
.login-tabs { display: flex; gap: 10px; margin-bottom: 12px; }
.login-form { display: grid; gap: 12px; max-width: 360px; }
.login-form.hidden { display: none; }
.login-form label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-form input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--outline); background: rgba(255,255,255,0.03); color: var(--text); }
.login-error { color: #fca5a5; min-height: 18px; }

@media (max-width: 520px) {
  .question-text { font-size: 18px; }
  .app-header, .app-footer { padding: 12px 14px; }
  .quiz, .result, .login-section { padding: 16px; }
  .btn { padding: 10px 12px; }
}


