* {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --apple-blue: #0071e3;
  --apple-light-blue: #e8f0fe;
  --apple-green: #34c759;
  --apple-red: #ff3b30;
  --apple-orange: #ff9500;
  --apple-purple: #af52de;
  --apple-pink: #ff2d55;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --glass-bg: rgba(28, 28, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.screen {
  display: none;
  min-height: 100vh;
  position: relative;
  background: var(--bg-primary);
}

.screen.active {
  display: flex;
  flex-direction: column
}

/* SPLASH */
.splash-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(0, 113, 227, 0.05), transparent 40%), radial-gradient(circle at bottom right, rgba(255, 45, 85, 0.05), transparent 40%);
  pointer-events: none;
  z-index: 0
}

.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  text-align: center;
  flex: 1;
  justify-content: center;
  gap: 1.5rem
}

.mascot-big {
  font-size: 4.5rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

@keyframes float {
  0% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-10px)
  }

  100% {
    transform: translateY(0)
  }
}

.title-main {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.highlight {
  background: linear-gradient(90deg, var(--apple-pink), var(--apple-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 300px;
}

.mascot-speech {
  background: var(--bg-secondary);
  border-radius: 18px;
  padding: 1rem 1.5rem;
  font-size: 0.95rem;
  max-width: 320px;
  box-shadow: var(--glass-shadow);
  position: relative;
  line-height: 1.4;
  font-weight: 500;
  border: 1px solid var(--glass-border);
}

.mascot-speech::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--bg-secondary);
}

.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 340px;
  margin-top: 1rem;
}

.btn-mode {
  border: none;
  border-radius: 20px;
  padding: 1.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  font-family: inherit;
  background: var(--bg-secondary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: relative;
}

.btn-mode:active {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-mode:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.btn-exam {
  border: 2px solid var(--apple-blue);
  background: var(--apple-blue);
  color: #fff;
}

.btn-study {
  border: 2px solid var(--apple-purple);
  color: var(--apple-purple);
}

.btn-quick {
  border: 2px solid var(--apple-orange);
  color: var(--apple-orange);
}

@media(prefers-color-scheme:dark) {
  .btn-study {
    background: rgba(175, 82, 222, 0.15);
  }

  .btn-quick {
    background: rgba(255, 149, 0, 0.15);
  }

  .btn-exam {
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.3);
  }
}

.btn-icon {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}

.btn-label {
  font-weight: 700;
  font-size: 1.05rem;
}

.btn-desc {
  font-size: 0.8rem;
  opacity: 0.8;
  font-weight: 500;
}

.best-score {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 1rem;
}

/* QUIZ */
.quiz-top {
  padding: 1rem 1.5rem 0.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--glass-border);
}

.progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

@media(prefers-color-scheme:dark) {
  .progress-bar {
    background: rgba(255, 255, 255, 0.1);
  }
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--apple-blue), var(--apple-purple));
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  width: 0
}

.quiz-stats {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0 0.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  font-feature-settings: "tnum";
}

.timer-bar {
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  margin: 0;
}

.timer-fill {
  height: 100%;
  background: var(--apple-blue);
  transition: width 0.1s linear, background-color 0.3s ease;
  width: 100%
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 2rem;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.category-badge {
  align-self: center;
  background: var(--bg-secondary);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--apple-purple);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(175, 82, 222, 0.2);
}

.mascot-mini {
  text-align: center;
  font-size: 3rem;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  line-height: 1;
  margin: 0.5rem 0;
}

.question-card {
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 1.8rem 1.5rem;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  text-align: center;
}

.question-text {
  font-size: 1.15rem;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-top: auto;
}

