:root {
  --border-radius: 8px;
  --transition: background 0.2s, color 0.2s;
}

/* =========================
   Global Reset & Base Layout
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Ubuntu, Roboto, Oxygen, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

#wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  width: 100%;
}

.centered {
  margin-inline: auto;
  text-align: center;
}

/* =========================
   Header
========================= */

header {
  margin: 0;
  padding: 0;
  width: 100%;
}

#crypto-bar {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 1rem;
  padding: 0.5em 1em;
  height: 5em;
}

#crypto-logo {
  height: 3rem;
  width: 3rem;
  border-radius: 10%;
  object-fit: cover;
}

#crypto-prices {
  flex-grow: 10em;
  min-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-line;
}

.clickable-icon {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  user-select: none;
  transition: var(--transition);
}

/* =========================
   Navigation & Filters
========================= */

nav[aria-label="Quiz Filters"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 500px;
  margin-inline: auto;
  padding-inline: 0.5em;
  width: 100%;
  text-align: center;
}

.dropdown {
  width: 100%;
  max-width: 500px;
  margin: 1em auto;
  position: relative;
  text-align: center;
}

.dropdown-toggle {
  cursor: pointer;
  border-radius: 5px;
  padding: 0.6em 1.4em;
  width: 100%;
  text-align: left;
}

.dropdown-menu {
  display: none;
  position: absolute;
  border-radius: 5px;
  list-style: none;
  padding: 0.5em 0;
  margin: 0;
  min-width: 180px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 10;
  top: 100%;
  left: 0;
}

.dropdown-menu li {
  padding: 0.5em 1em;
  cursor: pointer;
  text-align: left;
}

.dropdown.show .dropdown-menu {
  display: block;
}

/* =========================
   Quiz UI Elements
========================= */

main#quiz-container,
.choices,
.shuffle-wrapper,
.explanation,
.question,
.button-group {
  margin: 0 auto;
  text-align: center;
  width: 100%;
  max-width: 500px;
  padding-inline: 0.5em;
}

.question {
  font-family: 'Ubuntu', sans-serif;
  font-size: 1.4em;
  line-height: 1.5;
  text-align: center;
  padding: 1em;
  margin: 0 auto 1em;
  max-width: 100%;
  word-wrap: break-word;

  /* === Structured box layout === */
  border-radius: var(--border-radius);
  min-height: 4.5em; /* keeps height consistent across questions */
  display: flex;
  align-items: center;
  justify-content: center;
}

.choices {
  max-width: 450px;
}

.choice-btn {
  display: block;
  width: 100%;
  margin: 0.25em auto;
  padding: 0.8em 1.2em;
  font-size: 1em;
  text-align: center;
}

.dimmed {
  opacity: 0.5;
}

.dimmed:hover {
  opacity: 0.7;
}

.explanation {
  margin-top: 1rem;
  padding: 1rem;
  border: 4px solid;
  border-radius: var(--border-radius);
}

/* =========================
   Buttons & Controls
========================= */

.button-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2em auto;
  max-width: 500px;
  padding-inline: 0.5em;
}

.shuffle-wrapper {
  text-align: center;
  margin: 1.5em 0 1em;
}

.shuffle,
.show-answers-btn,
.circle-btn {
  display: grid;
  place-items: center;
  width: 3em;
  height: 3em;
  border-radius: 50%;
  border: none;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
}

.circle-btn.active {
  border: 2px solid;
}

.level-btn,
.category-btn,
.dropdown-toggle {
  appearance: none;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 0.6em 1.4em;
  font-size: 1em;
  font-weight: 600;
  border: none;
  width: 100%;
  transition: transform 0.2s ease;
}

.highlight {
  border: 0.5em solid;
  font-weight: bold;
}

/* =========================
   Tag Filter
========================= */

