:root {
  --bg-1: #b8e6ff;
  --bg-2: #c9d0ff;
  --bg-3: #ffe3a8;
  --accent-1: #1f7fe0;
  --accent-2: #17a388;
  --accent-3: #ffb347;
  --text-main: #20344d;
  --card-bg: #fff9f1;
  --pill-bg: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  color: var(--text-main);
}

.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  opacity: 0.34;
  animation: drift linear infinite;
}

@keyframes drift {
  0% {
    transform: translateY(100vh) rotate(0deg);
  }
  100% {
    transform: translateY(-20vh) rotate(380deg);
  }
}

/* Legacy decorative classes from previous theme */
.bubble,
.seaweed,
.fish {
  display: none !important;
}

.wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 122px;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 940px;
  margin-bottom: 10px;
}

.breadcrumbs {
  width: 100%;
  max-width: 940px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.breadcrumbs a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumbs [aria-current='page'] {
  color: #fff;
  opacity: 0.95;
}

.back-btn {
  background: linear-gradient(135deg, #ffffff, #f5f8ff);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50px;
  padding: 8px 18px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent-2);
  text-decoration: none;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16), 0 10px 18px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  transition: transform 0.15s;
}

.back-btn:hover {
  transform: translateY(-2px);
}

.nav-icons {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: linear-gradient(135deg, #ffffff, #f6faff);
  border: none;
  border-radius: 50px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.14), 0 10px 16px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-1);
  transition: transform 0.15s;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.02);
}

