:root {
  --app-bg: #f5f7fb;
  --panel-bg: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --primary: #2563eb;
  --green: #16a34a;
  --yellow: #f59e0b;
  --red: #dc2626;
  --line: #dbe3ef;
}

* {
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.view {
  min-height: 100vh;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.7);
}

.login-view {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), transparent 45%),
    linear-gradient(225deg, rgba(22, 163, 74, 0.12), transparent 45%),
    var(--app-bg);
}

.login-card,
.panel,
.question-panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-card {
  width: min(100%, 430px);
  padding: 28px;
}

.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
  font-size: 1.05rem;
}

.top-bar,
.quiz-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.panel {
  padding: 18px;
}

.action-button {
  min-height: 52px;
  font-weight: 700;
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.topic-item:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.topic-item .form-check-input {
  width: 1.25rem;
  height: 1.25rem;
}

.lesson-list {
  margin-top: 10px;
  padding-left: 32px;
  color: var(--muted);
  font-size: 0.92rem;
}

.question-limit {
  width: 112px;
}

.leaderboard-list,
.history-list,
.review-list,
.badge-list {
  display: grid;
  gap: 10px;
}

.dashboard-rewards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reward-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.reward-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.reward-value {
  font-size: 1.35rem;
  font-weight: 900;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 8px 8px 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 800;
}

.game-badge.new-badge {
  background: #fef3c7;
  color: #92400e;
}

.leaderboard-row,
.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.leaderboard-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.admin-table th,
.admin-table td {
  white-space: nowrap;
}

.admin-table td:first-child,
.admin-table th:first-child {
  min-width: 160px;
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fef3c7;
  color: #92400e;
  font-weight: 800;
}

.score-chip {
  border-radius: 999px;
  padding: 6px 10px;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
  white-space: nowrap;
}

.timer-pill {
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 8px 14px;
  font-weight: 800;
  min-width: 76px;
  text-align: center;
}

.question-panel {
  padding: 20px;
}

.question-text {
  font-size: clamp(1.15rem, 2.8vw, 1.5rem);
  font-weight: 800;
  line-height: 1.45;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-button {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  font-weight: 700;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.option-button:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.option-button.selected {
  border-color: var(--primary);
  background: #dbeafe;
}

.score-display {
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin: 8px 0 12px;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.stat-pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.review-question {
  font-weight: 800;
  margin-bottom: 10px;
}

.answer-line {
  margin: 6px 0;
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

@media (min-width: 768px) {
  .panel,
  .question-panel {
    padding: 24px;
  }
}
