/* ========================================
   DETEKTIF NUSANTARA - Style (Revised v2)
   ======================================== */

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

:root {
  --navy: #0f1b3d;
  --navy-light: #1a2750;
  --navy-lighter: #243366;
  --orange: #f2994a;
  --orange-bright: #ff8c42;
  --orange-dark: #d4782e;
  --white: #ffffff;
  --white-soft: #f0f4f8;
  --green: #27ae60;
  --green-light: #2ecc71;
  --red: #e74c3c;
  --gold: #f1c40f;
  --font-display: 'Baloo 2', cursive;
  --font-body: 'Poppins', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 4px 20px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 30px rgba(242,153,74,0.3);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, #0a0f2c 0%, #0f1b3d 40%, #162550 100%);
  color: var(--white);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ========================================
   BACKGROUND - Night Sky & Particles
   ======================================== */
.bg-decorations {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star-field {
  position: absolute;
  inset: 0;
}

.star-field .star-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.star-field .star-dot.small {
  width: 2px;
  height: 2px;
}

.star-field .star-dot.large {
  width: 4px;
  height: 4px;
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

.floating-particles {
  position: absolute;
  inset: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: floatParticle var(--dur, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.particle.orange {
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange);
}

.particle.gold {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}

.particle.white {
  background: rgba(255,255,255,0.6);
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

@keyframes floatParticle {
  0% { transform: translateY(100vh) rotate(0deg) scale(0); opacity: 0; }
  10% { opacity: var(--max-opacity, 0.6); }
  90% { opacity: var(--max-opacity, 0.6); }
  100% { transform: translateY(-100px) rotate(360deg) scale(1); opacity: 0; }
}

.star-float {
  position: absolute;
  color: var(--orange);
  opacity: 0.15;
  font-size: 2rem;
  animation: floatStar 6s ease-in-out infinite;
}

@keyframes floatStar {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
  50% { transform: translateY(-20px) rotate(15deg); opacity: 0.3; }
}

.map-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   PAGE SYSTEM
   ======================================== */
.page {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.page.active {
  display: block;
  animation: fadeSlideIn 0.6s var(--ease-out);
}

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

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: linear-gradient(145deg, var(--navy-light), var(--navy-lighter));
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(242,153,74,0.1);
  animation: loginCardIn 0.7s var(--bounce);
}

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

.login-icon {
  font-size: 80px;
  animation: detectiveFloat 4s ease-in-out infinite;
  margin-bottom: 16px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--white);
  text-shadow: 2px 2px 0 var(--orange), 4px 4px 0 rgba(0,0,0,0.2);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-form {
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: var(--white);
  outline: none;
  transition: var(--transition);
}

.form-group input::placeholder {
  color: rgba(255,255,255,0.3);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--orange);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 20px rgba(242,153,74,0.2);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f2994a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-group select option {
  background: var(--navy-light);
  color: var(--white);
}

.btn-login {
  width: 100%;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  border: none;
  border-radius: 60px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 6px 30px rgba(242,153,74,0.4);
  position: relative;
}

.btn-login:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 0 30px rgba(242,153,74,0.5),
    0 10px 40px rgba(242,153,74,0.5);
}

.btn-login:active {
  transform: translateY(0) scale(0.97);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-error {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(231,76,60,0.15);
  border: 1px solid rgba(231,76,60,0.3);
  color: var(--red);
  font-size: 0.9rem;
  display: none;
}

.login-error.show {
  display: block;
  animation: shake 0.4s ease;
}

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

/* ========================================
   TOP BAR
   ======================================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  position: relative;
  z-index: 10;
}

.top-bar-left, .top-bar-right {
  display: flex;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.icon-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
  border-color: var(--orange);
}

.btn-logout {
  border-color: rgba(231,76,60,0.4);
}

.btn-logout:hover {
  background: rgba(231,76,60,0.2);
  border-color: var(--red);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(242,153,74,0.3);
  border-radius: 30px;
  backdrop-filter: blur(10px);
  margin-right: 4px;
}

.user-avatar-icon {
  font-size: 1.2rem;
}

.user-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--orange);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px 60px 60px;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 80px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.hero.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.hero-character {
  flex-shrink: 0;
  animation: detectiveFloat 4s ease-in-out infinite;
}

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

.detective-img {
  width: 280px;
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(242, 153, 74, 0.3));
}

/* Hero Content */
.hero-content {
  text-align: center;
}

.title-wrapper {
  margin-bottom: 32px;
}

.title-badge {
  font-size: 48px;
  margin-bottom: 8px;
  animation: titleBounce 2s ease-in-out infinite;
}

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

.main-title {
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--white);
  text-shadow: 3px 3px 0 var(--orange), 6px 6px 0 rgba(0,0,0,0.2);
  letter-spacing: 2px;
}

.title-divider {
  width: 120px;
  height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--orange-bright));
  margin: 16px auto;
  border-radius: 2px;
}

.subtitle {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--orange);
  font-weight: 600;
}

.subtitle-small {
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

/* ========================================
   START BUTTON
   ======================================== */
.btn-start {
  position: relative;
  padding: 18px 48px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  border: none;
  border-radius: 60px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 6px 30px rgba(242,153,74,0.4);
}

.btn-start:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 0 30px rgba(242,153,74,0.5),
    0 0 60px rgba(242,153,74,0.3),
    0 10px 40px rgba(242,153,74,0.5);
}

.btn-start:active {
  transform: translateY(0) scale(0.97);
}

.btn-start .btn-text {
  position: relative;
  z-index: 2;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

.btn-glow {
  position: absolute;
  inset: -4px;
  border-radius: 64px;
  background: linear-gradient(135deg, var(--orange), var(--orange-bright), var(--gold));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(8px);
  animation: glowPulse 2s ease-in-out infinite;
}

.btn-start:hover .btn-glow {
  opacity: 0.6;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0.6; }
}

/* ========================================
   MISSIONS SECTION - Replaces hero on click
   ======================================== */
.missions-section {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  transform: scale(0.9) translateY(40px);
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--bounce);
  background: transparent;
}