/* Base layout for tag filters */
.tag-filter {
  position: relative; /* Needed for fade overlay positioning */
  width: 100%;
  max-width: 100%; /* No hard lock */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.tag-filter::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tag-filter,
.tag-filter-list {
  background: transparent !important;
  box-shadow: none !important;
}

/* Inner flex list */
.tag-filter-list {
  display: flex;
  gap: 0.5em;
  padding: 0 0.5em; /* breathing room left/right */
  flex-wrap: nowrap; /* force single row on mobile */
  margin-bottom: 1em;
}

/* Allow wrap on desktop */
@media (min-width: 769px) {
  .tag-filter-list {
    flex-wrap: wrap;
    justify-content: center; /* center pills when wrapping */
  }
}

.tag-filter-btn {
  flex: 0 0 auto; /* don’t shrink */
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}


/* =========================
   Ad Placements
========================= */

#ad-slot,
#ezoic-pub-ad-placeholder-101 {
  margin: 1rem auto;
  padding: 0.5rem;
  text-align: center;
  width: 100%;
  max-width: 320px;
  overflow: hidden;
}

@media (min-width: 768px) {
  #ezoic-pub-ad-placeholder-101 {
    max-width: 728px;
    min-height: 90px;
  }
}

/* =========================
   Footer
========================= */

footer {
  text-align: center;
  font-size: 0.9em;
  margin-top: 2em;
  margin-bottom: 2rem;
}

#social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1em;
  margin: 1em;
}

#social-links img {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#brand-tagline {
  text-align: center;
  margin: 1em 0;
}

#copyright {
  text-align: center;
  font-size: 0.9rem;
}

/* =========================
   Animations
========================= */

.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

/* =========================
   Install Button (PWA)
========================= */

#pwaInstallBanner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  padding: 1em;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
  animation: slideUp 0.4s ease-out;
  flex-wrap: wrap;
}

body.banner-visible {
  padding-bottom: 80px;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

#pwaInstallBanner.hidden {
  transform: translateY(100%);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 600px;
  width: 100%;
  padding-inline: 1em;
}

.pwa-banner-actions {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

@media (max-width: 600px) {
  .pwa-banner-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .pwa-banner-actions {
    justify-content: center;
    width: 100%;
  }
}

#pwaInstallBanner button {
  border: none;
  padding: 0.5em 1em;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: bold;
}

/* =========================
   Modal
========================= */

.figure-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.figure-modal.hidden {
  display: none;
}

.figure-content {
  padding: 1rem;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 80vh;
  position: relative;
}

.figure-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 4px;
}

.close-button {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.question-image {
  cursor: pointer;
  margin-top: 1rem;
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
  margin-inline: auto;
}

/* ============================
   Stats Card Styles (base.css)
============================ */

#score-card {
  position: fixed;
  top: 10vh;
  left: 50%;
  transform: translateX(-50%);
  padding: 1.5em;
  border: 1px solid;
  border-radius: 12px;
  z-index: 9999;
  width: 90%;
  max-width: 400px;
  font-family: sans-serif;
}

#score-card h3 {
  margin-top: 0;
  border-bottom: 1px solid;
  padding-bottom: 0.25em;
  margin-bottom: 0.5em;
}

.score-list {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5em;
}

.score-list li {
  padding: 0.25em 0;
}

.score-clear,
.score-close {
  margin-top: 1em;
  display: block;
  width: 100%;
  border: none;
  padding: 0.6em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

.score-card.hidden {
  display: none;
}

.score-card {
  max-height: 90vh;
  overflow: hidden;
  position: relative;
}

.score-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.subcategory-header {
  text-align: center;
  padding: 0.5rem;
  margin-top: 1rem;
  border-radius: 6px;
  font-weight: bold;
}

.progress-bar {
  border-radius: 8px;
  height: 12px;
  width: 100%;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.progress-info {
  font-size: 0.85rem;
  margin-top: 4px;
}

.custom-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.custom-modal {
  padding: 1.5em;
  border-radius: 12px;
  max-width: 300px;
  text-align: center;
}

.custom-modal p {
  margin-bottom: 1em;
}

.modal-buttons {
  display: flex;
  gap: 0.5em;
  justify-content: center;
}

.modal-confirm,
.modal-cancel {
  border: none;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
}

/* Stats Bar */
#statsBar {
  margin: 2em auto 0;     /* space above + center horizontally */
  text-align: center;
  max-width: 150px;
  height: 5em;
  padding-inline: 0.5em;
  border-radius: 8px;
}