.modal-fireworks {
  position: absolute;
  inset: -20px;
  pointer-events: none;
  display: none;
}

.modal-fireworks.active {
  display: block;
}

.modal-fireworks span {
  position: absolute;
  width: 4px;
  height: 60px;
  background: linear-gradient(transparent, #ff8fd8);
  opacity: 0;
}

.modal-fireworks span:nth-child(2) {
  transform: rotate(60deg);
  background: linear-gradient(transparent, #8fffee);
}

.modal-fireworks span:nth-child(3) {
  transform: rotate(-60deg);
  background: linear-gradient(transparent, #ffd88f);
}

.modal-fireworks span.animate {
  animation: firework-burst 0.8s ease forwards;
}
:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  font-size: 16px;
  --bg: #f5f4ff;
  --panel: #ffffff;
  --accent: #6a5acd;
  --accent-dark: #4a3dbd;
  --text: #222244;
  --muted: #6b6b8f;
  --border: #dddaf5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #fdf6ff;
  background-image:
    radial-gradient(circle at top, rgba(255, 182, 193, 0.3), transparent 45%),
    radial-gradient(circle at 20% 20%, rgba(255, 246, 173, 0.4), transparent 40%),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='200'%20height='200'%3E%3Ctext%20x='20'%20y='40'%20font-size='32'%3E🐱%3C/text%3E%3Ctext%20x='120'%20y='110'%20font-size='32'%3E🍜%3C/text%3E%3Ctext%20x='60'%20y='170'%20font-size='32'%3E🎤%3C/text%3E%3C/svg%3E");
  background-size: 100% 100%, 800px 800px, 220px 220px;
  background-attachment: fixed;
  color: var(--text);
}

.scoreboard {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: min(220px, 40vw);
  background: #1f1b41;
  color: white;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 18px 35px rgba(31, 27, 65, 0.35);
  z-index: 10;
}

.scoreboard-label {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
}

.scoreboard-value {
  margin: 0.2rem 0 0.8rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.achievements-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: white;
  border-radius: 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.achievements-btn:hover {
  background: rgba(255, 255, 255, 0.23);
}

.achievements-btn:active {
  transform: translateY(1px);
}

.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 120;
}

.toast {
  background: #1f1b41;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toast-pop 0.4s ease, toast-fade 0.4s ease 3s forwards;
}

.toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff9ff3, #f368e0);
  font-size: 1.2rem;
  color: #fff;
}

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

@keyframes toast-fade {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

.fireworks {
  pointer-events: none;
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 110;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.fireworks.active {
  opacity: 1;
}

.fireworks span {
  position: absolute;
  width: 4px;
  height: 60px;
  background: linear-gradient(transparent, #ff7de9);
  opacity: 0;
}

.fireworks span:nth-child(2) {
  transform: rotate(60deg);
  background: linear-gradient(transparent, #7dfffb);
}

.fireworks span:nth-child(3) {
  transform: rotate(-60deg);
  background: linear-gradient(transparent, #ffd27d);
}

.fireworks span.animate {
  animation: firework-burst 0.8s ease forwards;
}

@keyframes firework-burst {
  from {
    height: 0;
    opacity: 0;
  }
  60% {
    height: 80px;
    opacity: 1;
  }
  to {
    height: 0;
    opacity: 0;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 12, 35, 0.65);
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  width: min(640px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(30, 10, 80, 0.25);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-description {
  margin-top: 0;
  color: var(--muted);
}

.achievements-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.achievement-card {
  border: 2px dashed var(--border);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  background: #f9f8ff;
  opacity: 0.75;
  transition: border 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.achievement-card.unlocked {
  border-style: solid;
  border-color: #34c759;
  background: #f3fff7;
  opacity: 1;
}

.achievement-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #ff9ff3, #f368e0);
  filter: grayscale(1);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.achievement-card.unlocked .achievement-icon {
  filter: grayscale(0);
  transform: scale(1.05);
}

.achievement-card h3 {
  margin: 0 0 0.3rem;
}

.achievement-card p {
  margin: 0;
  color: var(--muted);
}

.achievement-card small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #1f8a48;
  text-align: right;
}

.scoreboard-value:last-child {
  margin-bottom: 0;
}

.hero {
  padding: 1rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: transparent;
}

.hero-inner {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 0.5rem 1.35rem;
  box-shadow: 0 10px 20px rgba(150, 80, 200, 0.15);
  border: 1px solid rgba(76, 72, 140, 0.08);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: #352552;
}

.layout {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem 3rem;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 1.75rem;
  align-items: flex-start;
}

main {
  width: 100%;
}

.test-panel {
  background: var(--panel);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 18px 35px rgba(50, 50, 93, 0.12);
  position: sticky;
  top: 6rem;
  margin-bottom: 2rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

.test-panel ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-button {
  width: 100%;
  border: 1px solid var(--border);
  background: #fbfbff;
  color: inherit;
  text-align: left;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.1s ease;
}

.test-button:hover {
  border-color: var(--accent);
  background: #f2edff;
  color: var(--text);
  transform: translateY(-1px);
}

.test-button.is-active {
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(106, 90, 205, 0.15);
}

.test-button.is-complete {
  border-color: #34c759;
  background: #ecffe9;
  position: relative;
  border-width: 2px;
  box-shadow: 0 10px 24px rgba(52, 199, 89, 0.25);
}

.test-button.is-complete::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  border: 2px solid rgba(52, 199, 89, 0.6);
  pointer-events: none;
}

.test-button.is-complete .test-title::before {
  content: "✅";
  margin-right: 0.4rem;
}

.test-title {
  font-weight: 600;
}

.test-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.quiz-panel,
.result-panel {
  background: var(--panel);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 18px 35px rgba(50, 50, 93, 0.12);
  margin-bottom: 2rem;
.result-panel {
  background: transparent;
  padding: 2rem 0 4rem;
  margin-bottom: 0;
}

.result-panel.hidden {
  display: none;
}

.result-card {
  position: relative;
  background: #1f1b41;
  color: white;
  border-radius: 1.25rem;
  padding: 2.5rem 3rem;
  text-align: center;
  width: min(520px, 92vw);
  box-shadow: 0 30px 60px rgba(10, 0, 64, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto;
}

.result-card h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.85);
}

.result-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  cursor: pointer;
}

.result-close:hover {
  color: #ffffff;
}

.result-row {
  margin: 0.85rem 0;
  text-align: center;
}

.result-label {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.5);
}

.result-value {
  margin: 0.15rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.result-accent {
  color: #f8d66d;
}

.result-praise {
  margin-top: 1.5rem;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.75);
}

.result-rays {
  position: absolute;
  width: 400px;
  height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 0;
}

.result-rays span {
  position: absolute;
  width: 4px;
  height: 200px;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.6));
  opacity: 0;
}

.result-rays span:nth-child(2) {
  transform: rotate(60deg);
}

.result-rays span:nth-child(3) {
  transform: rotate(-60deg);
}

.result-rays span.animate {
  animation: firework-burst 1.2s ease forwards;
}
}

.panel-header h2 {
  margin: 0 0 0.25rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.question-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1.25rem;
  margin-top: 1.5rem;
  background: #fbfbff;
}

.question-card h3 {
  margin-top: 0;
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

.question-card p {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.options {
  display: grid;
  gap: 0.4rem;
}

label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

label:hover {
  background: rgba(106, 90, 205, 0.1);
}

.question-card label.is-correct {
  background: rgba(52, 199, 89, 0.18);
  border: 1px solid rgba(52, 199, 89, 0.35);
}

.question-card label.is-incorrect {
  background: rgba(255, 59, 48, 0.15);
  border: 1px solid rgba(255, 59, 48, 0.25);
}

.feedback {
  margin-top: 0.8rem;
  font-weight: 600;
}

.feedback.is-correct {
  color: #28a745;
}

.feedback.is-incorrect {
  color: #e63946;
}

input[type="radio"] {
  margin-top: 0.25rem;
}

.actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

button {
  flex: 1;
  border: none;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: transform 0.1s ease, background 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button[type="reset"] {
  background: #e2e5ff;
  color: var(--accent-dark);
}

.result-panel h2 {
  margin-top: 0;
}

.hidden {
  display: none;
}

footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--muted);
}

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

  .test-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .actions {
    flex-direction: column;
  }

  .scoreboard {
    position: static;
    width: auto;
    margin: 1rem;
  }

  .layout {
    padding-top: 0;
  }
}