.missions-section.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.missions-header {
  width: 100%;
  max-width: 1400px;
  text-align: center;
  margin-bottom: 32px;
}

.btn-home-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.btn-home-back:hover {
  background: var(--orange);
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(242, 153, 74, 0.3);
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--white);
  text-align: center;
  margin-bottom: 4px;
}

.mission-subtitle {
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  margin-bottom: 0;
}

.missions-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  max-width: 1400px;
  width: 100%;
}

.mission-card {
  background: var(--navy-light);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(30px) scale(0.95);
}

.missions-section.visible .mission-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.missions-section.visible .mission-card:nth-child(1) { transition-delay: 0.08s; }
.missions-section.visible .mission-card:nth-child(2) { transition-delay: 0.14s; }
.missions-section.visible .mission-card:nth-child(3) { transition-delay: 0.20s; }
.missions-section.visible .mission-card:nth-child(4) { transition-delay: 0.26s; }
.missions-section.visible .mission-card:nth-child(5) { transition-delay: 0.32s; }

.mission-card:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: var(--orange);
  box-shadow: var(--shadow-glow), var(--shadow);
}

.mission-card:active {
  transform: scale(0.97);
}

.card-image {
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-emoji {
  font-size: 56px;
  transition: var(--transition);
}

.mission-card:hover .card-emoji {
  transform: scale(1.2) rotate(5deg);
}

.card-overlay-text {
  position: absolute;
  bottom: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  background: rgba(0,0,0,0.3);
  padding: 4px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 16px;
}

.card-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--orange);
  margin-bottom: 6px;
}

.card-body p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  margin-bottom: 10px;
}

.card-stars {
  display: flex;
  gap: 4px;
}

.card-stars .star {
  color: var(--gold);
  font-size: 1.1rem;
}

.card-stars .star.earned {
  text-shadow: 0 0 8px rgba(241,196,15,0.6);
}

