/* ==========================================================
   PROCEDURE QUEST - MODERN MOBILE-FIRST GAME STYLESHEET
   Mata Pelajaran: Bahasa Indonesia Kelas IX SMP
   Guru: Bahaudin Alfiansyah Syafi'i, S.Pd. (199702042025211039)
   ========================================================== */

:root {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-hover: rgba(51, 65, 85, 0.95);
    --border-glow: rgba(99, 102, 241, 0.35);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981, #06b6d4);
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #f59e0b, #f97316);
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #ef4444, #f43f5e);
    --accent: #ec4899;
    --accent-gradient: linear-gradient(135deg, #ec4899, #8b5cf6);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
    --shadow-button: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

/* Reset & Base Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.15) 0%, transparent 35%),
        radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
}

#app-container {
    width: 100%;
    max-width: 540px; /* Optimal smartphone wrapper */
    min-height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding-bottom: 75px; /* space for bottom nav */
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
}

/* Top App Bar */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.brand-icon {
    font-size: 1.5rem;
    background: var(--primary-gradient);
    border-radius: 10px;
    padding: 2px 6px;
    box-shadow: var(--shadow-glow);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.icon-btn:active {
    transform: scale(0.92);
    background: rgba(99, 102, 241, 0.3);
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    height: 65px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-body);
    gap: 3px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
}

.nav-item .nav-icon {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.nav-item.active {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
}

.nav-item.active .nav-icon {
    transform: scale(1.18);
}

/* Screen Wrapper */
.screen {
    display: none;
    padding: 16px;
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active {
    display: block;
}

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

/* Common Card & Container Styles */
.game-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0.8;
}

.card-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Common Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--primary-gradient);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: all 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.97);
    filter: brightness(1.1);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.97);
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================
   1. HOME / HERO SCREEN
   ========================================================== */
.hero-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px 5px 25px;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 16px;
}

.hero-art-container {
    width: 140px;
    height: 140px;
    margin: 10px auto 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-orb {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    filter: blur(24px);
    opacity: 0.45;
    animation: pulseOrb 4s infinite alternate ease-in-out;
}

.hero-art-icon {
    font-size: 5rem;
    position: relative;
    z-index: 2;
    animation: floatIcon 3s infinite ease-in-out;
}

@keyframes pulseOrb {
    0% { transform: scale(0.85); opacity: 0.3; }
    100% { transform: scale(1.15); opacity: 0.6; }
}

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

.hero-title {
    font-size: 2.1rem;
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff, #a5b4fc, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    font-size: 1rem;
    font-weight: 600;
    color: #38bdf8;
    margin-bottom: 12px;
}

.hero-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto 20px;
}

.student-input-card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 100%;
    box-shadow: var(--shadow-card);
    margin-bottom: 22px;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: left;
}

.text-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 1rem;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.teacher-credential-card {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
}

.teacher-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.teacher-info h4 {
    font-size: 0.92rem;
    color: #ffffff;
    margin-bottom: 2px;
}

.teacher-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================
   2. STUDENT DASHBOARD
   ========================================================== */
.student-profile-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar-wrap {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 2px solid #ffffff;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.profile-meta {
    flex: 1;
}

.student-greeting {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.student-display-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.level-badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(236, 72, 153, 0.2);
    border: 1px solid rgba(236, 72, 153, 0.4);
    color: #f472b6;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    text-align: center;
}

.stat-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-heading);
}

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

.progress-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 18px;
}

.progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.xp-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

/* Quest / Mission Action Grid */
.section-heading {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mission-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mission-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
}

.mission-card.completed {
    border-color: rgba(16, 185, 129, 0.4);
}

.mission-card.completed::after {
    content: '✓ SELESAI';
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 800;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

.mission-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.mission-info {
    flex: 1;
}

.mission-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

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

.mission-xp-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
}

/* Badges Showcase */
.badges-carousel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.badge-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 10px 4px;
    text-align: center;
    transition: all 0.2s ease;
    opacity: 0.45;
    filter: grayscale(80%);
}

