body.theme-one {
  --sky-top: #ead9d6;
  --sky-bottom: #a9cbbd;
  --mint: #a9cbbd;
  --peach: #e2a07d;
  --sun: #f0c277;
  --coral: #d87890;
  --berry: #e59ab3;
  --leaf: #8cc9b0;
  --lavender: #b3a7c9;
  --ink: #2e2a2c;
  --card: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 40px rgba(45, 42, 50, 0.15);
  --page-bg: #f1eae9;
  --muted-text: rgba(45, 42, 50, 0.7);
  --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
  --badge-gradient-start: var(--sun);
  --badge-gradient-end: var(--peach);
  --answer-bg: rgba(255, 255, 255, 0.8);
  --answer-border: rgba(45, 42, 50, 0.1);
  --answer-text: inherit;
  --answer-hover-border: rgba(255, 143, 171, 0.6);
  --answer-selected-bg: rgba(255, 205, 219, 0.6);
  --answer-selected-border: var(--coral);
  --answer-selected-shadow: 0 12px 18px rgba(255, 143, 171, 0.25);
  --primary-bg: linear-gradient(135deg, var(--coral), var(--berry));
  --primary-shadow: 0 10px 20px rgba(255, 143, 171, 0.4);
  --primary-text: #fff;
  --secondary-bg: linear-gradient(135deg, #f5c68a, #f0b876);
  --secondary-shadow: 0 10px 20px rgba(245, 198, 138, 0.3);
  --secondary-text: #fff;
  --input-bg: var(--leaderboard-bg);
  --input-border: rgba(45, 42, 50, 0.1);
  --input-focus: var(--coral);
  --input-shadow: 0 0 0 3px rgba(255, 143, 171, 0.25);
  --leaderboard-bg: rgba(255, 255, 255, 0.8);
  --leaderboard-border: 1px solid rgba(255, 255, 255, 0.9);
  --hr-color: rgba(255, 255, 255, 0.6);
  --background-sprite-opacity: 0.95;
  --body-font: "Baloo 2", "Nunito", "Comic Neue", "Trebuchet MS", sans-serif;
  --display-font: "Baloo 2", "Nunito", "Comic Neue", "Trebuchet MS", sans-serif;
  --display-text-color: inherit;
}

body.theme-monika {
  --sky-top: #0a2333;
  --sky-bottom: #0f4056;
  --mint: #63c39a;
  --peach: #ff8f6b;
  --sun: #f5c45b;
  --coral: #ff4f9a;
  --berry: #ff2f84;
  --leaf: #8dd156;
  --lavender: #4ba3b7;
  --ink: #f6f2ff;
  --card: rgba(9, 28, 40, 0.92);
  --shadow: 0 24px 50px rgba(2, 10, 16, 0.45);
  --page-bg: #071d2a;
  --accent-gradient: linear-gradient(135deg, #ff2f84 0%, #ff6fa8 45%, #f5c45b 100%);
  --accent-shadow: 0 8px 20px rgba(255, 47, 132, 0.4);
  --badge-gradient-start: #3d0229;
  --badge-gradient-end: #570247;
  --muted-text: rgba(230, 242, 255, 0.78);
  --answer-bg: rgba(12, 36, 50, 0.95);
  --answer-border: rgba(245, 196, 91, 0.35);
  --answer-text: rgba(247, 248, 255, 0.95);
  --answer-hover-border: rgba(245, 196, 91, 0.75);
  --answer-selected-bg: rgba(245, 196, 91, 0.2);
  --answer-selected-border: rgba(245, 196, 91, 0.95);
  --answer-selected-shadow: 0 8px 14px rgba(245, 196, 91, 0.22);
  --primary-bg: linear-gradient(135deg, #f5c45b, #ff8f6b);
  --primary-shadow: 0 6px 14px rgba(245, 196, 91, 0.2);
  --primary-text: #1a1a1a;
  --secondary-bg: linear-gradient(135deg, #67d08f, #4ba3b7);
  --secondary-shadow: 0 6px 14px rgba(75, 163, 183, 0.22);
  --secondary-text: #071d2a;
  --input-bg: var(--leaderboard-bg);
  --input-border: rgba(245, 196, 91, 0.55);
  --input-focus: rgba(245, 196, 91, 0.963);
  --input-shadow: 0 0 0 3px rgba(245, 196, 91, 0.2);
  --leaderboard-bg: rgba(12, 36, 50, 0.92);
  --leaderboard-border: 1px solid rgba(245, 196, 91, 0.45);
  --hr-color: rgba(255, 255, 255, 0.6);
  --background-sprite-opacity: 0.25;
  --display-text-color: inherit;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font, inherit);
  font-size: calc(1rem * var(--body-font-scale, 1));
  color: var(--ink);
  background: var(--page-bg, #f1eae9);
  position: relative;
  overflow-x: hidden;
}

body.theme-loading .app,
body.theme-loading .background {
  opacity: 0;
}

.theme-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg, #f1eae9);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.theme-loading .theme-loading-overlay {
  opacity: 1;
  pointer-events: all;
}

.theme-loading-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(45, 42, 50, 0.15);
  border-top-color: var(--coral, #d87890);
  animation: theme-spin 0.8s linear infinite;
}

@keyframes theme-spin {
  to {
    transform: rotate(360deg);
  }
}

.background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.rainbow-glow {
  position: absolute;
  width: 2600px;
  height: 2400px;
  right: -1080px;
  top: -100px;
  background: radial-gradient(
    circle at 65% 60%,
    #d8748f 0 12%,
    #d8748f 12% 17%,
    #d98c7c 17% 23%,
    #e2a07d 23% 29%,
    #f0c277 29% 35%,
    #a9cbbd 35% 41%,
    #8cc9b0 41% 47%,
    #b3a7c9 47% 53%,
    #d6c1d1 53% 59%,
    #edd7cf 59% 65%,
    transparent 65% 100%
  );
  opacity: 0.9;
  z-index: 1;
}

.theme-monika .rainbow-glow {
  width: 140vw;
  height: 140vh;
  left: -20vw;
  top: -20vh;
  background:
    linear-gradient(
      135deg,
      rgba(12, 29, 44, 0.9) 0%,
      rgba(7, 22, 34, 0.65) 45%,
      rgba(10, 28, 40, 0.9) 100%
    ),
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(6, 14, 22, 0.45) 55%,
      rgba(6, 14, 22, 0.75) 100%
    ),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1800 1100'><g stroke='%238dd156' stroke-width='3' stroke-linecap='round' stroke-opacity='0.3' fill='none'><path d='M10 1040c190-320 520-540 980-680'/><path d='M80 1060c180-300 500-520 930-660'/><path d='M160 1070c170-280 470-500 880-640'/><path d='M240 1080c160-260 440-480 830-620'/><path d='M340 1090c140-240 400-450 760-580'/><path d='M460 1080c130-220 360-420 700-540'/><path d='M600 1070c120-210 330-390 650-520'/><path d='M760 1060c110-190 300-360 590-490'/><path d='M920 1050c120-200 310-370 610-500'/><path d='M1080 1040c120-190 300-350 560-470'/><path d='M1240 1030c110-170 260-320 500-430'/><path d='M1380 1020c100-150 230-290 430-400'/></g><g stroke='%2367d08f' stroke-width='2' stroke-linecap='round' stroke-opacity='0.36' fill='none'><path d='M0 900c240-230 460-390 720-540'/><path d='M80 940c220-240 430-400 700-550'/><path d='M180 970c200-230 400-380 650-520'/><path d='M300 1000c190-210 380-350 610-480'/><path d='M420 1020c170-200 350-330 560-450'/><path d='M560 1030c160-180 320-300 520-410'/><path d='M720 1040c150-170 300-280 480-380'/><path d='M900 1020c200-190 390-320 620-430'/><path d='M1080 1000c190-170 360-280 560-380'/><path d='M1260 980c170-150 320-250 500-340'/><path d='M1440 960c150-130 280-220 440-300'/></g></svg>");
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center;
  background-repeat: no-repeat;
}

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

#scoresTable th.sortable .sort-icon {
  opacity: 0.6;
}

#scoresTable th.sortable[aria-sort="ascending"] .sort-icon,
#scoresTable th.sortable[aria-sort="descending"] .sort-icon {
  opacity: 1;
}

