/* ============================================
   KAFA KIDS LEARNING SYSTEM — MAIN STYLES
   Premium Fintech for Kids | Cartoon Style
   ============================================ */

:root {
  --gold: #FFD700;
  --gold-dark: #C8A400;
  --gold-light: #FFF176;
  --bg-dark: #1A1A2E;
  --bg-card: rgba(255,255,255,0.08);
  --bg-card-solid: #252545;
  --green: #4CAF50;
  --green-light: #81C784;
  --red: #F44336;
  --blue: #42A5F5;
  --purple: #9575CD;
  --orange: #FF8A65;
  --white: #FFFFFF;
  --text-dim: rgba(255,255,255,0.65);
  --border: rgba(255,215,0,0.25);
  --shadow-gold: 0 8px 32px rgba(255,215,0,0.25);
  --shadow-card: 0 20px 60px rgba(0,0,0,0.5);
  --radius: 20px;
  --radius-lg: 28px;
  --ff-display: 'Fredoka One', cursive;
  --ff-body: 'Nunito', sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--ff-body);
  background: var(--bg-dark);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== LOGIN PAGE ========== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, #16213e 0%, #0f3460 40%, #1a1a2e 100%);
  position: relative;
  overflow: hidden;
}

/* Stars background */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold-light);
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

/* Cartoon Characters */
.char {
  position: fixed;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
}

.char-left { left: 2%; }
.char-right { right: 2%; }

/* Lamp Animation */
.lamp-anim {
  position: relative;
  width: 140px;
  height: 220px;
  animation: float 3s ease-in-out infinite;
}

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

.lamp-shade {
  width: 110px;
  height: 60px;
  background: radial-gradient(ellipse at 50% 0%, #fff 0%, #ffe082 60%, #ffab00 100%);
  border-radius: 50% 50% 0 0 / 70% 70% 0 0;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 40px 20px rgba(255,214,0,0.5), 0 0 80px 40px rgba(255,214,0,0.2);
}

.lamp-light {
  width: 130px;
  height: 80px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,240,100,0.5) 0%, transparent 70%);
  margin: -10px auto 0;
}

.lamp-pole {
  width: 12px;
  height: 80px;
  background: linear-gradient(to right, #bdbdbd, #fff, #bdbdbd);
  margin: 0 auto;
  border-radius: 6px;
}

.lamp-base {
  width: 80px;
  height: 16px;
  background: linear-gradient(to bottom, #bdbdbd, #9e9e9e);
  border-radius: 8px;
  margin: 0 auto;
}

.lamp-pendulum {
  position: absolute;
  left: 50%;
  top: 90px;
  transform-origin: top center;
  animation: swing 2s ease-in-out infinite;
  margin-left: -3px;
  width: 6px;
}

@keyframes swing {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(20deg); }
}

.lamp-ball {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 35%, #ffcc02, #ff8f00);
  border-radius: 50%;
  margin-top: 60px;
  margin-left: -5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Book Stack */
.book-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: float 3.5s ease-in-out infinite 0.5s;
}

.book { font-size: 3.5rem; }

/* Star decorations */
.star-deco {
  position: absolute;
  animation: spinStar 4s linear infinite;
  font-size: 1.4rem;
}

.s1 { top: 10px; left: 20px; animation-duration: 3s; }
.s2 { top: 60px; right: 10px; animation-duration: 5s; }
.s3 { top: 130px; left: -10px; animation-duration: 4s; font-size: 1.2rem; }
.s4 { top: 20px; right: 20px; animation-duration: 3.5s; }
.s5 { top: 80px; left: 10px; animation-duration: 4.5s; }

@keyframes spinStar {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ========== LOGIN CARD ========== */
.login-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  padding: 1rem;
}

.login-card {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255,215,0,0.3);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2rem;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.1);
  animation: cardPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardPop {
  from { opacity: 0; transform: scale(0.8) translateY(40px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-icon {
  font-size: 3.5rem;
  animation: bounce 2s ease-in-out infinite;
  display: block;
  margin-bottom: 0.5rem;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

.login-title {
  font-family: var(--ff-display);
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 2px 20px rgba(255,215,0,0.5);
  letter-spacing: 1px;
}

.login-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}

.select-wrapper {
  position: relative;
  margin-bottom: 1.1rem;
}

.student-select {
  width: 100%;
  padding: 0.9rem 2.5rem 0.9rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,215,0,0.3);
  border-radius: 14px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.3s ease;
}

.student-select:focus {
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.15);
}

.student-select option {
  background: #1a1a2e;
  color: var(--white);
  font-weight: 700;
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 0.8rem;
  pointer-events: none;
}

.pass-wrapper {
  position: relative;
  margin-bottom: 0.5rem;
}

.pass-input {
  width: 100%;
  padding: 0.9rem 3rem 0.9rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,215,0,0.3);
  border-radius: 14px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.pass-input::placeholder { color: rgba(255,255,255,0.35); }

.pass-input:focus {
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.15);
}

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2rem;
  transition: transform 0.2s;
}

