/* Billions Network look & feel
   Primary: #0046FF; Secondary: #3EFFC8, #0095FF, #C4FF3C, #61D433, #FF5983, #DE481F
   Source: Brand manual. */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
   --fg: var(#222222);
  --bg: #dfeef2;
  --text: #222222;
  --muted: #b9d2ff; /* soft blue for supportive text */
  --qc: 333333:
  --glass: rgba(255, 255, 255, 0.1);
  --glass-2: rgba(255, 255, 255, 0.2);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  --radius-xl: 24px;

  /* Billions brand */
  --brand: #0046ff; /* primary blue */
  --brand-700: #0032b8; /* darker shade for hover */
  --ink: #000000;
  --paper: #ffffff;

  /* Secondary accents (from brand sheet) */
  --cyan: #3effc8;
  --blue-1: #0095ff;
  --green-1: #c4ff3c;
  --green-2: #61d433;
  --pink: #ff5983;
  --red: #de481f;

  /* Utility blends */
  --progress-grad: linear-gradient(90deg, var(--brand), #ef9eec, var(--cyan));
  /* --progress-grad: linear-gradient(90deg, var(--brand), var(--cyan)); */
  --quiz-grad: linear-gradient(135deg, var(--blue-1) 0%, var(--brand) 100%);
}

* {
  box-sizing: border-box;
}
html,
body {
  /* height: 100%; */
  scroll-behavior: smooth;
}
body {
  margin: 0;
  /* font-family: "Inter", sans-serif; */
  color: var(--fg);

  font-family: "Roboto", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
}

/* Background: deep navy -> brand blue */

.page-bg {
  min-height: 100%;
  background-color: var(--bg);
  color: var(--fg);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* Header */
.header {
  text-align: center;
  margin: 24px 0 36px;
}

.title {
  font-family: "Montserrat", sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  margin: 0 0 12px;
}

.title {
  position: relative;
}
.title::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  margin: 2px auto 12px;
  background: linear-gradient(90deg, #0046ff, #3effc8);
  border-radius: 2px;
  animation: glow 1s infinite alternate;
}
@keyframes glow {
  from {
    box-shadow: 0 0 4px #0046ff;
  }
  to {
    box-shadow: 0 0 12px #3effc8;
  }
}

.header-img {
  width: 150px; /* make the logo small */
  height: auto;
  display: block;
  margin: 0 auto 0 auto; /* remove bottom margin */
  padding: 0; /* remove bottom padding */
}
@media (min-width: 414px) {
  .header-img {
    width: 80px;
  }
}

.subtitle-container {
  font-size: 18px;
  /* color: var(--muted); */
  margin: 0;
  font-weight: 400;

  font-family: "Playpen Sans Arabic", cursive;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  margin: 24px 0;
}

.subtitle {
  margin: 0;
}

.subtitle span {
  font-family: "Blaka Ink", system-ui;
  font-style: normal;
  font-size: 20px;
}

.subtitle-text {
  font-size: 16px;
  margin: 0;
  font-weight: 400;
}

/* .subtitle-container {
  line-height: 1; 
} */

.subtitle,
.subtitle-text {
  display: block; /* stacked */
  margin: 0; /* remove browser default spacing */
  padding: 0;
  line-height: 1.2; /* optional: adjust text compactness */
}

/* Sections */
.section {
  margin-bottom: 48px;
}
.section-title {
  font-family: "Libertinus Keyboard", system-ui;

  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  margin: 0 0 36px;
}
.center {
  text-align: center;
}
.mt-lg {
  margin-top: 24px;
}

/* Grids */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.quantity {
  max-width: 1000px;
  margin: 0 auto;
}
.quantity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 0 auto 24px;
}
@media (min-width: 768px) {
  .quantity-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Difficulty Cards – mapped to brand secondaries */
.difficulty-card {
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  cursor: pointer;
}
.difficulty-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.22);
}
.difficulty-easy {
  background: linear-gradient(135deg, #00d9bb 0%, #00bfa5 100%);
  /* background: linear-gradient(135deg, #3effc8 0%, #00bfa5 100%); */
} /* fresh green */
/* .difficulty-easy{background:linear-gradient(135deg, var(--green-1), var(--green-2))}        fresh green */
.difficulty-medium {
  background: linear-gradient(135deg, var(--blue-1), var(--brand));
} /* blues */
.difficulty-hard {
  background: linear-gradient(135deg, #151a35 0%, #1e2447 50%, #0e1225 100%);
}

.difficulty-hard {
  background: linear-gradient(135deg, var(--pink), var(--red));
}

.card-img {
  display: block; /* ✅ fix: image should be block, not flex */
  width: 56px; /* force smaller width */
  height: 56px; /* keep square (or set height:auto for natural ratio) */
  margin: 0 auto 0; /* centers the image horizontally */
  object-fit: contain; /* keep proportions inside the box */
}

.card-title {
  font-size: 24px;
  margin: 0 0 8px;
  font-weight: 700;
}
.card-text {
  opacity: 0.9;
  margin: 0 0 10px;
}
.card-footnote {
  font-size: 17px;
  opacity: 0.8;
}

/* bronze */
.text-bronze {
  background: linear-gradient(45deg, #cd7f32, #b87333, #8c6239);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* silver */
.text-silver {
  background: linear-gradient(45deg, #c0c0c0, #e0e0e0, #a9a9a9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* gold */
.text-gold {
  background: linear-gradient(45deg, #ffd700, #ffc300, #ffb700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* Quantity selectors */
.quantity-selector {
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  background: var(--glass);
  border: 2px solid var(--glass-2);
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s, color 0.25s;
  color: --qc;
  background: linear-gradient(135deg, #3effc8 0%, #00bfa5 100%);
}
.quantity-selector:hover {
  transform: translateY(-3px);
}
.quantity-selector.selected {
  /* background: rgba(62, 255, 200, 0.25);
  border-color: var(--cyan); */

  background: rgba(62, 255, 200, 0.25);
  border-color: #00bfa5;
}

.quantity-selector.selected {
  border: 2px solid #3effc8;
  box-shadow: 0 0 12px #3effc8;
}

.quantity-number {
  font-size: 22px;
  font-weight: 700;
}
.quantity-label {
  font-size: 13px;
  opacity: 0.85;
}

/* Buttons */
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover {
  transform: scale(1.05);
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 70, 255, 0.35);
  padding: 16px 36px;
  margin-bottom: 12px;
}
.btn-primary:hover {
  background: var(--brand-700);
}
.btn-light {
  background: #fff;
  color: var(--brand);
}
.btn-light:hover {
  background: #f6f8ff;
}
.btn-accent {
  background: var(--cyan);
  color: #001b3f;
  border: 2px solid transparent;
}
.btn-accent:hover {
  filter: saturate(1.08);
}
.mr {
  margin-right: 12px;
}
.ml {
  margin-left: 12px;
}

.mt {
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

/* Screens */
.setup-screen,
.quiz-screen {
  max-width: 960px;
  margin: 0 auto;
}

.results-screen {
  max-width: 840px;
  margin: 0 auto;
}

/* Quiz Header */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.quiz-meta .meta-label {
  font-size: 12px;
  opacity: 0.75;
}
.quiz-meta .meta-value {
  font-size: 20px;
  font-weight: 700;
}
.quiz-meta.right {
  text-align: right;
}
.capitalize {
  text-transform: capitalize;
}

/* Timer */
.timer {
  display: flex;
  align-items: center;
  gap: 16px;
}
.timer-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--brand) 0deg,
    var(--brand) 0deg,
    transparent 0deg
  );
  transition: background 0.1s linear, transform 0.1s ease;
}
.timer-text {
  font-size: 28px;
  font-weight: 700;
  color: --fg;
}
.timer-warning {
  animation: pulse 0.5s infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.timer-warning {
  animation: pulse 0.6s infinite;
}
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 6px red;
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 18px red;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 6px red;
  }
}

/* Progress */
.progress-track {
  background: var(--glass-2);
  border-radius: 999px;
  height: 12px;
  margin-bottom: 24px;
}
.progress-bar {
  height: 12px;
  border-radius: 999px;
  width: 0%;
  transition: width 0.5s ease;
  background: var(--progress-grad);
}

/* Quiz Card */
.quiz-card {
  /* background: var(--quiz-grad); */
  background-color: #284fcd;
  border-radius: var(--radius-xl);
  padding: 32px;
  color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.question {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 700;
  margin: 0 0 24px;
  line-height: 1.4;
}

/* Options */
.options .option-button {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 16px;
  font-weight: 600;
  background: var(--glass);
  border: 2px solid transparent;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s,
    border-color 0.2s, opacity 0.2s;
  margin-bottom: 12px;
  font-size: 16px;
}
.options .option-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.18);
}

/* End-state feedback colors (kept, but re-hued to brand) */
.option-correct {
  background: linear-gradient(
    135deg,
    var(--green-1),
    var(--green-2)
  ) !important;
  color: #001a2a !important;
}
.option-correct {
  animation: correctFlash 0.8s ease;
}
@keyframes correctFlash {
  0% {
    background: #61d433;
  }
  100% {
    background: linear-gradient(135deg, #3effc8, #00bfa5);
  }
}

.option-incorrect {
  background: linear-gradient(135deg, var(--pink), var(--red)) !important;
  color: #fff !important;
}
.option-dim {
  opacity: 0.5;
}

/* Results */
.text-center {
  text-align: center;
}
.results-head {
  margin-bottom: 24px;
}
.result-emoji {
  font-size: 56px;
  margin-bottom: 16px;
}
.result-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}
.result-score {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 8px;
}
.result-message {
  font-size: 16px;
  opacity: 0.92;
  margin: 0 0 16px;
}
.stats-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.stats-card {
  background: var(--glass);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}
.stats-emoji {
  font-size: 24px;
  margin-bottom: 8px;
}
.stats-value {
  font-size: 28px;
  font-weight: 800;
}
.stats-label {
  opacity: 0.78;
}
.actions {
  text-align: center;
}

/* Effects */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Disable hover once locked (matches your JS behavior) */
.option-button.locked {
  pointer-events: none;
}
.option-button.locked:hover {
  transform: none;
  box-shadow: none;
}

.footer {
  margin: 12px 0 20px;
}

.footer-container {
  display: block;
  text-align: center;
}

a {
  display: block;
  margin-bottom: 4px;
}

.no-style {
  color: #222;
  text-decoration: none;
}

.footer-container div {
  padding: 0 0 8px 0;
}

.footer-container-text {
  font-size: 16px;
  font-weight: bold;
}


.fa-book {
  color: #1e3a8a; /* deep blue */
}

.fa-thumbs-up {
  color: #16a34a; /* green */
}

.fa-gift {
  color: #ec4899; /* pink */
}

.fa-award {
  color: #facc15; /* golden yellow */
}

/* =========================
   THEME TOGGLE (top-right)
   ========================= */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(6px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.theme-toggle:hover {
  transform: scale(1.06);
}
.theme-toggle i {
  font-size: 18px;
}

/* DARK MODE (black & white style) */
body.dark {
  --fg: #eef1ff; /* text */
  --bg: #0f0f23; /* background */
}

/* Make the toggle look right in both themes */
body.dark .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
body.dark .theme-toggle i {
  color: #eef1ff;
}

/* Optional: ensure generic text inherits your var colors */
body {
  color: var(--fg);
}

/* If you want links inside the footer/title to keep readable in dark */
body.dark a {
  color: #cfe2ff;
}


/* Show focus ring only for keyboard users */
.option-button:focus { outline: none; }
.option-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}


/* On touch devices, don't keep :hover styles after tap */
@media (hover: none) {
  .options .option-button:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
    background: var(--glass);
  }
}

.option-button.is-touching {
   outline: 2px solid currentColor;
  outline-offset: 2px;
}