:root {
  --bg-1: #6dd5fa;
  --bg-2: #fbc2eb;
  --bg-3: #fff6a5;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #24304f;
  --muted: #63708d;
  --primary: #6157ff;
  --primary-dark: #4037d7;
  --success: #1f9d62;
  --danger: #d14343;
  --warning: #f8b400;
  --shadow: 0 24px 60px rgba(36, 48, 79, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, var(--bg-3), transparent 24rem),
    radial-gradient(circle at 80% 5%, var(--bg-2), transparent 25rem),
    linear-gradient(135deg, var(--bg-1), #b9fbc0 100%);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(960px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
  position: relative;
}

.sound-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .95);
  color: var(--primary-dark);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(36, 48, 79, .16);
}
.sound-toggle:hover { transform: translateY(-1px); }
.sound-hint {
  margin: -12px auto 20px;
  color: var(--muted);
  font-size: .95rem;
}

.hero-card, .quiz-card, .scores-panel {
  width: min(680px, 100%);
  background: var(--card);
  border: 4px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 42px);
  text-align: center;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.quiz-card { text-align: left; }
.hidden { display: none !important; }

.floating-shapes { position: absolute; inset: 0; pointer-events: none; }
.floating-shapes span {
  position: absolute;
  font-size: clamp(28px, 5vw, 54px);
  animation: float 4s ease-in-out infinite alternate;
}
.floating-shapes span:nth-child(1) { left: 6%; top: 8%; }
.floating-shapes span:nth-child(2) { right: 9%; top: 13%; animation-delay: .5s; }
.floating-shapes span:nth-child(3) { left: 12%; bottom: 10%; animation-delay: 1s; }
.floating-shapes span:nth-child(4) { right: 10%; bottom: 12%; animation-delay: 1.4s; }

@keyframes float {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-16px) rotate(5deg); }
}

.badge, .eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff0aa;
  color: #6a4b00;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .8rem;
}

h1, h2, h3 { margin: 0; line-height: 1.08; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
h3 { font-size: clamp(1.35rem, 3vw, 2rem); margin: 20px 0; }
.intro { max-width: 520px; margin: 18px auto 26px; color: var(--muted); font-size: 1.12rem; }

.input-label {
  display: block;
  text-align: left;
  width: min(420px, 100%);
  margin: 0 auto 8px;
  font-weight: 800;
}

input, select {
  width: 100%;
  border: 2px solid #dce2ff;
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input { width: min(420px, 100%); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(97, 87, 255, .15); }

.settings-grid {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px auto 20px;
  text-align: left;
}
.settings-grid label { font-weight: 800; }
.settings-grid select { margin-top: 8px; }

.primary-btn, .secondary-btn, .answer-btn {
  border: 0;
  border-radius: 18px;
  padding: 14px 20px;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(97, 87, 255, .28);
}
.primary-btn:hover { background: var(--primary-dark); transform: translateY(-2px); }
.secondary-btn { background: #eef1ff; color: var(--primary-dark); margin-left: 8px; }
.secondary-btn:hover { transform: translateY(-2px); }
.danger { color: var(--danger); background: #fff0f0; margin: 16px 0 0; }

.quiz-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.score-pill {
  flex: 0 0 auto;
  background: #fff3c4;
  border: 2px solid #ffe08a;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 900;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  background: #e9edff;
  overflow: hidden;
  margin: 20px 0 24px;
}
#progressBar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ff75b7);
  transition: width .3s ease;
}

.question-visual {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 32px;
  margin: 0 auto;
  font-size: 4.5rem;
  background: linear-gradient(135deg, #fff6a5, #c8f7dc);
  border: 4px solid #fff;
  box-shadow: 0 14px 28px rgba(36, 48, 79, .12);
}

.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.answer-btn {
  min-height: 72px;
  background: #fff;
  color: var(--ink);
  border: 2px solid #dde4ff;
  text-align: left;
}
.answer-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 18px rgba(36, 48, 79, .12); }
.answer-btn:disabled { cursor: not-allowed; }
.answer-btn.correct { background: #eafff3; border-color: var(--success); color: #0b653a; }
.answer-btn.wrong { background: #fff0f0; border-color: var(--danger); color: #8d2020; }

.feedback { min-height: 28px; font-weight: 900; margin: 18px 0 0; }
.feedback.good { color: var(--success); }
.feedback.bad { color: var(--danger); }

.trophy { font-size: clamp(4rem, 10vw, 7rem); margin-bottom: 8px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px auto;
  width: min(420px, 100%);
}
.result-grid div { background: #fff; border-radius: 22px; padding: 18px; border: 2px solid #e4e9ff; }
.result-grid strong { display: block; font-size: 2rem; }
.result-grid span { color: var(--muted); font-weight: 800; }

.scores-panel { position: fixed; z-index: 10; max-height: calc(100vh - 48px); overflow: auto; }
.scores-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.icon-btn {
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef1ff;
  color: var(--primary-dark);
  font-size: 1.7rem;
  line-height: 1;
}
#scoresList { margin: 0; padding-left: 28px; text-align: left; }
#scoresList li { background: #fff; border: 2px solid #e5e9ff; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; font-weight: 900; }
#scoresList small { display: block; color: var(--muted); font-weight: 700; margin-top: 4px; }

@media (max-width: 620px) {
  .app-shell { width: min(100% - 18px, 960px); padding: 54px 0 12px; }
  .sound-toggle { top: 8px; right: 8px; padding: 9px 12px; font-size: .9rem; }
  .hero-card, .quiz-card, .scores-panel { border-radius: 24px; padding: 22px; }
  .settings-grid, .answers, .result-grid { grid-template-columns: 1fr; }
  .secondary-btn { margin: 10px 0 0; width: 100%; }
  .primary-btn { width: 100%; }
  .quiz-header { align-items: center; }
  .question-visual { width: 96px; height: 96px; font-size: 3.6rem; }
}