header {
  text-align: center;
  margin-bottom: 14px;
  animation: popIn 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes popIn {
  0% {
    transform: scale(0.6) rotate(-8deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 1.2px;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2), 8px 8px 24px rgba(0, 0, 0, 0.13);
}

.subtitle {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25);
  margin-top: 4px;
}

.score-bar {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
}

.score-pill {
  background: var(--pill-bg);
  border-radius: 50px;
  padding: 7px 16px;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 3px solid transparent;
}

.score-pill.ok {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.score-pill.ko {
  border-color: #e76f51;
  color: #e76f51;
}

.score-pill.str {
  border-color: var(--accent-1);
  color: var(--accent-1);
}

.screen {
  display: none;
  width: 100%;
  max-width: 940px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.levels-wrap,
.question-card,
.bonus-card,
.result-card,
.lb-card {
  animation: slideUp 0.45s ease;
}

.levels-wrap {
  width: 100%;
  background: linear-gradient(165deg, #fffefb 0%, var(--card-bg) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  padding: 28px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 0 0 4px rgba(255, 255, 255, 0.22);
  position: relative;
  overflow: hidden;
}

.levels-wrap::before {
  content: '';
  position: absolute;
  top: -90px;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--accent-1);
  opacity: 0.16;
}

.levels-wrap::after {
  content: '';
  position: absolute;
  bottom: -70px;
  left: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--accent-2);
  opacity: 0.12;
}

.levels-wrap > * {
  position: relative;
  z-index: 1;
}

.levels-title {
  font-family: 'Fredoka One', cursive;
  color: var(--accent-2);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  margin-bottom: 12px;
  text-align: center;
}

.intro-note {
  background: linear-gradient(135deg, #ffffff, #eef6ff);
  border: 2px dashed rgba(23, 163, 136, 0.45);
  border-radius: 16px;
  padding: 12px 14px;
  color: #3c566f;
  font-weight: 800;
  line-height: 1.5;
  margin: 0 0 14px;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.class-selector-label {
  font-family: 'Fredoka One', cursive;
  color: var(--accent-2);
  text-align: center;
  margin: 4px 0 6px;
  font-size: 0.95rem;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.class-btn {
  background: linear-gradient(145deg, #ffffff, #f4fbff);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 11px 8px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  color: #38556e;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14), 0 12px 18px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.class-btn:nth-child(1) { background: linear-gradient(145deg, #dff4ff, #b8e5ff); color: #17496a; }
.class-btn:nth-child(2) { background: linear-gradient(145deg, #e3ffe9, #bff5ce); color: #215a34; }
.class-btn:nth-child(3) { background: linear-gradient(145deg, #f2e8ff, #ddc6ff); color: #4b2c78; }
.class-btn:nth-child(4) { background: linear-gradient(145deg, #ffe8ef, #ffc7d8); color: #7a2845; }

.class-btn .a-icon {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.class-btn .a-title {
  display: block;
  font-size: 0.88rem;
}

.class-btn .a-sub {
  display: block;
  font-size: 0.7rem;
  opacity: 0.84;
  margin-top: 1px;
}

.class-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.14), 0 14px 20px rgba(0, 0, 0, 0.11);
}

.class-btn.selected {
  border-color: var(--accent-2);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.15), 0 16px 24px rgba(23, 163, 136, 0.24);
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.level-card {
  width: 100%;
  text-align: left;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.14), 0 12px 18px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.level-card:nth-child(1) {
  background: linear-gradient(145deg, #dff4ff, #b8e5ff);
  color: #17496a;
}

.level-card:nth-child(2) {
  background: linear-gradient(145deg, #e3ffe9, #bff5ce);
  color: #215a34;
}

.level-card:nth-child(3) {
  background: linear-gradient(145deg, #f2e8ff, #ddc6ff);
  color: #4b2c78;
}

.level-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.14), 0 14px 20px rgba(0, 0, 0, 0.11);
  border-color: var(--accent-2);
}

.level-card.locked,
.level-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12), 0 8px 14px rgba(0, 0, 0, 0.08);
}

.level-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.level-info {
  min-width: 0;
}

.level-name {
  display: block;
  font-size: 0.98rem;
  line-height: 1.2;
}

.level-classes {
  display: block;
  font-size: 0.76rem;
  opacity: 0.85;
  margin-top: 2px;
}

.level-topics {
  display: block;
  font-size: 0.75rem;
  opacity: 0.82;
  margin-top: 3px;
}

.level-badge {
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-1);
  border-radius: 50px;
  padding: 5px 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
}

.game-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.timer-wrap {
  width: 100%;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50px;
  height: 14px;
  overflow: hidden;
  display: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.timer-wrap.on {
  display: block;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-1));
  border-radius: 50px;
  transition: width 0.1s linear, background 0.5s;
  width: 100%;
}

.timer-bar.danger {
  background: linear-gradient(90deg, #e76f51, #ff9d86);
}

.progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(70, 93, 114, 0.34);
  border: 2px solid rgba(70, 93, 114, 0.78);
}

.dot.cur {
  background: #ffd166;
  border-color: #d39f1a;
  transform: scale(1.25);
}

.dot.ok {
  background: #58c9b9;
  border-color: #1f8a78;
}

.dot.ko {
  background: #ff6b6b;
  border-color: #cc4444;
}

.question-card {
  background: linear-gradient(165deg, #ffffff, #f8fbff);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 26px 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: '';
  position: absolute;
  top: -36px;
  right: -26px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(23, 163, 136, 0.12);
}

.mascot-q {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 1.7rem;
}

.q-emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
}

.q-label {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--accent-1);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.q-text {
  font-size: 1.14rem;
  font-weight: 800;
  line-height: 1.45;
  color: #3f4b53;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.ans-btn {
  border: none;
  border-radius: 16px;
  padding: 14px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  line-height: 1.3;
  min-height: 66px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.ans-btn:nth-child(1) {
  background: linear-gradient(135deg, #2b66d9, #6ea0ff);
  box-shadow: 0 6px 0 #1f4ca1;
}

.ans-btn:nth-child(2) {
  background: linear-gradient(135deg, #2a9d8f, #5fd0bf);
  box-shadow: 0 6px 0 #1f766c;
}

.ans-btn:nth-child(3) {
  background: linear-gradient(135deg, #f2b950, #ffd58f);
  color: #614525;
  box-shadow: 0 6px 0 #ba8527;
}

.ans-btn:nth-child(4) {
  background: linear-gradient(135deg, #e76f51, #ff9d86);
  box-shadow: 0 6px 0 #b44d35;
}

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

.ans-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

.ans-btn:disabled {
  cursor: default;
}

.ans-btn.correct {
  outline: 4px solid #2fbf71;
}

.ans-btn.wrong {
  filter: grayscale(0.8);
  opacity: 0.75;
}

.feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: 'Fredoka One', cursive;
  font-size: 3rem;
  z-index: 100;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.feedback.show {
  animation: fbPop 0.75s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.feedback.ok {
  color: #2fbf71;
  text-shadow: 3px 3px 0 #208950;
}

.feedback.ko {
  color: #ff6b6b;
  text-shadow: 3px 3px 0 #cc3f3f;
}

@keyframes fbPop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  35% {
    transform: translate(-50%, -62%) scale(1.25);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -85%) scale(1);
    opacity: 0;
  }
}

.bonus-card,
.result-card,
.lb-card {
  background: linear-gradient(165deg, #fffefb 0%, var(--card-bg) 100%);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  padding: 28px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 0 0 4px rgba(255, 255, 255, 0.22);
  width: 100%;
}

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}

.bonus-btn {
  border: none;
  border-radius: 18px;
  padding: 14px 12px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16);
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.bonus-btn.easy {
  background: linear-gradient(135deg, #2a9d8f, #58c9b9);
}

.bonus-btn.medium {
  background: linear-gradient(135deg, #ff9f1c, #ffbf69);
}

.bonus-btn.hard {
  background: linear-gradient(135deg, #9d4edd, #c77dff);
}

.bonus-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.18);
}

.bonus-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.skip-bonus-btn {
  border: none;
  background: linear-gradient(135deg, #ffffff, #f5f5f5);
  color: #777;
  border-radius: 50px;
  padding: 9px 18px;
  font-weight: 800;
  cursor: pointer;
  border: 2px solid #eee;
  display: block;
  margin: 8px auto 0;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.bonus-note {
  text-align: center;
  font-size: 0.9rem;
  color: #7a7a7a;
  font-weight: 700;
}

.bonus-base-note {
  font-weight: 700;
  color: #4f5f72;
  line-height: 1.5;
}

.center-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.bonus-summary {
  background: linear-gradient(150deg, #eef7ff, #f6fffa);
}

.r-emoji {
  font-size: 4.2rem;
}

.r-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.1rem;
  margin: 10px 0 8px;
}

.r-msg {
  font-size: 1rem;
  color: #666;
  font-weight: 700;
  margin-bottom: 18px;
}

.stars-row {
  font-size: 2.4rem;
  margin-bottom: 20px;
}

.star-a {
  display: inline-block;
  animation: starSpin 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.star-a:nth-child(1) {
  animation-delay: 0.1s;
}

.star-a:nth-child(2) {
  animation-delay: 0.3s;
}

.star-a:nth-child(3) {
  animation-delay: 0.5s;
}

@keyframes starSpin {
  from {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.score-final {
  background: linear-gradient(160deg, #ffffff, #f9fcff);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.si .n {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--accent-2);
  text-align: center;
}

.si .l {
  font-size: 0.82rem;
  font-weight: 800;
  color: #808080;
  text-align: center;
}

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

.btn-replay {
  background: linear-gradient(135deg, var(--accent-1), #6ea0ff);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 30px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 5px 0 #2258b8;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-home {
  background: linear-gradient(135deg, #ffffff, #f6faff);
  color: var(--accent-2);
  border: 3px solid var(--accent-2);
  border-radius: 50px;
  padding: 12px 28px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.13);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-replay:hover,
.btn-home:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn-replay:active,
.btn-home:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.lb-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 6px;
}

.lb-sub {
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  color: #5f6b7a;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 2px solid #ececec;
}

.lb-table td {
  padding: 10px 8px;
  font-weight: 800;
  font-size: 0.92rem;
  border-bottom: 1px solid #f1f1f1;
  color: #444;
}

.lb-empty {
  text-align: center;
  padding: 30px 0;
  color: #667487;
  font-size: 1.05rem;
  font-weight: 800;
}

.btn-clear {
  background: none;
  border: 2px solid #eee;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #6b7684;
  cursor: pointer;
  margin: 16px auto 0;
  display: block;
}

.btn-clear:hover {
  color: #e63946;
  border-color: #e63946;
}

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 8px;
  z-index: 210;
}

.flink {
  font-size: 0.8rem;
  font-weight: 800;
  color: #5f6b7a;
  border: none;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

.flink:hover {
  color: var(--accent-1);
}

.footer-version {
  cursor: default;
  color: inherit;
  opacity: 0.95;
}

.footer-support-cta {
  flex: 0 0 auto;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #FF3D00;
  color: #fff !important;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.15s;
}

.footer-support-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f4f4f4;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  font-weight: 800;
  color: #999;
  cursor: pointer;
}

.modal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.7rem;
  margin-bottom: 4px;
}

.modal-date {
  font-size: 0.8rem;
  color: #667487;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-body {
  font-size: 0.93rem;
  line-height: 1.7;
  color: #555;
}

.modal-body h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.08rem;
  margin: 14px 0 6px;
  color: var(--accent-2);
}

.modal-body a {
  color: var(--accent-1);
  font-weight: 800;
  text-decoration: none;
}

.modal-body a:hover {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  background: #fff;
  color: #000;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  z-index: 9999;
  text-decoration: none;
  border: 3px solid #000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

.cp {
  position: fixed;
  top: -20px;
  pointer-events: none;
  z-index: 200;
  animation: cFall linear both;
}

@keyframes cFall {
  0% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 700px) {
  .answers-grid,
  .class-grid,
  .bonus-grid,
  .level-cards {
    grid-template-columns: 1fr;
  }

  .score-final {
    flex-direction: column;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
