/* ==========================================================================
   1. PENGATURAN DASAR & BACKGROUND GRID
   ========================================================================== */
body, html {
    margin: 0; 
    padding: 0; 
    min-height: 100vh;
    background-color: #E2E8F0;
    background-image: radial-gradient(#B0B8C1 1px, transparent 1px);
    background-size: 30px 30px;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navbar {
    z-index: 10000 !important; 
}

.game-container { 
    width: 90%; 
    max-width: 450px; 
    margin: 0 auto; 
    padding-top: 60px; 
    padding-bottom: 40px; 
    position: relative;
    text-align: center;
    z-index: 10;
}

.hidden { display: none !important; }

.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
    width: 100%;
}

.start-screen h3 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.3;
}

.start-screen p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 320px;
}

.btn-start {
    width: auto;
    padding: 12px 26px;
    background-color: #059669;
    color: #FFFFFF;
}

.btn-start:hover {
    background-color: #0b7f5e;
}

.question-screen {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   2. DESAIN PITA 3D (LEBIH PANJANG & RAPAT)
   ========================================================================== */
.quiz-ribbon {
    position: relative;
    background: #114E60;
    color: white;
    padding: 12px 20px;
    margin: 0 auto 10px auto; /* Jarak bawah rapat dengan kotak soal */
    width: calc(100% + 24px); /* Lebih panjang sedikit dari kotak soal */
    left: -12px; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    box-sizing: border-box;
}

/* Lipatan Segitiga Bayangan di Belakang Pita */
.quiz-ribbon::before, .quiz-ribbon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    border: 5px solid transparent;
}
.quiz-ribbon::before {
    left: 12px; 
    border-top-color: #082c37;
    border-right-color: #082c37;
}
.quiz-ribbon::after {
    right: 12px; 
    border-top-color: #082c37;
    border-left-color: #082c37;
}

/* Ekor Pita yang Menjuntai */
.quiz-ribbon .ribbon-content::before,
.quiz-ribbon .ribbon-content::after {
    content: '';
    position: absolute;
    top: 10px;
    width: 25px;
    height: 100%;
    background: #165b6f; 
    z-index: -1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.quiz-ribbon .ribbon-content::before {
    left: -20px;
    border-right: 10px solid #114E60;
    border-top: 0 solid transparent;
    border-bottom: 12px solid transparent; 
}

.quiz-ribbon .ribbon-content::after {
    right: -20px;
    border-left: 10px solid #114E60;
    border-top: 0 solid transparent;
    border-bottom: 12px solid transparent; 
}

.ribbon-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.ribbon-title {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 2px;
    background: #F1C40F;
    color: #114E60;
    padding: 3px 12px;
    border-radius: 4px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

.ribbon-stats {
    display: flex;
    gap: 10px;
}

.stat-box {
    font-weight: 700;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ==========================================================================
   3. KOMPONEN KARTU KUIS (FLIP SYSTEM)
   ========================================================================== */
.card { 
    width: 100%; 
    height: 240px; 
    margin: 0 auto 25px auto; 
    perspective: 1000px; 
    cursor: pointer; 
}

.card-inner { 
    width: 100%; 
    height: 100%; 
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); 
    transform-style: preserve-3d; 
    position: relative; 
}

.card.flipped .card-inner { 
    transform: rotateY(180deg); 
}

.card-front, .card-back { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    backface-visibility: hidden; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    padding: 25px; 
    border-radius: 20px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); 
    box-sizing: border-box;
}

.card-front { 
    background: #FFFFFF; 
    color: #114E60; 
}

.card-front h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.5;
}

.card-back { 
    background: #114E60; 
    color: #FFFFFF; 
    transform: rotateY(180deg); 
}

.card.page-enter {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    animation: cardEntry 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#start-btn.page-enter {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    animation: buttonEntry 0.55s ease-out 0.15s forwards;
}

