:root {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #6dd5ed, #2193b0);
}

.app-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  padding: 32px;
  width: 100%;
  max-width: 560px;
}

/* Fixed countdown badge, top-right corner of the viewport */
.timer-badge {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 56px;
  text-align: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: #1b3a4b;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.timer-badge[data-warning="true"] {
  background: #c0392b;
}

/* Fixed back-navigation link, top-left corner of the viewport, mirrors the timer badge */
.back-to-topics-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 10px 16px;
  border-radius: 999px;
  background: white;
  color: #2193b0;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid #2193b0;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.back-to-topics-btn:hover {
  background: #eef6f9;
}

.back-btn {
  margin-top: 12px;
  background: transparent;
  color: #2193b0;
  border: 2px solid #2193b0;
}

.back-btn:hover {
  background: #eef6f9;
}

.difficulty-grid {
  grid-template-columns: 1fr;
}

.difficulty-btn-easy {
  background: #27ae60;
}

.difficulty-btn-medium {
  background: #e08e0b;
}

.difficulty-btn-hard {
  background: #c0392b;
}

/* Login / register form */
.auth-tagline {
  font-weight: 600;
  color: #1b3a4b;
}

.auth-subtagline {
  margin: 0 0 8px;
  color: #7c8894;
  font-size: 0.85rem;
  text-align: center;
}

.auth-info {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #eafaf1;
  color: #1e8449;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
}

.auth-benefits {
  list-style: none;
  margin: 4px 0 4px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #eef6f9;
  color: #2c4a5c;
  line-height: 1.9;
  font-weight: 600;
  font-size: 0.92rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 20px 0 8px;
}

.auth-label {
  display: block;
  font-weight: 600;
  color: #4a4a4a;
  margin-top: 10px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid #d5dbe0;
  font-size: 1rem;
}

.auth-input:focus {
  outline: none;
  border-color: #2193b0;
}

/* Fixed account/logout bar, bottom-right corner, stays out of the way of the card */
.account-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: white;
  color: #1b3a4b;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.logout-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #fdecea;
  color: #a93226;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn:hover {
  background: #f8d7d3;
}

/* Timer on/off toggle on the difficulty screen */
.timer-toggle {
  margin: 16px 0;
  text-align: center;
}

.timer-toggle-label {
  display: block;
  color: #4a4a4a;
  font-weight: 600;
  margin-bottom: 8px;
}

.timer-toggle-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.toggle-btn {
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid #d5dbe0;
  background: white;
  color: #4a4a4a;
  font-weight: 600;
  cursor: pointer;
}

.toggle-btn-active {
  border-color: #2193b0;
  background: #2193b0;
  color: white;
}

/* Start screen */
.start-card h1 {
  text-align: center;
  margin-bottom: 4px;
  color: #1b3a4b;
}

.subtitle {
  text-align: center;
  color: #4a4a4a;
  margin-top: 0;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.grade-btn {
  position: relative;
  padding: 16px 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  background: #2193b0;
  color: white;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.grade-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.grade-btn-disabled {
  background: #d5dbe0;
  color: #7c8894;
  cursor: not-allowed;
}

.badge {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  margin-top: 4px;
}

.rules {
  color: #4a4a4a;
  line-height: 1.8;
}

.status {
  text-align: center;
  color: #2193b0;
}

.error {
  text-align: center;
  color: #c0392b;
  font-weight: 600;
}

/* Quiz screen */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #4a4a4a;
  font-weight: 600;
  margin-bottom: 12px;
}

.topic-badge {
  background: #eef6f9;
  color: #2193b0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: capitalize;
}

.question-text {
  color: #1b3a4b;
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.rule-table {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 20px;
  border-collapse: collapse;
  background: #fdf8ef;
  border: 2px solid #e8d9b8;
  border-radius: 10px;
  overflow: hidden;
}

.rule-table th,
.rule-table td {
  padding: 8px 16px;
  text-align: center;
  border-bottom: 1px solid #e8d9b8;
  font-size: 1.05rem;
  color: #1b3a4b;
}

.rule-table th {
  background: #f3e6c4;
  font-weight: 800;
}

.rule-table tr:last-child td {
  border-bottom: none;
}

.rule-table-blank {
  display: inline-block;
  min-width: 28px;
  padding: 2px 6px;
  border: 2px dashed #2193b0;
  border-radius: 6px;
  color: #2193b0;
  font-weight: 800;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  font-size: 1rem;
  border: 2px solid #d5dbe0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: #2193b0;
}

.option-btn:disabled {
  cursor: not-allowed;
}

.option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  flex-shrink: 0;
}

@keyframes option-correct-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.option-correct {
  border-color: #27ae60;
  background: #eafaf1;
  animation: option-correct-pop 0.4s ease;
}

@keyframes option-shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-8px);
  }
  40%,
  60% {
    transform: translateX(8px);
  }
}