/* ========================================
   QUIZ PAGE
   ======================================== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--navy-light);
  border-bottom: 2px solid rgba(255,255,255,0.08);
}

.quiz-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon-round {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-round:hover {
  background: var(--orange);
  border-color: var(--orange);
  transform: scale(1.1);
}

.quiz-title-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--white);
}

.score-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy-lighter);
  padding: 10px 20px;
  border-radius: 30px;
  border: 2px solid var(--gold);
}

.score-icon {
  font-size: 1.3rem;
}

.score-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}

.quiz-container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 32px;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 55vh;
}

.quiz-poster {
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-frame {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 4/5;
  background: linear-gradient(135deg, var(--navy-lighter), var(--navy-light));
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,0.1);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.poster-frame::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(242,153,74,0.1) 0%, transparent 70%);
  animation: posterGlow 4s ease-in-out infinite;
}

@keyframes posterGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

.poster-emoji {
  font-size: 100px;
  position: relative;
  z-index: 1;
  animation: posterEmoji 3s ease-in-out infinite;
}

@keyframes posterEmoji {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.poster-caption {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--orange);
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.quiz-question-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-badge {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  width: fit-content;
}

.question-text {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--white-soft);
  font-weight: 500;
}

.answers-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.answer-card {
  background: var(--navy-light);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 18px 22px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  line-height: 1.5;
}

.answer-card:hover:not(.disabled) {
  border-color: var(--orange);
  background: var(--navy-lighter);
  transform: translateX(8px);
}

.answer-card .answer-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.answer-card:hover:not(.disabled) .answer-letter {
  background: var(--orange);
}

.answer-card.correct {
  border-color: var(--green);
  background: rgba(39,174,96,0.15);
  animation: correctPulse 0.5s ease;
}

.answer-card.correct .answer-letter {
  background: var(--green);
}

.answer-card.wrong {
  border-color: var(--red);
  background: rgba(231,76,60,0.15);
  animation: wrongShake 0.5s ease;
}

.answer-card.wrong .answer-letter {
  background: var(--red);
}

.answer-card.disabled {
  cursor: default;
  opacity: 0.7;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.quiz-footer {
  padding: 20px 32px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.progress-area {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.progress-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--orange);
  min-width: 50px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: var(--navy-lighter);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-bright));
  border-radius: 10px;
  transition: width 0.5s ease;
  width: 20%;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.btn-nav {
  padding: 12px 28px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(255,255,255,0.2);
  background: var(--navy-lighter);
  color: var(--white);
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-nav:hover:not(:disabled) {
  background: var(--navy-light);
  border-color: var(--orange);
}

.btn-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-next {
  background: var(--orange);
  border-color: var(--orange);
}

.btn-next:hover:not(:disabled) {
  background: var(--orange-bright);
  transform: translateX(4px);
}

/* ========================================
   DRAG & DROP PAGE
   ======================================== */
.dd-instruction {
  text-align: center;
  padding: 20px 32px;
  background: var(--navy-light);
  margin: 16px 32px;
  border-radius: var(--radius);
  border: 2px dashed var(--orange);
}

.dd-instruction p {
  font-size: 1.1rem;
  color: var(--white-soft);
}

.dd-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  padding: 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.dd-source {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drag-card {
  background: var(--navy-lighter);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: grab;
  transition: var(--transition);
  font-size: 0.95rem;
  line-height: 1.4;
  user-select: none;
}

.drag-card:hover {
  border-color: var(--orange);
  transform: scale(1.03);
  box-shadow: 0 4px 15px rgba(242,153,74,0.2);
}

.drag-card:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.drag-card.dragging {
  opacity: 0.5;
  border-color: var(--orange);
}

.drag-card.placed {
  background: rgba(242,153,74,0.1);
  border-color: var(--orange);
}

.dd-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.dd-zone {
  background: var(--navy-light);
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
}

.zone-header {
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}

.zone-header-sebab {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.zone-header-akibat {
  background: linear-gradient(135deg, #27ae60, #229954);
}

.zone-drop-area {
  min-height: 200px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

.zone-drop-area.drag-over {
  background: rgba(242,153,74,0.1);
  border-color: var(--orange);
}

.zone-placeholder {
  color: rgba(255,255,255,0.3);
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}

.dd-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 24px 32px 32px;
}

.btn-check {
  padding: 14px 36px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: var(--white);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(39,174,96,0.3);
}

.btn-check:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(39,174,96,0.4);
}

/* ========================================
   RESULT PAGE
   ======================================== */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 32px;
  position: relative;
  z-index: 1;
}

.result-badge {
  font-size: 80px;
  animation: resultBadge 1s ease-in-out infinite;
}

@keyframes resultBadge {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.result-title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--orange-dark);
  margin-top: 16px;
}

.result-subtitle {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 32px;
}

.result-score-area {
  text-align: center;
  margin-bottom: 24px;
}

.result-score-big {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  color: var(--white);
  text-shadow: 3px 3px 0 var(--orange);
}

.result-label {
  font-size: 1.1rem;
  color: var(--orange);
  font-weight: 600;
}

.result-stars {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.result-star {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--navy-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,0.1);
  transition: var(--transition);
}

.result-star.earned {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  border-color: var(--gold);
  animation: starEarned 0.5s var(--bounce);
}

.result-star.earned .star-inner {
  color: var(--white);
}

@keyframes starEarned {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.star-inner {
  font-size: 2.2rem;
  color: rgba(255,255,255,0.2);
}

.result-message {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--white-soft);
  margin-bottom: 32px;
}

.result-characters {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
}

.result-char {
  text-align: center;
  animation: charCelebrate 1s ease-in-out infinite;
}

.result-char:nth-child(2) {
  animation-delay: -0.5s;
}

@keyframes charCelebrate {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(-5deg); }
  75% { transform: translateY(-15px) rotate(5deg); }
}

.rc-head {
  width: 60px;
  height: 60px;
  background: #fdbcb4;
  border-radius: 50%;
  margin: 0 auto 8px;
  position: relative;
}

.rc-eyes {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-top: 16px;
}