.eye-btn:hover { transform: translateY(-50%) scale(1.2); }

.pass-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 1.4rem;
  text-align: center;
}

.pass-hint strong { color: var(--gold-light); }

.signin-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--ff-display);
  font-size: 1.2rem;
  color: #1a1a2e;
  letter-spacing: 1px;
  box-shadow: 0 6px 24px rgba(255,140,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.signin-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 30%;
  height: 200%;
  background: rgba(255,255,255,0.25);
  transform: skewX(-20deg);
  animation: shine 3s infinite 1s;
}

@keyframes shine {
  0% { left: -60%; }
  100% { left: 130%; }
}

.signin-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 32px rgba(255,140,0,0.6);
}

.signin-btn:active { transform: scale(0.97); }

.login-error {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: rgba(244,67,54,0.15);
  border: 1px solid rgba(244,67,54,0.4);
  border-radius: 12px;
  color: #ff8a80;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ========== MAIN DASHBOARD ========== */
.dashboard-page {
  min-height: 100vh;
  background: radial-gradient(ellipse at 10% 20%, #16213e 0%, #0f3460 50%, #1a1a2e 100%);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}

.user-name-short {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-dim);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: rgba(244,67,54,0.15);
  border: 1px solid rgba(244,67,54,0.3);
  color: #ff8a80;
  font-family: var(--ff-body);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover { background: rgba(244,67,54,0.3); transform: scale(1.05); }

/* Dashboard Content */
.dash-content { padding: 1.5rem; max-width: 800px; margin: 0 auto; }

.welcome-banner {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,140,0,0.08));
  border: 1.5px solid rgba(255,215,0,0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideDown 0.5s ease both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-emoji { font-size: 3rem; }

.welcome-text h2 {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  color: var(--gold);
}

.welcome-text p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  font-weight: 600;
}

/* Tabs */
.tabs-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.9rem 0.5rem;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  color: var(--text-dim);
  font-family: var(--ff-body);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.tab-btn span { font-size: 1.6rem; }

.tab-btn.active {
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,140,0,0.1));
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 4px 20px rgba(255,215,0,0.2);
  transform: translateY(-2px);
}

/* Tab Panels */
.tab-panel { display: none; animation: fadeIn 0.4s ease; }
.tab-panel.active { display: block; }

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

/* Subjek Section */
.section-title {
  font-family: var(--ff-display);
  font-size: 1.2rem;
  color: var(--gold-light);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Subject Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.subject-card {
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card-color);
  opacity: 0;
  transition: opacity 0.3s;
}

.subject-card:hover::before, .subject-card.selected::before { opacity: 0.12; }

.subject-card:hover, .subject-card.selected {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--card-border);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 2px var(--card-border);
}

.subject-card .subj-icon { font-size: 3rem; display: block; margin-bottom: 0.6rem; }

.subject-card .subj-name {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  color: var(--white);
}

.subject-card .subj-badge {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--card-color);
  color: var(--white);
  opacity: 0.85;
}

/* Topic Cards */
.topics-section { margin-top: 1rem; }

.topic-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--white);
}

.topic-card:hover {
  background: rgba(255,215,0,0.1);
  border-color: var(--gold);
  transform: translateX(6px);
}

.topic-num {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 1.1rem;
  color: #1a1a2e;
  flex-shrink: 0;
}

.topic-info { flex: 1; }
.topic-title { font-weight: 800; font-size: 0.95rem; }
.topic-desc { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.2rem; }

.topic-arrow {
  font-size: 1.2rem;
  color: var(--gold);
  transition: transform 0.2s;
}

.topic-card:hover .topic-arrow { transform: translateX(4px); }

.coming-soon-badge {
  background: rgba(255,255,255,0.1);
  border: 1px dashed rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

/* ========== RANKING PAGE ========== */
.ranking-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.rank-filter-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.rank-filter-btn.active {
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,140,0,0.1));
  border-color: var(--gold);
  color: var(--gold);
}