.option-wrong {
  border-color: #c0392b;
  background: #fdecea;
  animation: option-shake 0.5s ease;
}

.option-tried {
  opacity: 0.6;
}

.attempts-row {
  margin-top: 16px;
  color: #4a4a4a;
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  animation: feedback-in 0.3s ease;
}

.feedback-correct {
  background: #eafaf1;
  color: #1e8449;
  animation: feedback-in 0.3s ease, option-correct-pop 0.4s ease 0.2s;
}

.feedback-wrong {
  background: #fdecea;
  color: #a93226;
  animation: feedback-in 0.3s ease, option-shake 0.5s ease 0.25s;
}

.feedback-exhausted {
  background: #fdf3e3;
  color: #9c6b04;
}

.continue-btn {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: #2193b0;
  color: white;
  cursor: pointer;
}

.continue-btn:hover {
  background: #1b7690;
}

/* Hint button + revealed hint text */
.hint-row {
  margin-top: 14px;
}

.hint-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid #e08e0b;
  background: white;
  color: #e08e0b;
  font-weight: 700;
  cursor: pointer;
}

.hint-btn:hover:not(:disabled) {
  background: #fdf3e3;
}

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

@keyframes hint-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hint-box {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdf3e3;
  color: #9c6b04;
  font-weight: 600;
  animation: hint-in 0.3s ease;
}

@keyframes explanation-card-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes title-wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-6deg) translateY(-2px);
  }
  50% {
    transform: rotate(6deg);
  }
  75% {
    transform: rotate(-3deg);
  }
}

/* "Teacher" step-by-step solution card, shown after a wrong/timed-out answer */
.explanation-card {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #eef6f9;
  border: 2px dashed #2193b0;
  animation: explanation-card-in 0.4s ease;
}

.explanation-title {
  display: inline-block;
  font-weight: 800;
  color: #1b3a4b;
  margin-bottom: 8px;
  animation: title-wiggle 0.6s ease 0.3s;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.explanation-steps li {
  opacity: 0;
  animation: step-in 0.4s ease forwards;
}

.explanation-steps {
  margin: 0;
  padding-left: 20px;
  color: #2c4a5c;
  line-height: 1.6;
}

/* Result screen */
.result-card {
  text-align: center;
}

.medal-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 8px auto 16px;
  padding: 16px 28px;
  border-radius: 20px;
  animation: medal-pop 0.5s ease;
}

.medal-emoji {
  font-size: 3.2rem;
  line-height: 1;
}

.medal-label {
  font-weight: 800;
  font-size: 1.05rem;
}

.medal-gold {
  background: linear-gradient(160deg, #fff6d8, #ffdf7e);
  box-shadow: 0 8px 20px rgba(212, 160, 23, 0.35);
}

.medal-gold .medal-label {
  color: #8a6d1a;
}

.medal-silver {
  background: linear-gradient(160deg, #f4f6f8, #d7dde3);
  box-shadow: 0 8px 20px rgba(120, 130, 140, 0.3);
}

.medal-silver .medal-label {
  color: #55606a;
}

.medal-bronze {
  background: linear-gradient(160deg, #f3d9c2, #d9995f);
  box-shadow: 0 8px 20px rgba(150, 92, 36, 0.3);
}

.medal-bronze .medal-label {
  color: #7a4a1c;
}

@keyframes medal-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.score-line {
  font-size: 1.2rem;
  color: #1b3a4b;
}

.score-pct {
  font-size: 2.4rem;
  font-weight: 800;
  color: #2193b0;
  margin: 4px 0;
}

.message {
  color: #4a4a4a;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .options-grid {
    grid-template-columns: 1fr;
  }

  .grade-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Admin dashboard */
.admin-nav-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  cursor: pointer;
}

.admin-nav-btn:hover {
  background: #dcedf3;
}

.change-password-nav-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  cursor: pointer;
}

.change-password-nav-btn:hover {
  background: #dcedf3;
}

.support-nav-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  cursor: pointer;
}