.rc-eye {
  width: 8px;
  height: 8px;
  background: var(--navy);
  border-radius: 50%;
}

.rc-mouth {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--navy);
  font-weight: bold;
  font-size: 14px;
}

.rc-body {
  font-size: 36px;
}

.result-actions {
  display: flex;
  gap: 16px;
}

.btn-result {
  padding: 14px 32px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-retry {
  background: linear-gradient(135deg, var(--orange), var(--orange-bright));
  color: var(--white);
  box-shadow: 0 4px 20px rgba(242,153,74,0.3);
}

.btn-review {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: var(--white);
  box-shadow: 0 4px 20px rgba(52,152,219,0.3);
}

.btn-home {
  background: var(--navy-lighter);
  border: 2px solid var(--orange);
  color: var(--white);
}

.btn-result:hover {
  transform: translateY(-3px);
}

.btn-result:active {
  transform: translateY(0);
}

#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

#floating-stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.floating-star-item {
  position: absolute;
  font-size: 24px;
  animation: floatUp 3s ease-in forwards;
}

@keyframes floatUp {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  20% { opacity: 1; transform: translateY(80vh) scale(1); }
  100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

/* ========================================
   POPUPS
   ======================================== */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15,27,61,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.popup-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-card {
  background: var(--navy-light);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: popupSlide 0.4s var(--bounce);
}

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

.popup-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: var(--transition);
}

.popup-close:hover {
  color: var(--red);
}

.popup-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

.popup-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--orange);
  margin-bottom: 20px;
}

.popup-body {
  text-align: left;
  margin-bottom: 24px;
}

.popup-body ol {
  padding-left: 24px;
}

.popup-body li {
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--white-soft);
}

.correct-text {
  color: var(--green);
  font-weight: 600;
}

.wrong-text {
  color: var(--red);
  font-weight: 600;
}

.btn-popup-ok {
  padding: 12px 32px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-popup-ok:hover {
  background: var(--orange-bright);
  transform: scale(1.05);
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-avatar {
  font-size: 56px;
  margin-bottom: 8px;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--white);
  font-weight: 700;
}

.profile-class {
  font-size: 0.9rem;
  color: var(--orange);
  margin-bottom: 20px;
}

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

.stat-item {
  background: var(--navy-lighter);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
}

.feedback-card {
  max-width: 400px;
}

.feedback-emoji {
  font-size: 72px;
}

.feedback-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 12px 0 8px;
}

.feedback-text {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
  .missions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .hero {
    flex-direction: column;
    gap: 24px;
    padding: 20px 24px 40px;
    min-height: auto;
    padding-top: 60px;
  }

  .detective-img {
    width: 200px;
  }

  .main-title {
    font-size: 3rem;
  }

  .subtitle {
    font-size: 1.4rem;
  }

  .quiz-container {
    grid-template-columns: 1fr;
  }

  .quiz-poster {
    display: none;
  }

  .dd-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .missions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .hero {
    padding: 20px 16px;
  }

  .detective-img {
    width: 160px;
  }

  .main-title {
    font-size: 2.5rem;
  }

  .btn-start {
    padding: 14px 32px;
    font-size: 1.2rem;
  }

  .missions-section {
    padding: 20px 16px;
  }

  .result-title {
    font-size: 2.5rem;
  }

  .result-score-big {
    font-size: 4rem;
  }

  .result-actions {
    flex-direction: column;
    width: 80%;
  }

  .dd-zones {
    grid-template-columns: 1fr;
  }
}

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

  .main-title {
    font-size: 2rem;
  }

  .detective-img {
    width: 140px;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   UTILITY ANIMATIONS
   ======================================== */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

.slide-up {
  animation: slideUp 0.5s var(--ease-out) forwards;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.bounce-in {
  animation: bounceIn 0.6s var(--bounce) forwards;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s var(--bounce), toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  max-width: 350px;
}

.toast.success {
  background: linear-gradient(135deg, rgba(39,174,96,0.9), rgba(46,204,113,0.9));
  border: 1px solid var(--green);
}

.toast.error {
  background: linear-gradient(135deg, rgba(231,76,60,0.9), rgba(231,76,60,0.9));
  border: 1px solid var(--red);
}

.toast.info {
  background: linear-gradient(135deg, rgba(52,152,219,0.9), rgba(41,128,185,0.9));
  border: 1px solid #3498db;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Responsive adjustments for login */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px;
  }

  .login-icon {
    font-size: 60px;
  }

  .login-title {
    font-size: 1.8rem;
  }

  .login-subtitle {
    font-size: 0.9rem;
  }

  .user-badge {
    padding: 6px 12px;
  }

  .user-name {
    max-width: 80px;
    font-size: 0.85rem;
  }
}