.ranking-table {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rank-header {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px;
  padding: 0.8rem 1rem;
  background: rgba(255,215,0,0.1);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-row {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  align-items: center;
  transition: background 0.2s;
  animation: rowSlide 0.4s ease both;
}

.rank-row:hover { background: rgba(255,255,255,0.04); }

@keyframes rowSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.rank-pos {
  font-family: var(--ff-display);
  font-size: 1.1rem;
}

.rank-pos.gold { color: #FFD700; }
.rank-pos.silver { color: #C0C0C0; }
.rank-pos.bronze { color: #CD7F32; }

.rank-name { font-weight: 800; font-size: 0.88rem; }
.rank-score {
  text-align: center;
  font-family: var(--ff-display);
  font-size: 1rem;
  color: var(--gold);
}
.rank-time { text-align: center; font-size: 0.82rem; color: var(--text-dim); font-weight: 700; }

.rank-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ========== GAME PAGE ========== */
.game-page {
  min-height: 100vh;
  background: radial-gradient(ellipse at 30% 20%, #1b2838 0%, #0d1b2a 100%);
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}

.game-back-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  font-family: var(--ff-body);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.game-back-btn:hover { background: rgba(255,255,255,0.2); }

.game-title-bar {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  color: var(--gold);
  text-align: center;
}

.game-content { padding: 1.2rem; max-width: 600px; margin: 0 auto; }

/* Level Indicators */
.levels-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.level-dot {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  transition: all 0.4s ease;
}

.level-dot.active { background: linear-gradient(to right, var(--gold), var(--orange)); }
.level-dot.done { background: var(--green); }

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.stat-chip {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 0.7rem;
  text-align: center;
}

.stat-chip .stat-val {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  color: var(--gold);
  display: block;
}

.stat-chip .stat-lbl {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

/* Timer Ring */
.timer-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.timer-ring {
  position: relative;
  width: 70px;
  height: 70px;
}

.timer-ring svg { transform: rotate(-90deg); }

.timer-ring-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 6; }
.timer-ring-fill { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 1.3rem;
  color: var(--white);
}

/* Question Card */
.question-card {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  animation: qSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.q-progress {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.q-text {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--white);
}

/* Answer Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.option-btn {
  padding: 1rem;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}

.option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}

.option-btn:hover {
  border-color: var(--gold);
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(76,175,80,0.2);
  color: var(--green-light);
  animation: correctPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-btn.wrong {
  border-color: var(--red);
  background: rgba(244,67,54,0.15);
  color: #ff8a80;
  animation: shake 0.4s ease;
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.popup-card {
  background: linear-gradient(135deg, #1e2a45, #252545);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: cardPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  box-shadow: var(--shadow-card);
}

.popup-emoji { font-size: 4rem; display: block; margin-bottom: 0.8rem; }

.popup-title {
  font-family: var(--ff-display);
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.popup-sub {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.popup-score {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.popup-score-item { text-align: center; }
.popup-score-val {
  font-family: var(--ff-display);
  font-size: 2rem;
  display: block;
}
.popup-score-val.gold { color: var(--gold); }
.popup-score-val.blue { color: var(--blue); }
.popup-score-lbl { font-size: 0.7rem; color: var(--text-dim); font-weight: 800; text-transform: uppercase; }

.popup-btn {
  width: 100%;
  padding: 0.9rem;
  border-radius: 14px;
  border: none;
  font-family: var(--ff-display);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-bottom: 0.6rem;
}

.popup-btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #1a1a2e;
  box-shadow: 0 6px 20px rgba(255,140,0,0.4);
}

.popup-btn.secondary {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: var(--white);
}

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

/* Level Badge */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.level-badge.lv1 { background: rgba(66,165,245,0.2); border: 1px solid rgba(66,165,245,0.4); color: var(--blue); }
.level-badge.lv2 { background: rgba(255,215,0,0.2); border: 1px solid rgba(255,215,0,0.4); color: var(--gold); }
.level-badge.lv3 { background: rgba(244,67,54,0.15); border: 1px solid rgba(244,67,54,0.4); color: #ff8a80; }

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-emoji { font-size: 5rem; animation: bounce 0.8s ease-in-out infinite; }
.loading-text {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  color: var(--gold);
  margin-top: 1rem;
}

.dots span {
  display: inline-block;
  animation: dotBounce 1s ease-in-out infinite;
  font-size: 2rem;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  .char { display: none; }
  .login-card { padding: 1.8rem 1.3rem; }
  .login-title { font-size: 1.6rem; }
  .options-grid { grid-template-columns: 1fr; }
  .rank-header, .rank-row { grid-template-columns: 40px 1fr 70px 70px; font-size: 0.78rem; }
  .topbar-logo { font-size: 1.1rem; }
}

@media (min-width: 768px) {
  .char-left { left: 5%; }
  .char-right { right: 5%; }
  .lamp-anim { width: 170px; height: 260px; }
  .book-stack .book { font-size: 4.5rem; }
}

/* Confetti particles */
.confetti-piece {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 3px; }