.daisies {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  width: 100%;
  height: 280px;
  pointer-events: none;
  z-index: 2;
}

.theme-monika .daisy {
  filter: drop-shadow(0 10px 18px rgba(7, 29, 42, 0.4))
    hue-rotate(115deg) saturate(1.4);
}

.background-sprites {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  width: 100%;
  height: 280px;
  pointer-events: none;
  z-index: 2;
}

.horizon {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20%;
  background: linear-gradient(
    180deg,
    rgba(169, 203, 189, 0) 0%,
    rgba(169, 203, 189, 0.5) 50px,
    #a9cbbd 50px
  );
  z-index: 3;
}

.theme-monika .horizon {
  background: linear-gradient(
    180deg,
    rgba(28, 10, 50, 0) 0%,
    rgba(28, 10, 50, 0.65) 50px,
    #1f0a38 50px
  );
}

.daisy {
  position: absolute;
  width: var(--size, 72px);
  aspect-ratio: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-15%20-15%20130%20130'><g fill='%23fff'><ellipse cx='50' cy='16' rx='12' ry='26'/><ellipse cx='84' cy='36' rx='12' ry='26' transform='rotate(72 84 36)'/><ellipse cx='72' cy='78' rx='12' ry='26' transform='rotate(144 72 78)'/><ellipse cx='28' cy='78' rx='12' ry='26' transform='rotate(216 28 78)'/><ellipse cx='16' cy='36' rx='12' ry='26' transform='rotate(288 16 36)'/></g><circle cx='50' cy='50' r='14' fill='%23f6b21a'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.95;
  filter: drop-shadow(0 8px 12px rgba(230, 197, 171, 0.35));
  transform: rotate(var(--rot, 0deg));
}