.card.card-reveal {
    animation: cardReveal 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.card.question-change {
    animation: cardShift 0.45s ease-out forwards;
}

.card .fade-slide-in {
    animation: fadeSlideIn 0.45s ease-out forwards;
}

.card .fade-slide-out {
    animation: fadeSlideOut 0.25s ease-in forwards;
}

@keyframes cardReveal {
    0% {
        transform: translateY(24px) scale(0.96);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes buttonEntry {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cardShift {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    }
    50% {
        transform: translateY(-10px) scale(1.01);
        box-shadow: 0 18px 35px rgba(0,0,0,0.14);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    }
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
}

/* ==========================================================================
   4. TOMBOL CONTROLS (BERDERET SEBARIS DAN RESPONSIF)
   ========================================================================== */
.controls {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.controls > .btn {
    flex: 1 1 160px;
    min-width: 140px;
}

.btn { 
    width: auto; 
    padding: 14px; 
    border-radius: 10px; 
    border: none; 
    font-size: 16px; 
    font-weight: 800;
    cursor: pointer; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    box-sizing: border-box;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-myth { background-color: #E74C3C; color: white; }
.btn-myth:hover { background-color: #c0392b; }

.btn-fact { background-color: #27AE60; color: white; }
.btn-fact:hover { background-color: #219653; }

.btn-next { background-color: #34495E; color: white; }
.btn-next:hover { background-color: #2c3e50; }

.btn-restart { background-color: #F1C40F; color: black; }
.btn-restart:hover { background-color: #d4ac0d; }

/* ==========================================================================
   5. EFEK ANIMASI GETAR SALAH (SHAKE) & MOUSE FOLLOW
   ========================================================================== */
.shake { 
    animation: shakeRed 0.5s cubic-bezier(.36,.07,.19,.97) both; 
    transform: translate3d(0, 0, 0);
    perspective: 1000px;
}

.shake .card-front, .shake .card-back {
    border: 2px solid #E74C3C !important;
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.5), 0 10px 25px rgba(0,0,0,0.1) !important;
}

@keyframes shakeRed {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(5px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

.cursor-glow {
    position: fixed; 
    width: 80px; 
    height: 80px;
    background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.2) 35%, rgba(255,255,255,0) 75%);
    border-radius: 50%; 
    pointer-events: none; 
    z-index: 9998; 
    transform: translate(-50%, -50%); 
    transition: left 0.12s ease-out, top 0.12s ease-out;
    box-shadow: 0 0 25px rgba(255,255,255,0.45);
    opacity: 0.95;
}

/* ==========================================================================
   6. RESPONSIVE MOBILE OPTIMIZATION
   ========================================================================== */
@media (max-width: 600px) {
    .card { height: 210px; }
    .game-container { padding-top: 90px; }
    .quiz-ribbon { 
        width: calc(100% + 16px); 
        left: -8px; 
    }
    .quiz-ribbon::before { left: 8px; }
    .quiz-ribbon::after { right: 8px; }
}
/* Kontainer latar belakang */
.floating-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Agar tidak menghalangi klik */
  z-index: 0;
  overflow: hidden;
}

.med-obj {
  position: absolute;
  font-size: 30px;
  opacity: 0.3;
  animation: floatEffect 8s infinite ease-in-out;
}

/* Posisi dan kecepatan acak untuk setiap objek */
.obj-1 { top: 10%; left: 10%; animation-delay: 0s; }
.obj-2 { top: 20%; right: 15%; animation-delay: 2s; }
.obj-3 { bottom: 15%; left: 20%; animation-delay: 4s; }
.obj-4 { bottom: 25%; right: 10%; animation-delay: 6s; }

/* Animasi melayang */
@keyframes floatEffect {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(10deg); }
}
/* Container Latar Belakang */
.bg-decoration {
    position: fixed; /* Kunci agar tidak menggeser konten lain */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; /* Menempatkan di belakang segalanya */
    pointer-events: none; /* Agar tidak menghalangi klik mouse */
    filter: grayscale(100%) opacity(0.3); /* Hitam putih dan transparansi rendah */
    overflow: hidden;
}

/* Objek individu */
.med-item {
    position: absolute;
    font-size: 40px;
    animation: floatAnimation 15s infinite ease-in-out;
}

/* Posisi acak agar tersebar */
.med-item:nth-child(1) { top: 10%; left: 5%; }
.med-item:nth-child(2) { top: 15%; left: 85%; animation-delay: 2s; }
.med-item:nth-child(3) { top: 50%; left: 10%; animation-delay: 4s; }
.med-item:nth-child(4) { top: 70%; left: 75%; animation-delay: 6s; }
.med-item:nth-child(5) { top: 30%; left: 40%; animation-delay: 8s; }
.med-item:nth-child(6) { top: 80%; left: 20%; animation-delay: 1s; }
.med-item:nth-child(7) { top: 20%; left: 60%; animation-delay: 3s; }
.med-item:nth-child(8) { top: 60%; left: 90%; animation-delay: 5s; }
.med-item:nth-child(9) { top: 5%; left: 45%; animation-delay: 7s; }
.med-item:nth-child(10) { top: 85%; left: 55%; animation-delay: 9s; }

/* Animasi Mengambang */
@keyframes floatAnimation {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-50px) rotate(10deg); }
}