/* ==========================================================================
   1분 구구단 스피드 챌린지 - 스타일시트
   ========================================================================== */

:root {
  /* 색상 팔레트 - 다크 테마 기본 */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --success-glow: rgba(16, 185, 129, 0.4);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-glow: rgba(239, 68, 68, 0.4);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.4);

  --key-bg: rgba(51, 65, 85, 0.7);
  --key-hover: rgba(71, 85, 105, 0.9);
  --key-action-bg: rgba(30, 41, 59, 0.9);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px -5px rgba(0, 0, 0, 0.5);
}

/* 라이트 테마 변수 */
body.theme-light {
  --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f1f5f9 50%, #fae8ff 100%);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(0, 0, 0, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --key-bg: rgba(241, 245, 249, 0.9);
  --key-hover: #e2e8f0;
  --key-action-bg: #cbd5e1;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 20px rgba(99, 102, 241, 0.08);
  --shadow-lg: 0 20px 30px rgba(0, 0, 0, 0.1);
}

/* 리셋 및 기본 설정 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* 폭죽 캔버스 (전체 화면 오버레이) */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* 앱 래퍼 */
.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
  margin: 0 auto;
}

@media (min-width: 540px) {
  .app-container {
    min-height: auto;
    padding: 24px 0;
  }
}

/* ==========================================================================
   헤더
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-icon {
  font-size: 1.2rem;
  animation: pulse-glow 2s infinite ease-in-out;
}

.logo-text strong {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-controls {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: var(--primary-glow);
  border-color: var(--primary);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   화면 전환 시스템
   ========================================================================== */
.main-content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   1. 시작 화면
   ========================================================================== */
.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: #f472b6;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  letter-spacing: -0.01em;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: -8px;
}

.quick-record-card {
  width: 100%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.record-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.record-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: #818cf8;
}

.record-value small {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* 설정 박스 */
.settings-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: rgba(15, 23, 42, 0.4);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.segment-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  font-family: inherit;
}

.segment-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-weight: 700;
}

/* 버튼 스타일 */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  color: white;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-subtext {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 2px;
}

.glow-effect {
  position: relative;
  overflow: hidden;
}

.glow-effect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 20%,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 30%
  );
  transform: rotate(30deg);
  animation: shine 4s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(30deg); }
  20%, 100% { transform: translateX(100%) rotate(30deg); }
}

/* ==========================================================================
   2. 카운트다운 화면
   ========================================================================== */
.countdown-wrapper {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.countdown-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 4px solid var(--primary);
  box-shadow: 0 0 40px var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  animation: count-pop 1s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes count-pop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.countdown-tip {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   3. 게임 플레이 화면
   ========================================================================== */
#screen-game {
  gap: 16px;
}

/* 상단 대시보드 */
.game-dashboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
}

.timer-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-card.warning {
  border-color: var(--danger);
  box-shadow: 0 0 20px var(--danger-glow);
  animation: pulse-danger 1s infinite alternate;
}

@keyframes pulse-danger {
  0% { background: var(--card-bg); }
  100% { background: rgba(239, 68, 68, 0.2); }
}

.timer-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timer-badge {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.timer-text {
  font-size: 1.8rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #60a5fa;
}

.timer-card.warning .timer-text {
  color: #f87171;
}

.timer-text small {
  font-size: 1rem;
  margin-left: 2px;
  color: var(--text-muted);
}

.timer-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.1s linear, background-color 0.3s ease;
}

.timer-card.warning .timer-bar-fill {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-top: 2px;
}

.combo-number {
  font-size: 1.4rem;
  font-weight: 900;
  color: #f59e0b;
  margin-top: 2px;
}