.badge-item.unlocked {
    opacity: 1;
    filter: none;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.badge-icon {
    font-size: 1.7rem;
    margin-bottom: 4px;
}

.badge-name {
    font-size: 0.68rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================
   3. MATERI MODULES
   ========================================================== */
.module-header {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.module-nav-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.module-tab-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.module-tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.materi-card-item {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
}

.materi-card-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    margin-bottom: 6px;
}

.materi-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.materi-grid-item {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px;
}

.materi-grid-item .icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.materi-grid-item h5 {
    font-size: 0.85rem;
    color: #ffffff;
    margin-bottom: 4px;
}

.materi-grid-item p {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Comparison View */
.comparison-box {
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
}

.comparison-box.correct {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.comparison-box.wrong {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.comparison-label {
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.comparison-box.correct .comparison-label { color: #34d399; }
.comparison-box.wrong .comparison-label { color: #f87171; }

.comparison-content {
    font-size: 0.8rem;
    color: var(--text-main);
    line-height: 1.4;
}

/* Diagram Alur Struktur */
.diagram-step-flow {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.flow-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px;
    position: relative;
}

.flow-step-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    color: white;
    font-size: 0.82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flow-step-content h5 {
    font-size: 0.88rem;
    color: #ffffff;
}

.flow-step-content p {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Interactive Highlighting Lab */
.lab-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.lab-chip {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.lab-chip.active-tujuan { background: #3b82f6; border-color: #60a5fa; color: white; }
.lab-chip.active-bahan { background: #10b981; border-color: #34d399; color: white; }
.lab-chip.active-langkah { background: #f59e0b; border-color: #fbbf24; color: white; }
.lab-chip.active-ciri { background: #ec4899; border-color: #f472b6; color: white; }

.lab-document-paper {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 16px;
    line-height: 1.7;
    font-size: 0.85rem;
}

.lab-section-block {
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.lab-section-block.highlight-tujuan { background: rgba(59, 130, 246, 0.2); border-left: 4px solid #3b82f6; }
.lab-section-block.highlight-bahan { background: rgba(16, 185, 129, 0.2); border-left: 4px solid #10b981; }
.lab-section-block.highlight-langkah { background: rgba(245, 158, 11, 0.2); border-left: 4px solid #f59e0b; }
.lab-section-block.highlight-ciri { background: rgba(236, 72, 153, 0.2); border-left: 4px solid #ec4899; }

/* Quick Check Quiz inside Modules */
.quick-check-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 14px;
}

.qc-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.qc-option-btn {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.qc-option-btn.correct {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    color: #34d399;
}

.qc-option-btn.wrong {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #f87171;
}

/* ==========================================================
   4. MINI GAMES SYSTEM
   ========================================================== */

/* Game Heart Meter */
.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hearts-container {
    display: flex;
    gap: 4px;
    font-size: 1.15rem;
}

.heart-lost {
    filter: grayscale(100%) opacity(0.3);
}

/* GAME 1: STEP SORTER */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.sortable-item {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.sortable-item.dragging {
    opacity: 0.5;
    background: rgba(99, 102, 241, 0.3);
    border-color: #818cf8;
}

.sortable-item .item-handle {
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: grab;
}

.sortable-item .item-text {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.35;
}

.sort-reorder-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-move {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 28px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
}

.btn-move:active { background: #6366f1; }

/* GAME 2: PROCEDURE DETECTIVE */
.detective-snippet-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.detective-snippet-card:active {
    transform: scale(0.98);
}

.detective-snippet-card.suspect-correct {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.detective-snippet-card.suspect-innocent {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

/* GAME 3: WORD HUNTER */
.token-stream-box {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.8;
    margin-bottom: 16px;
}

.word-token {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-token:active {
    transform: scale(0.92);
}

.word-token.found-success {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    pointer-events: none;
}

.word-token.found-wrong {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #f87171;
    animation: shake 0.3s ease;
}

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

/* GAME 4: BOSS BATTLE */
.boss-arena {
    background: radial-gradient(circle at center, rgba(168, 85, 247, 0.2) 0%, rgba(15, 23, 42, 0.9) 70%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.boss-avatar-frame {
    width: 84px;
    height: 84px;
    margin: 0 auto 10px;
    background: var(--danger-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.5);
    animation: bossHover 2.5s infinite ease-in-out;
}

@keyframes bossHover {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(2deg); }
}

.boss-avatar-frame.hit {
    animation: bossDamage 0.4s ease;
    filter: brightness(2);
}

@keyframes bossDamage {
    0% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(0.9) rotate(5deg); }
    100% { transform: scale(1) rotate(0); }
}

.hp-bar-wrapper {
    margin: 8px 0;
}

.hp-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hp-bar-fill-boss {
    height: 100%;
    background: var(--danger-gradient);
    transition: width 0.4s ease;
}

.hp-bar-fill-player {
    height: 100%;
    background: var(--success-gradient);
    transition: width 0.4s ease;
}

.boss-dialogue-cloud {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: var(--radius-md);
    padding: 10px;
    font-size: 0.8rem;
    font-style: italic;
    color: #e9d5ff;
    margin: 10px 0;
}

/* ==========================================================
   5. QUIZ EVALUASI
   ========================================================== */
.quiz-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.quiz-question-box {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
}

.quiz-options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.quiz-opt-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.85rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.opt-letter {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.quiz-opt-btn.state-correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #34d399;
}

.quiz-opt-btn.state-correct .opt-letter {
    background: #10b981;
    color: white;
}

.quiz-opt-btn.state-wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
}

.quiz-opt-btn.state-wrong .opt-letter {
    background: #ef4444;
    color: white;
}

.quiz-explanation-card {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 14px;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* ==========================================================
   6. FINAL RESULT & CERTIFICATE
   ========================================================== */
.certificate-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(245, 158, 11, 0.5);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.2);
}

.cert-stamp {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 2px dashed #f59e0b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 800;
    color: #f59e0b;
    transform: rotate(12deg);
}

.cert-student-name {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffffff;
    margin: 8px 0;
    text-decoration: underline;
    text-decoration-color: #f59e0b;
}

.cert-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.cert-meta-box {
    background: rgba(15, 23, 42, 0.6);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
}

.cert-teacher-sig {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 12px;
    margin-top: 16px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* ==========================================================
   7. MODALS & OVERLAYS
   ========================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.badge-unlock-modal {
    text-align: center;
}

.badge-unlock-icon {
    font-size: 4.5rem;
    animation: bounce 0.6s infinite alternate;
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

/* Canvas Confetti */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 300;
}

/* Print Styles for Certificate */
@media print {
    body {
        background: white;
        color: black;
    }
    #app-container {
        box-shadow: none;
        max-width: 100%;
        padding: 0;
    }
    .top-nav, .bottom-nav, .btn-primary, .btn-secondary {
        display: none !important;
    }
    .certificate-card {
        background: white !important;
        color: black !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    .cert-student-name {
        color: black !important;
    }
}