@media(min-width:500px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.option-btn {
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 1.2rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.4;
}

.option-btn:active {
  transform: scale(0.97);
  background: var(--bg-primary);
}

.option-btn:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.option-btn.opt-0 {
  border-color: rgba(255, 59, 48, 0.3);
}

.option-btn.opt-1 {
  border-color: rgba(0, 113, 227, 0.3);
}

.option-btn.opt-2 {
  border-color: rgba(255, 149, 0, 0.3);
}

.option-btn.opt-3 {
  border-color: rgba(52, 199, 89, 0.3);
}

.option-btn.correct {
  background: var(--apple-green) !important;
  color: #fff !important;
  border-color: var(--apple-green) !important;
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(52, 199, 89, 0.4) !important;
}

.option-btn.wrong {
  background: var(--apple-red) !important;
  color: #fff !important;
  border-color: var(--apple-red) !important;
  animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.6;
}

@keyframes shake {

  10%,
  90% {
    transform: translate3d(-2px, 0, 0)
  }

  20%,
  80% {
    transform: translate3d(4px, 0, 0)
  }

  30%,
  50%,
  70% {
    transform: translate3d(-8px, 0, 0)
  }

  40%,
  60% {
    transform: translate3d(8px, 0, 0)
  }
}

/* FEEDBACK */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.feedback-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

.feedback-card {
  background: var(--bg-secondary);
  border-radius: 28px;
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--glass-border);
}

@keyframes popIn {
  from {
    transform: scale(0.8) translateY(20px);
    opacity: 0
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1
  }
}

.feedback-icon {
  font-size: 3.5rem;
  margin-bottom: -10px;
}

.feedback-mascot {
  font-size: 2.5rem;
  position: absolute;
  top: -20px;
  right: -10px;
  animation: float 3s ease-in-out infinite;
}

.feedback-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.feedback-msg {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.feedback-explain {
  font-size: 0.9rem;
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 1rem;
  line-height: 1.5;
  text-align: left;
  color: var(--text-primary);
  margin: 0.5rem 0;
}

.feedback-points {
  font-size: 1.4rem;
  font-weight: 800;
  font-feature-settings: "tnum";
}

.btn-next {
  background: var(--apple-blue);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 1rem 2rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  box-shadow: 0 8px 16px rgba(0, 113, 227, 0.3);
}

.btn-next:active {
  transform: scale(0.95);
  box-shadow: 0 4px 8px rgba(0, 113, 227, 0.3);
}

/* RESULTS */
.results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  gap: 1.5rem;
  text-align: center;
  min-height: 100vh;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.results-mascot {
  font-size: 4.5rem;
  animation: float 3s ease-in-out infinite;
}

.results-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  box-shadow: var(--glass-shadow);
  position: relative;
}

.score-circle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--apple-blue), var(--apple-purple));
  z-index: -1;
}

.score-pct {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.results-stars {
  font-size: 2rem;
  letter-spacing: 4px;
}

.results-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.rstat {
  background: var(--bg-secondary);
  border-radius: 18px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.rstat-num {
  font-size: 1.6rem;
  font-weight: 800;
  font-feature-settings: "tnum";
}

.rstat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.correct-stat .rstat-num {
  color: var(--apple-green)
}

.wrong-stat .rstat-num {
  color: var(--apple-red)
}

.streak-stat2 .rstat-num {
  color: var(--apple-orange)
}

.points-stat .rstat-num {
  color: var(--apple-purple)
}

.results-msg {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text-secondary);
  font-weight: 500;
}

.results-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

/* REVIEW */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  border-bottom: 1px solid var(--glass-border);
}

.review-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-back {
  background: var(--bg-secondary);
  color: var(--apple-blue);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-back:active {
  background: var(--bg-primary);
}

.review-list {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.review-item {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  border-left: 4px solid var(--apple-red);
}

.review-item .ri-q {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}

.review-item .ri-your {
  color: var(--apple-red);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.review-item .ri-correct {
  color: var(--apple-green);
  font-size: 0.9rem;
  font-weight: 600;
}

.review-item .ri-explain {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.8rem;
  line-height: 1.5;
}

/* CONFETTI */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 200;
  animation: confettiFall linear forwards
}

@keyframes confettiFall {
  to {
    top: 110vh;
    transform: rotateZ(720deg)
  }
}