.support-nav-btn:hover {
  background: #dcedf3;
}

.support-card {
  max-width: 640px;
  text-align: left;
}

.support-textarea {
  resize: vertical;
  font-family: inherit;
}

.support-history-title {
  margin-top: 24px;
}

.support-request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.support-request-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f9fa;
  border: 1px solid #e3e8ea;
}

.support-request-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.support-request-subject {
  font-weight: 700;
  color: #1b3a4b;
}

.support-status {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.support-status-open {
  background: #fff3cd;
  color: #8a6100;
}

.support-status-resolved {
  background: #e6f6ec;
  color: #1e8449;
}

.support-request-message {
  margin: 0;
  color: #45545e;
  white-space: pre-wrap;
}

.support-reply {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef6f9;
  color: #1b3a4b;
  white-space: pre-wrap;
}

.admin-support-list {
  margin-bottom: 20px;
}

.support-admin-actions {
  margin-top: 8px;
}

.support-reply-form {
  list-style: none;
  padding: 12px 14px;
  margin: -6px 0 0;
  border-radius: 0 0 12px 12px;
  background: #f0f6f8;
  border: 1px solid #e3e8ea;
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-card {
  max-width: 960px;
  text-align: left;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-header h1 {
  margin: 0;
  color: #1b3a4b;
}

.admin-header .back-btn {
  margin-top: 0;
  width: auto;
  padding: 10px 18px;
}

.admin-section-title {
  color: #1b3a4b;
  margin: 24px 0 10px;
  font-size: 1.05rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.admin-stat-card {
  background: #eef6f9;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #2193b0;
}

.admin-stat-label {
  font-size: 0.75rem;
  color: #4a4a4a;
  margin-top: 2px;
}

.admin-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  padding: 10px 4px 0;
  background: #f7fafb;
  border-radius: 12px;
  overflow-x: auto;
}

.admin-chart-bar-wrap {
  flex: 1 0 14px;
  min-width: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.admin-chart-bar {
  width: 100%;
  min-height: 2px;
  background: #2193b0;
  border-radius: 4px 4px 0 0;
}

.admin-chart-label {
  font-size: 0.6rem;
  color: #7c8894;
  margin-top: 4px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f3;
}

.admin-table th {
  color: #7c8894;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.admin-badge-online,
.admin-badge-offline {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-badge-online {
  background: #eafaf1;
  color: #1e8449;
}

.admin-badge-offline {
  background: #f1f3f4;
  color: #7c8894;
}

.admin-action-btn {
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-action-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.admin-kick-btn {
  background: #fff3cd;
  color: #8a6100;
}

.admin-delete-btn {
  background: #fdeaea;
  color: #b3261e;
}

.admin-reset-btn {
  background: #eef6f9;
  color: #2193b0;
}

.admin-action-group {
  display: flex;
  gap: 6px;
}

.admin-reset-form-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
  padding-bottom: 10px;
}

.admin-reset-form-cell .admin-settings-input {
  max-width: 220px;
}

/* Admin dashboard: free-tier settings panel */
.admin-settings-panel {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef6f9;
}

.admin-settings-label {
  display: block;
  font-weight: 700;
  color: #1b3a4b;
  margin-bottom: 8px;
}

.admin-settings-label-spaced {
  margin-top: 16px;
}

.admin-settings-row {
  display: flex;
  gap: 10px;
}

.admin-settings-input {
  width: 100px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid #d5dbe0;
  font-size: 1rem;
}

.admin-settings-input:focus {
  outline: none;
  border-color: #2193b0;
}

.admin-settings-save {
  margin-top: 0;
  width: auto;
  padding: 10px 20px;
}

.admin-settings-hint {
  margin: 8px 0 0;
  color: #7c8894;
  font-size: 0.8rem;
}

.admin-category-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 16px;
  margin-bottom: 10px;
}

.admin-category-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #1b3a4b;
  font-size: 0.9rem;
  cursor: pointer;
}

.admin-settings-success {
  margin: 8px 0 0;
  color: #1e8449;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Per-category "how this works" blurb on the difficulty screen */
.tutorial-card {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef6f9;
  border: 2px solid #cde7ee;
  text-align: left;
}

.tutorial-title {
  font-weight: 800;
  color: #1b3a4b;
  margin-bottom: 6px;
}

.tutorial-blurb {
  margin: 0 0 8px;
  color: #2c4a5c;
  line-height: 1.5;
}

.tutorial-example {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: white;
  color: #1b3a4b;
  font-weight: 700;
}

.tutorial-example-label {
  color: #2193b0;
  font-weight: 800;
}

.tutorial-tip {
  margin: 0;
  color: #4a4a4a;
  font-size: 0.9rem;
}

/* Intro / marketing landing page (shown before login, once per visit) */
.intro-card {
  position: relative;
  max-width: 620px;
  text-align: center;
}

/* Full-viewport animated math-icon background, shared across every screen. */
.bg-floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

@keyframes bg-float {
  0% {
    transform: translate(0, 0) rotate(-12deg) scale(1);
  }
  25% {
    transform: translate(16px, -26px) rotate(10deg) scale(1.12);
  }
  50% {
    transform: translate(-10px, -44px) rotate(-8deg) scale(0.95);
  }
  75% {
    transform: translate(-20px, -16px) rotate(12deg) scale(1.08);
  }
  100% {
    transform: translate(0, 0) rotate(-12deg) scale(1);
  }
}

@keyframes bg-float-alt {
  0% {
    transform: translate(0, 0) rotate(8deg) scale(1);
  }
  30% {
    transform: translate(-18px, -20px) rotate(-10deg) scale(1.1);
  }
  60% {
    transform: translate(14px, -38px) rotate(14deg) scale(0.94);
  }
  100% {
    transform: translate(0, 0) rotate(8deg) scale(1);
  }
}

.bg-floating-icon {
  position: absolute;
  opacity: 0.4;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
  animation-name: bg-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  user-select: none;
}

.bg-floating-icon:nth-child(even) {
  animation-name: bg-float-alt;
}

.intro-content {
  position: relative;
  z-index: 1;
}

@keyframes intro-title-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.intro-title {
  margin-bottom: 6px;
  color: #1b3a4b;
  animation: intro-title-bounce 2s ease-in-out infinite;
}

.intro-tagline {
  margin: 0 0 14px;
  color: #2193b0;
  font-weight: 700;
  font-size: 1.05rem;
}

/* Landing page: grade picker card + creative stats card side by side */
.start-screen-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  width: 100%;
  max-width: 960px;
}

.start-screen-wrap .start-card,
.start-screen-wrap .stats-card {
  flex: 1 1 420px;
}

.stats-card h2 {
  margin-top: 0;
  color: #1b3a4b;
}

.stats-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.accuracy-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.accuracy-ring-inner {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.accuracy-pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1b3a4b;
}

.accuracy-caption {
  font-size: 0.75rem;
  color: #6b7c85;
}

.stats-detail {
  flex: 1 1 180px;
}

.stats-tier {
  font-weight: 700;
  color: #2193b0;
  margin: 0 0 6px;
}

.stats-answered {
  margin: 0 0 6px;
  color: #444;
}

.stats-rank {
  margin: 0;
  font-weight: 700;
  color: #1b3a4b;
}

.stats-rank-pending {
  color: #6b7c85;
  font-weight: 500;
}

.leaderboard-panel {
  margin-top: 20px;
  border-top: 1px solid #e0e0e0;
  padding-top: 14px;
}

.leaderboard-panel h3 {
  margin: 0 0 10px;
  color: #1b3a4b;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f4f8f9;
}

.leaderboard-row-you {
  background: #e3f6ff;
  font-weight: 700;
  border: 1px solid #2193b0;
}

.leaderboard-rank {
  width: 28px;
  text-align: center;
}

.leaderboard-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-pct {
  font-weight: 700;
  color: #2193b0;
}

.view-leaderboard-link {
  display: inline-block;
  margin-top: 16px;
  border: none;
  background: none;
  color: #2193b0;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.view-leaderboard-link:hover {
  text-decoration: underline;
}

/* Full leaderboard screen */
.leaderboard-card {
  max-width: 720px;
}

.lb-grade-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.lb-grade-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 2px solid #d5dbe0;
  background: #fff;
  color: #4a5a63;
  font-weight: 700;
  cursor: pointer;
}

.lb-grade-btn-active {
  border-color: #2193b0;
  background: #2193b0;
  color: #fff;
}

.leaderboard-table th,
.leaderboard-table td {
  text-align: center;
}

.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
  text-align: left;
}

.lb-rank-cell {
  font-weight: 700;
  color: #1b3a4b;
}

.lb-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.lb-sortable-th:hover {
  color: #2193b0;
}

.lb-pct-cell {
  font-weight: 700;
  color: #2193b0;
}

.lb-pct-empty {
  color: #9aa7ae;
  font-weight: 500;
}

.lb-answered-count {
  font-weight: 500;
  color: #7c8894;
  font-size: 0.78rem;
}

.lb-row-you {
  background: #e3f6ff;
}

.lb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
}

.lb-pagination .continue-btn {
  width: auto;
  margin-top: 0;
  padding: 10px 20px;
}

.lb-pagination .continue-btn:disabled {
  opacity: 0.5;
  cursor: default;
  background: #9aa7ae;
}

.lb-page-label {
  font-weight: 700;
  color: #1b3a4b;
}


.intro-blurb {
  margin: 0 0 16px;
  color: #4a4a4a;
  line-height: 1.6;
}

.intro-features {
  list-style: none;
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #eef6f9;
  color: #2c4a5c;
  line-height: 1.9;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
}

@keyframes cta-pulse {
  0%,
  100% {
    box-shadow: 0 8px 20px rgba(33, 147, 176, 0.35);
  }
  50% {
    box-shadow: 0 10px 28px rgba(33, 147, 176, 0.65);
  }
}

.intro-cta {
  animation: cta-pulse 1.8s ease-in-out infinite;
}

.intro-badge-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.intro-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fdf3e3;
  color: #9c6b04;
  font-weight: 700;
  font-size: 0.8rem;
}