.bg-sprite {
  position: absolute;
  width: var(--size, 72px);
  aspect-ratio: 1;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: var(--opacity, var(--background-sprite-opacity, 0.95));
  filter: drop-shadow(0 8px 14px rgba(10, 12, 18, 0.25));
  transform: rotate(var(--rot, 0deg));
}

.bg-sprite--daisy {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-15%20-15%20130%20130'><g fill='%23fff'><ellipse cx='50' cy='16' rx='12' ry='26'/><ellipse cx='84' cy='36' rx='12' ry='26' transform='rotate(72 84 36)'/><ellipse cx='72' cy='78' rx='12' ry='26' transform='rotate(144 72 78)'/><ellipse cx='28' cy='78' rx='12' ry='26' transform='rotate(216 28 78)'/><ellipse cx='16' cy='36' rx='12' ry='26' transform='rotate(288 16 36)'/></g><circle cx='50' cy='50' r='14' fill='%23f6b21a'/></svg>");
}

.bg-sprite--leaf {
  background-image: url("/assets/sprites/leaf.svg");
}

.bg-sprite--hibiscus {
  background-image: url("/assets/sprites/hibiscus.svg");
}

.theme-monika .bg-sprite {
  filter: drop-shadow(0 10px 18px rgba(2, 10, 16, 0.45));
}

.daisy.d1 {
  --size: 110px;
  --rot: -10deg;
  left: 1%;
  top: 5px;
}
.daisy.d2 {
  --size: 75px;
  --rot: 8deg;
  left: 13%;
  top: 125px;
}
.daisy.d3 {
  --size: 90px;
  --rot: -6deg;
  left: 32%;
  top: 10px;
}
.daisy.d4 {
  --size: 70px;
  --rot: 12deg;
  left: 48%;
  top: 140px;
}
.daisy.d5 {
  --size: 105px;
  --rot: -14deg;
  left: 66%;
  top: 0px;
}
.daisy.d6 {
  --size: 85px;
  --rot: 6deg;
  left: 81%;
  top: 110px;
}
.daisy.d7 {
  --size: 95px;
  --rot: -8deg;
  left: 22%;
  top: 35px;
}
.daisy.d8 {
  --size: 65px;
  --rot: 15deg;
  left: 56%;
  top: 65px;
}
.daisy.d9 {
  --size: 80px;
  --rot: -12deg;
  left: 8%;
  top: 180px;
}
.daisy.d10 {
  --size: 100px;
  --rot: 10deg;
  left: 89%;
  top: 25px;
}

.app {
  max-width: 1140px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  position: relative;
  z-index: 10;
}

.hero {
  text-align: left;
  margin-bottom: 32px;
}