.combo-number small {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* 중앙 퀴즈 카드 */
.quiz-container {
  position: relative;
  margin: 4px 0;
}

.quiz-card {
  position: relative;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* 문제 맞힘 / 틀림 시 카드 피드백 효과 */
.quiz-card.correct-anim {
  border-color: var(--success);
  box-shadow: 0 0 30px var(--success-glow);
  animation: bounce-success 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-card.wrong-anim {
  border-color: var(--danger);
  box-shadow: 0 0 30px var(--danger-glow);
  animation: shake-error 0.35s ease;
}

@keyframes bounce-success {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shake-error {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* 콤보 버블 알림 */
.combo-bubble {
  position: absolute;
  top: -16px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
  opacity: 0;
  transform: translateY(10px) scale(0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.combo-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 수식 */
.quiz-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.quiz-equation .num {
  color: var(--text-primary);
  min-width: 48px;
}

.quiz-equation .operator {
  color: #a855f7;
  font-size: 2.8rem;
}

.quiz-equation .equals {
  color: var(--text-muted);
}

.quiz-equation .question-mark {
  color: #ec4899;
}

/* 입력 필드 */
.input-display-wrap {
  width: 100%;
  max-width: 280px;
  display: flex;
  gap: 8px;
}

.answer-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  padding: 10px 16px;
  outline: none;
  box-shadow: 0 0 20px var(--primary-glow);
  transition: all 0.2s ease;
}

body.theme-light .answer-input {
  background: #ffffff;
  color: #0f172a;
}

.answer-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.5);
}

.btn-submit {
  display: none; /* 모바일 가상키패드 및 자동제출 모드에선 숨김, 엔터수동모드 시 표시 */
  background: var(--primary);
  color: white;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
}

.input-display-wrap.show-submit .btn-submit {
  display: block;
}

.feedback-toast {
  position: absolute;
  bottom: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  height: 20px;
  transition: opacity 0.2s ease;
}

.feedback-toast.correct {
  color: var(--success);
}

.feedback-toast.wrong {
  color: var(--danger);
}

/* 가상 키패드 */
.virtual-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.key-btn {
  background: var(--key-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 800;
  padding: 14px 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-btn:hover {
  background: var(--key-hover);
}

.key-btn:active {
  transform: scale(0.92);
  background: var(--primary);
  color: white;
}

.key-btn.key-action {
  background: var(--key-action-bg);
  font-size: 1.3rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   4. 결과 화면
   ========================================================================== */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.new-record-banner {
  display: none;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  animation: bounce-success 0.6s infinite alternate ease-in-out;
}

.new-record-banner.show {
  display: inline-block;
}

.result-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rank-icon {
  font-size: 3.5rem;
  animation: float 2.5s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.rank-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rank-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.final-score-box {
  background: rgba(99, 102, 241, 0.12);
  border: 2px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-caption {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.final-score-val {
  font-size: 3.8rem;
  font-weight: 900;
  color: #818cf8;
  line-height: 1.1;
}

.final-score-val small {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-item {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--card-border);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.theme-light .stat-item {
  background: rgba(241, 245, 249, 0.7);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   5. 모달 (오답 노트 & 랭킹)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

body.theme-light .modal-card {
  background: #ffffff;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 30px 10px;
  line-height: 1.6;
}

/* 오답 노트 리스트 */
.wrong-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wrong-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

body.theme-light .wrong-item {
  background: #f8fafc;
}

.wrong-equation {
  font-size: 1.15rem;
  font-weight: 800;
}

.wrong-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.my-wrong-ans {
  color: var(--danger);
  font-weight: 700;
  text-decoration: line-through;
  font-size: 0.95rem;
}

.correct-ans {
  color: var(--success);
  font-weight: 800;
  font-size: 1.1rem;
}

/* 랭킹 리스트 */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leader-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--card-border);
}

body.theme-light .leader-item {
  background: #f8fafc;
}

.leader-rank {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.rank-1 .rank-badge { background: #fbbf24; color: #000; font-weight: 900; }
.rank-2 .rank-badge { background: #94a3b8; color: #000; font-weight: 900; }
.rank-3 .rank-badge { background: #d97706; color: #fff; font-weight: 900; }

.leader-info {
  display: flex;
  flex-direction: column;
}

.leader-score {
  font-size: 1.2rem;
  font-weight: 900;
  color: #818cf8;
}

.leader-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.btn-danger-outline:hover {
  background: var(--danger-bg);
}

/* ==========================================================================
   애니메이션 키프레임
   ========================================================================== */
@keyframes pulse-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px var(--primary-glow)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 10px var(--accent)); }
}