.intro-footer-caption {
  margin: 14px 0 0;
  text-align: center;
  color: #9aa7ae;
  font-weight: 600;
  font-size: 0.85rem;
}

.intro-contact-caption {
  margin: 6px 0 0;
  text-align: center;
  color: #9aa7ae;
  font-weight: 600;
  font-size: 0.8rem;
}

.intro-contact-link {
  color: #2f80a9;
  font-weight: 700;
  text-decoration: none;
}

.intro-contact-link:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .bg-floating-icon {
    opacity: 0.22;
  }
}

/* Premium locks + upgrade paywall */
.grade-btn-locked {
  background: #b9c3c8;
  color: white;
}

.badge-premium {
  background: #9c6b04;
}

.quota-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  font-size: 0.78rem;
}

.premium-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fdf3e3;
  color: #9c6b04;
  font-weight: 800;
  font-size: 0.8rem;
}

.manage-sub-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #eef6f9;
  color: #2193b0;
  font-weight: 700;
  cursor: pointer;
}

.manage-sub-btn:hover {
  background: #dcedf3;
}

.billing-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  width: calc(100% - 48px);
  max-width: 520px;
  border-radius: 12px;
  background: #eafaf1;
  border: 1px solid #b9e8c9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  color: #1e8449;
  font-weight: 700;
  text-align: center;
  animation: billing-banner-in 0.25s ease-out;
}