.prize-banner {
  display: inline-block;
  background: var(--accent-gradient, linear-gradient(135deg, #f093fb 0%, #f5576c 100%));
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  box-shadow: var(--accent-shadow, 0 4px 12px rgba(245, 87, 108, 0.3));
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.hero h1 {
  font-size: calc(
    clamp(2rem, 2vw + 2rem, 3.2rem) * var(--display-font-scale, 1)
  );
  margin: 12px 0 8px;
  font-family: var(--display-font, var(--body-font, inherit));
  font-weight: normal;
  color: var(--display-text-color, inherit);
}

.hero p {
  font-size: 1.1rem;
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--badge-gradient-start, var(--sun)),
    var(--badge-gradient-end, var(--peach))
  );
  font-size: 0.95rem;
  letter-spacing: 0.4px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 24px;
}

.card {
  background: var(--card);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.subtle {
  margin-top: 0;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

input[type="text"] {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--input-border, rgba(45, 42, 50, 0.1));
  font-size: 1rem;
  background: var(--input-bg, rgba(255, 255, 255, 0.8));
  color: var(--answer-text, inherit);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--input-focus, var(--coral));
  box-shadow: var(--input-shadow, 0 0 0 3px rgba(255, 143, 171, 0.25));
}

.primary {
  border: none;
  background: var(--primary-bg, linear-gradient(135deg, var(--coral), var(--berry)));
  color: var(--primary-text, #fff);
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--primary-shadow, 0 10px 20px rgba(255, 143, 171, 0.4));
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

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

.secondary {
  border: none;
  background: var(--secondary-bg, linear-gradient(135deg, #f5c68a, #f0b876));
  color: var(--secondary-text, #fff);
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--secondary-shadow, 0 10px 20px rgba(245, 198, 138, 0.3));
}

.secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

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

.note {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted-text, rgba(45, 42, 50, 0.7));
}

.section-divider {
  margin: 30px 0;
  border: none;
  border-top: 1px solid var(--hr-color, rgba(0, 0, 0, 0.1));
}

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

.progress {
  font-size: 0.95rem;
}

.timer {
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.image-wrap {
  margin: 18px 0;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.6);
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-wrap img,
.image-wrap video {
  width: 100%;
  display: block;
}

.media-spinner {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 4px solid rgba(216, 116, 143, 0.2);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.answers {
  display: grid;
  gap: 12px;
  margin: 16px 0 20px;
}

.answer-option {
  border: 2px solid var(--answer-border, rgba(45, 42, 50, 0.1));
  background: var(--answer-bg, rgba(255, 255, 255, 0.8));
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--answer-text, inherit);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.answer-option:hover {
  transform: translateY(-1px);
  border-color: var(--answer-hover-border, rgba(255, 143, 171, 0.6));
}

.answer-option.is-selected {
  border-color: var(--answer-selected-border, var(--coral));
  background: var(--answer-selected-bg, rgba(255, 205, 219, 0.6));
  box-shadow: var(--answer-selected-shadow, 0 12px 18px rgba(255, 143, 171, 0.25));
}

.answer-checkbox-label {
  border: 2px solid var(--answer-border, rgba(45, 42, 50, 0.1));
  background: var(--answer-bg, rgba(255, 255, 255, 0.8));
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--answer-text, inherit);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease,
    background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.answer-checkbox-label:hover {
  transform: translateY(-1px);
  border-color: var(--answer-hover-border, rgba(255, 143, 171, 0.6));
}

.answer-checkbox-label:has(input[type="checkbox"]:checked) {
  border-color: var(--answer-selected-border, var(--coral));
  background: var(--answer-selected-bg, rgba(255, 205, 219, 0.6));
  box-shadow: var(--answer-selected-shadow, 0 12px 18px rgba(255, 143, 171, 0.25));
}

.answer-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--answer-selected-border, var(--coral));
}

.answer-checkbox-label input[type="checkbox"]:checked + div span,
.answer-checkbox-label input[type="checkbox"]:checked + span {
  color: var(--answer-selected-border, var(--coral));
  font-weight: 600;
}

.status {
  min-height: 20px;
  font-size: 0.9rem;
  color: var(--muted-text, rgba(45, 42, 50, 0.7));
  margin-bottom: 12px;
}

.result .score {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.score-meta {
  font-size: 1rem;
  margin-bottom: 16px;
}

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

.pill {
  background: rgba(255, 214, 165, 0.8);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--leaderboard-bg, rgba(255, 255, 255, 0.8));
  border-radius: 14px;
  border: var(--leaderboard-border, 1px solid rgba(255, 255, 255, 0.9));
}

.leaderboard-item strong {
  font-size: 1rem;
}

.leaderboard-item span {
  font-size: 0.85rem;
  color: var(--muted-text, rgba(45, 42, 50, 0.7));
}

.muted {
  color: var(--muted-text, rgba(45, 42, 50, 0.7));
}

.is-hidden {
  display: none;
}

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

  .hero {
    text-align: center;
    margin-top: 100px;
  }

  .daisies {
    height: 220px;
    top: 24px;
  }

  .daisy.d1 {
    --size: 72px;
    left: 2%;
    top: 10px;
  }
  .daisy.d2 {
    --size: 46px;
    left: 18%;
    top: 90px;
  }
  .daisy.d3 {
    --size: 52px;
    left: 38%;
    top: 20px;
  }
  .daisy.d4 {
    --size: 44px;
    left: 56%;
    top: 100px;
  }
  .daisy.d5 {
    --size: 66px;
    left: 74%;
    top: 5px;
  }
  .daisy.d6 {
    --size: 50px;
    left: 88%;
    top: 85px;
  }
  .daisy.d7 {
    display: none;
  }
  .daisy.d8 {
    display: none;
  }
  .daisy.d9 {
    display: none;
  }
  .daisy.d10 {
    display: none;
  }
}

@media (max-width: 640px) {
  .background-sprites .bg-sprite {
    display: none;
  }

  .background-sprites .bg-sprite:nth-child(-n + 6) {
    display: block;
    transform: scale(0.75) rotate(var(--rot, 0deg));
  }
}