@keyframes billing-banner-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.billing-banner-dismiss {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 800;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Generic in-app confirm modal (replaces native window.confirm popups) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 50, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 24px;
  animation: modal-overlay-in 0.15s ease-out;
}

@keyframes modal-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  animation: modal-card-in 0.2s ease-out;
}

@keyframes modal-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-title {
  margin: 0 0 12px;
  color: #1b3a4b;
}

.modal-body {
  margin: 0 0 24px;
  color: #45545e;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .continue-btn {
  flex: 1;
  margin: 0;
}

.modal-confirm-btn {
  background: #c0392b;
}

.modal-confirm-btn:hover {
  background: #a5281b;
}

.upgrade-nav-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: #fdf3e3;
  color: #9c6b04;
  font-weight: 700;
  cursor: pointer;
}

.upgrade-nav-btn:hover {
  background: #fbe7c4;
}

.upgrade-card {
  text-align: center;
}

.upgrade-reason {
  margin: 4px 0 16px;
  color: #a93226;
  font-weight: 600;
}

.upgrade-features {
  list-style: none;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #eef6f9;
  color: #2c4a5c;
  line-height: 1.9;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
}

.upgrade-price-card {
  margin: 0 0 18px;
  padding: 14px;
  border-radius: 14px;
  background: #fdf3e3;
}

.upgrade-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: #9c6b04;
}

.upgrade-price-note {
  margin-top: 4px;
  color: #9c6b04;
  font-size: 0.8rem;
}

.upgrade-cta {
  background: #e08e0b;
}

.upgrade-cta:hover {
  background: #c67c09;
}


