/* ============================================================
   LMS EDUGAME - Design System
   Teal-Centered, Clean & Modern
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Bubblegum+Sans&display=swap');

/* ============================================================
   CSS VARIABLES - Color Palette
   ============================================================ */
:root {
    /* === PRIMARY: Teal === */
    --primary: #00B4A6;
    --primary-dark: #008F84;
    --primary-light: #E0F7F6;

    /* === SECONDARY: Gold === */
    --secondary: #FFC107;      /* Vivid Gold/Amber */
    --secondary-dark: #D97706; /* Dark Gold/Amber */
    --secondary-light: #FEF3C7;/* Light Gold */

    /* === SEMANTIC: Gamification Feedback === */
    /* Correct / Success */
    --green: #10B981;
    --green-dark: #059669;
    --green-light: #D1FAE5;

    /* Wrong / Error / Danger */
    --red: #EF4444;
    --red-dark: #DC2626;
    --red-light: #FEE2E2;

    /* Warning / Alerts */
    --orange: #F59E0B;
    --orange-dark: #D97706;
    --orange-light: #FEF3C7;

    /* Accent / Neutral */
    --accent: var(--secondary);
    --accent-dark: var(--secondary-dark);
    --accent-light: var(--secondary-light);

    --slate: #64748B;
    --slate-dark: #475569;
    --slate-light: #F1F5F9;

    /* === BACKGROUNDS === */
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-sidebar: #F1F5F9;

    /* === TEXT === */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;

    /* === BORDERS === */
    --border: #E2E8F0;
    --border-strong: #CBD5E1;

    /* === SHADOWS === */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.13);
    --shadow-colored: 0 8px 24px rgba(0,180,166,0.25);

    /* === RADIUS === */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;

    /* === FONTS === */
    --font-main: 'Nunito', sans-serif;
    --font-display: 'Bubblegum Sans', cursive;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* === ALIAS (backward compat untuk inline styles) === */
    --blue: var(--primary);
    --blue-dark: var(--primary-dark);
    --purple: var(--secondary);       /* indigo */
    --purple-dark: var(--secondary-dark);
    --pink: var(--secondary);         /* indigo juga, hapus pink */
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle dot pattern background */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(circle, #FFD70022 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-main);
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-primary);
}

.display-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--primary);
    text-shadow: 3px 3px 0 var(--primary-light);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 280px;
    background: var(--primary);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(0,143,132,0.3);
}

/* Siswa sidebar: sedikit lebih terang, tetap teal family */
.sidebar-student {
    background: var(--primary-dark);
    box-shadow: 4px 0 24px rgba(14,205,196,0.28);
}


.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR COMPONENTS
   ============================================================ */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px dashed rgba(255,255,255,0.4);
}

.sidebar-logo-icon {
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.25);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: #fff;
    line-height: 1.1;
}

.sidebar-logo-text small {
    display: block;
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.85;
}

.sidebar-user {
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 48px; height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.6);
}

.sidebar-user-info .name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.sidebar-user-info .role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}

.sidebar-stars {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    font-size: 0.82rem;
    color: #fff;
    font-weight: 800;
    margin-bottom: 24px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.3);
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 900;
    color: rgba(255,255,255,0.95);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    margin-left: 12px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: var(--radius-md);
    color: #fff;
    font-weight: 700;
    font-size: 0.93rem;
    margin-bottom: 8px;

    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.12);
    position: relative;
    transition:
        transform 0.13s cubic-bezier(0.25,1,0.5,1),
        background 0.15s ease,
        box-shadow 0.13s ease,
        border-color 0.15s ease;
    text-decoration: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
    box-shadow:
        0 3px 0 rgba(0,0,0,0.2),
        0 1px 0 rgba(255,255,255,0.1) inset;
}

.nav-item:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
    transform: translateX(6px) scale(1.01);
    box-shadow:
        0 5px 0 rgba(0,0,0,0.22),
        0 8px 20px rgba(0,0,0,0.18),
        inset 0 1px 0 rgba(255,255,255,0.3);
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    z-index: 2;
}


.nav-item:active {
    transform: translateX(4px) scale(1.005);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.2),
        0 2px 6px rgba(0,0,0,0.12),
        inset 0 2px 0 rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.18);
}


/* Active: solid white pill — maksimal kontras */
.nav-item.active {
    background: rgba(255,255,255,0.95);
    color: var(--primary-dark);
    border-color: rgba(255,255,255,1);
    transform: translateX(6px);
    text-shadow: none;
    box-shadow:
        0 5px 0 rgba(0,0,0,0.15),
        0 8px 24px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,1);
    font-weight: 900;
}


/* Active state untuk sidebar siswa: warna teal gelap */
.sidebar-student .nav-item.active {
    color: #006B62;
}


.nav-item.active .icon {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.nav-item .icon {
    font-size: 1.3rem;
    width: 30px;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    flex-shrink: 0;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px dashed rgba(255,255,255,0.35);
}

.sidebar-bottom .btn-ghost {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.4);
    font-weight: 800;
    font-size: 0.9rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
    box-shadow:
        0 4px 0 rgba(0,0,0,0.2),
        0 6px 16px rgba(0,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.25);
    letter-spacing: 0.3px;
}
.sidebar-bottom .btn-ghost:hover {
    background: rgba(239,68,68,0.55);
    border-color: rgba(255,255,255,0.7);
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 rgba(180,0,0,0.3),
        0 10px 24px rgba(200,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.3);
    color: #fff;
}
.sidebar-bottom .btn-ghost:active {
    transform: translateY(3px);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.2),
        0 2px 8px rgba(0,0,0,0.1);
    background: rgba(200,0,0,0.4);
}



/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
}

.topbar-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.topbar-title span { color: var(--primary); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.card-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.card-icon.red { background: var(--primary-light); }
.card-icon.teal { background: var(--secondary-light); }
.card-icon.yellow { background: #FFF9E0; }
.card-icon.purple { background: #F3EEFF; }
.card-icon.green { background: #E8F8E9; }

.card-stat {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.card-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Class Card (Kelas) */
.class-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.class-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-6px);
    border-color: var(--secondary);
}

.class-card-cover {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.class-card-body {
    padding: 20px;
}

.class-card-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.class-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    flex-wrap: wrap;
}

.kode-kelas {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 3px;
    font-family: monospace;
    box-shadow: var(--shadow-colored);
    user-select: all;
}

/* Material Card */
.material-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.material-card:hover {
    border-color: var(--secondary);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.material-type-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    position: relative;
    top: 0;
    /* 3D base — overridden per variant */
    transition: transform 0.1s cubic-bezier(0.25,1,0.5,1),
                box-shadow 0.1s cubic-bezier(0.25,1,0.5,1),
                filter 0.1s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    letter-spacing: 0.2px;
}

/* ---- Primary (Teal) ---- */
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow:
        0 6px 0 #005E57,
        0 10px 24px rgba(0,180,166,0.3),
        inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #005E57,
        0 14px 28px rgba(0,180,166,0.35),
        inset 0 1px 0 rgba(255,255,255,0.35);
    color: #fff;
}
.btn-primary:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #005E57,
        0 4px 10px rgba(0,180,166,0.2),
        inset 0 1px 0 rgba(255,255,255,0.2);
}


/* ---- Secondary (Indigo) ---- */
.btn-secondary {
    background: var(--secondary);
    color: #fff;
    text-shadow: 0 1px 2px rgba(180, 83, 9, 0.6);
    box-shadow:
        0 6px 0 #B45309,
        0 10px 24px rgba(217, 119, 6, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-secondary:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #B45309,
        0 14px 28px rgba(217, 119, 6, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    color: #fff;
}
.btn-secondary:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #B45309,
        0 4px 10px rgba(217, 119, 6, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}


/* ---- Success (Green) ---- */
.btn-success {
    background: var(--green);
    color: #fff;
    box-shadow:
        0 6px 0 #064E3B,
        0 10px 24px rgba(16,185,129,0.3),
        inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-success:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #064E3B,
        0 14px 28px rgba(16,185,129,0.35),
        inset 0 1px 0 rgba(255,255,255,0.35);
    color: #fff;
}
.btn-success:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #064E3B,
        0 4px 10px rgba(16,185,129,0.2),
        inset 0 1px 0 rgba(255,255,255,0.2);
}


/* ---- Outline ---- */
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 2.5px solid var(--primary);
    text-shadow: none;
    box-shadow:
        0 5px 0 rgba(0,143,132,0.5),
        0 8px 16px rgba(0,180,166,0.15),
        inset 0 1px 0 rgba(255,255,255,0.9);
}
.btn-outline:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 rgba(0,143,132,0.5),
        0 12px 20px rgba(0,180,166,0.2),
        inset 0 1px 0 rgba(255,255,255,0.9);
}
.btn-outline:active {
    transform: translateY(4px);
    box-shadow:
        0 1px 0 rgba(0,143,132,0.4),
        0 2px 6px rgba(0,180,166,0.1),
        inset 0 1px 0 rgba(255,255,255,0.7);
}

/* ---- Ghost ---- */
.btn-ghost {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.45);
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
    box-shadow:
        0 5px 0 rgba(0,0,0,0.2),
        0 8px 20px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.4);
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 rgba(0,0,0,0.2),
        0 12px 24px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.4);
    color: #fff;
}
.btn-ghost:active {
    transform: translateY(4px);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.2),
        0 2px 8px rgba(0,0,0,0.1);
}

/* ---- Soft ---- */
.btn-soft {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    text-shadow: none;
    box-shadow: 
        0 4px 0 rgba(0, 180, 166, 0.2),
        0 6px 16px rgba(0, 180, 166, 0.1);
}
.btn-soft:hover {
    background: #cbf3f0; /* slightly darker primary-light */
    transform: translateY(-2px);
    box-shadow: 
        0 6px 0 rgba(0, 180, 166, 0.2),
        0 10px 20px rgba(0, 180, 166, 0.15);
}
.btn-soft:active {
    transform: translateY(4px);
    box-shadow: 
        0 1px 0 rgba(0, 180, 166, 0.2),
        0 2px 6px rgba(0, 180, 166, 0.1);
}

/* ---- Sizes ---- */
.btn-sm  { padding: 8px 16px;  font-size: 0.85rem; }
.btn-lg  { padding: 16px 36px; font-size: 1.15rem; }
.btn-xl  { padding: 20px 48px; font-size: 1.3rem;  }
.btn-full { width: 100%; }

/* ---- Danger (Red) ---- */
.btn-danger {
    background: var(--red);
    color: #fff;
    box-shadow:
        0 6px 0 #7F1D1D,
        0 10px 24px rgba(239,68,68,0.3),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-danger:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #7F1D1D,
        0 14px 28px rgba(239,68,68,0.35),
        inset 0 1px 0 rgba(255,255,255,0.3);
    color: #fff;
}
.btn-danger:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #7F1D1D,
        0 4px 10px rgba(239,68,68,0.2);
}


/* ---- Disabled ---- */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 0 rgba(0,0,0,0.15) !important;
    filter: none !important;
}


/* ============================================================
   3D ARCADE / GAME BUTTONS (Playful & Tactile)
   ============================================================ */
.btn-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 26px;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
    position: relative;
    top: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.18);
    letter-spacing: 0.3px;
    line-height: 1.2;
}
.btn-3d:active {
    transform: translateY(4px);
}
/* btn-3d-primary: Teal */
.btn-3d-primary {
    background: #00A89E;
    color: #fff !important;
    box-shadow: 0 6px 0 #006B62, 0 10px 16px rgba(0,180,166,0.3);
}
.btn-3d-primary:hover {
    background: #00B4A6;
}
.btn-3d-primary:active {
    box-shadow: 0 2px 0 #006B62, 0 4px 8px rgba(0,180,166,0.25);
}
/* btn-3d-success: Green */
.btn-3d-success {
    background: #10B981;
    color: #fff !important;
    box-shadow: 0 6px 0 #065F46, 0 10px 16px rgba(16,185,129,0.3);
}
.btn-3d-success:hover {
    background: #1DC990;
}
.btn-3d-success:active {
    box-shadow: 0 2px 0 #065F46, 0 4px 8px rgba(16,185,129,0.25);
}
/* btn-3d-cyan: teal muda */
.btn-3d-cyan {
    background: #14B8A6;
    color: #fff !important;
    box-shadow: 0 6px 0 #0F766E, 0 10px 16px rgba(20,184,166,0.3);
}
.btn-3d-cyan:hover {
    background: #1ECAB8;
}
.btn-3d-cyan:active {
    box-shadow: 0 2px 0 #0F766E, 0 4px 8px rgba(20,184,166,0.25);
}
/* btn-3d-orange: Amber */
.btn-3d-orange {
    background: #F59E0B;
    color: #fff !important;
    box-shadow: 0 6px 0 #92400E, 0 10px 16px rgba(245,158,11,0.3);
}
.btn-3d-orange:hover {
    background: #F9A825;
}
.btn-3d-orange:active {
    box-shadow: 0 2px 0 #92400E, 0 4px 8px rgba(245,158,11,0.25);
}
/* btn-3d-yellow: Kuning kalem */
.btn-3d-yellow {
    background: #FCD34D;
    color: #78350F !important;
    box-shadow: 0 6px 0 #92400E, 0 10px 16px rgba(252,211,77,0.3);
    text-shadow: none;
}
.btn-3d-yellow:hover {
    background: #FDE68A;
}
.btn-3d-yellow:active {
    box-shadow: 0 2px 0 #92400E, 0 4px 8px rgba(252,211,77,0.25);
}
/* btn-3d-purple: Indigo */
.btn-3d-purple {
    background: #6366F1;
    color: #fff !important;
    box-shadow: 0 6px 0 #3730A3, 0 10px 16px rgba(99,102,241,0.3);
}
.btn-3d-purple:hover {
    background: #7274F3;
}
.btn-3d-purple:active {
    box-shadow: 0 2px 0 #3730A3, 0 4px 8px rgba(99,102,241,0.25);
}

.btn-3d-sm { padding: 8px 18px; font-size: 0.9rem; border-radius: 12px; box-shadow: 0 4px 0 rgba(0,0,0,0.22); }
.btn-3d-sm:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.22); }
.btn-3d-full { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label .icon { font-size: 1.1rem; }

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,180,166,0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

textarea.form-control { resize: vertical; min-height: 120px; }

select.form-control { cursor: pointer; }

.form-control.is-error { border-color: var(--red); }
.form-control.is-success { border-color: var(--green); }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 6px;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 11px;
    border-radius: var(--radius-full);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    background: var(--slate-light);
    color: var(--slate-dark);
}

.badge-primary { background: var(--primary-light);   color: var(--primary-dark); }
.badge-teal    { background: var(--primary-light);   color: var(--primary-dark); }
.badge-yellow  { background: var(--accent-light);    color: var(--accent-dark); }
.badge-green   { background: var(--green-light);     color: var(--green-dark); }
.badge-purple  { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-red     { background: var(--red-light);       color: var(--red-dark); }

/* ============================================================
   GRIDS
   ============================================================ */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 24px;
    border-left: 5px solid;
}

.alert-success { background: #E8F8E9; border-color: var(--green); color: #2d6a2f; }
.alert-error   { background: #FFE5E5; border-color: var(--red); color: #8b1a1a; }
.alert-info    { background: var(--secondary-light); border-color: var(--secondary); color: #1a5f5b; }
.alert-warning { background: #FFF9E0; border-color: var(--accent-dark); color: #7a5a00; }

.alert-icon { font-size: 1.3rem; flex-shrink: 0; }

/* ============================================================
   PROGRESS BAR (Star Progress)
   ============================================================ */
.progress-bar-wrap {
    background: var(--border);
    border-radius: var(--radius-full);
    height: 16px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ============================================================
   AUTH PAGES (LOGIN / REGISTER)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    background: #F8FAFC;
}

.auth-page::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0,180,166,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(99,102,241,0.10) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255,230,109,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.auth-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255,255,255,0.8);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 80px; height: 80px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-colored);
    animation: bounce 2s ease-in-out infinite;
}

.auth-logo h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--primary);
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--border);
}

.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.role-option {
    position: relative;
}

.role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
}

.role-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    border: 3px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 700;
    text-align: center;
    font-size: 0.9rem;
}

.role-option label .emoji { font-size: 2.5rem; }

.role-option input:checked + label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(0,180,166,0.2);
}

.role-option label:hover {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

/* ============================================================
   GAME MAP
   ============================================================ */
.gamemap-container {
    position: relative;
    width: 100%;
    height: 600px;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--border);
    background: #1a1a2e;
    user-select: none;
}

.gamemap-bg {
    width: 100%;
    display: block;
}

.gamemap-node {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.node-pin {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    border: 4px solid #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,255,255,0.3);
    transition: var(--transition);
    animation: pulse-node 2.5s ease-in-out infinite;
    position: relative;
}

.node-pin.completed {
    background: var(--green) !important;
    animation: none;
    box-shadow: 0 4px 16px rgba(107,203,119,0.5);
}

.node-pin.locked {
    background: #aaa !important;
    animation: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.node-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.gamemap-node:hover .node-pin:not(.locked) {
    transform: scale(1.2);
    box-shadow: 0 8px 28px rgba(0,0,0,0.5), 0 0 0 6px rgba(255,255,255,0.4);
}

@keyframes pulse-node {
    0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,255,255,0.3); }
    50%       { box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 10px rgba(255,255,255,0.15); }
}

/* ============================================================
   GAME MAP ROUTES & ANIMATED AVATAR
   ============================================================ */
.gamemap-routes-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}

.route-path-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.45);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-path-main {
    fill: none;
    stroke: #FCD34D;
    stroke-width: 3.5;
    stroke-dasharray: 6, 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: routeDashFlow 1.2s linear infinite;
    filter: drop-shadow(0 0 6px rgba(255, 230, 109, 0.8));
}

@keyframes routeDashFlow {
    to { stroke-dashoffset: -24; }
}

/* Avatar Player 3D/Chibi */
.gamemap-player-avatar {
    position: absolute;
    transform: translate(-50%, -75%);
    z-index: 25;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}

.avatar-balloon {
    position: absolute;
    top: -34px;
    background: #ffffff;
    color: var(--text-main);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    border: 2px solid var(--primary);
    opacity: 0;
    transform: translateY(6px) scale(0.85);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.avatar-balloon.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.avatar-balloon::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--primary) transparent transparent;
}

.avatar-character-wrapper {
    position: relative;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.avatar-3d-badge {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    border: 3.5px solid #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4), inset 0 2px 6px rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: avatarIdle 2.5s ease-in-out infinite;
}

.avatar-emoji-figure {
    font-size: 2.1rem;
    user-select: none;
    transform-origin: center bottom;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.avatar-shadow-pod {
    width: 36px;
    height: 10px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    filter: blur(2px);
    margin-top: -2px;
}

/* Animasi Avatar Berjalan */
.gamemap-player-avatar.walking .avatar-3d-badge {
    animation: avatarWalking 0.25s ease-in-out infinite alternate !important;
}

.gamemap-player-avatar.cheering .avatar-3d-badge {
    animation: avatarCheer 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

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

@keyframes avatarWalking {
    0% { transform: translateY(0) rotate(-7deg); }
    100% { transform: translateY(-8px) rotate(7deg); }
}

@keyframes avatarCheer {
    0% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-24px) scale(1.2) rotate(-8deg); }
    70% { transform: translateY(-26px) scale(1.2) rotate(8deg); }
    100% { transform: translateY(0) scale(1); }
}

/* Partikel Debu Jejak Langkah */
.dust-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
    pointer-events: none;
    z-index: 24;
    animation: dustFade 0.6s ease-out forwards;
}

@keyframes dustFade {
    0% { opacity: 0.9; transform: scale(0.6) translateY(0); }
    100% { opacity: 0; transform: scale(1.8) translateY(-14px); }
}

/* Gamemap Pan Layer (for zoom/pan) */
.gamemap-pan-layer {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}
.gamemap-pan-layer .gamemap-bg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.gamemap-pan-layer .gamemap-routes-svg {
    position: absolute;
    inset: 0;
}

/* Locked route path */
.route-path-locked {
    fill: none;
    stroke: rgba(120, 120, 120, 0.5);
    stroke-width: 3.5;
    stroke-dasharray: 5, 8;
    stroke-linecap: round;
}

/* Node locked class */
.gamemap-node.node-locked {
    cursor: not-allowed;
}

/* Pet Companion */
.gamemap-pet {
    position: absolute;
    transform: translate(-50%, -75%);
    z-index: 24;
    pointer-events: none;
    transition: left 1.2s cubic-bezier(0.34,1.56,0.64,1), top 1.2s cubic-bezier(0.34,1.56,0.64,1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pet-emoji {
    font-size: 1.5rem;
    display: inline-block;
    animation: petBounce 1.8s ease-in-out infinite;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}
@keyframes petBounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-6px) rotate(5deg); }
}

/* Ambient Sound Toggle Button */
.gamemap-ambient-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 40;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(6px);
}
.gamemap-ambient-btn:hover { background: rgba(0,0,0,0.75); transform: scale(1.1); }
.gamemap-ambient-btn.active { background: rgba(0,180,166,0.85); border-color: #fff; }

/* Peti (Treasure Chest) on Node */
.node-peti {
    position: absolute;
    top: -18px;
    right: -12px;
    font-size: 1.2rem;
    animation: petiFloat 1.6s ease-in-out infinite;
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    z-index: 30;
}
@keyframes petiFloat {
    0%, 100% { transform: translateY(0) rotate(-8deg); }
    50%       { transform: translateY(-5px) rotate(8deg); }
}
@keyframes petiPop {
    0%   { transform: scale(0.5) rotate(-20deg); }
    60%  { transform: scale(1.4) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Peti reward popup */
.peti-popup {
    position: absolute;
    z-index: 50;
    background: #F59E0B;
    color: #5c3d00;
    font-weight: 900;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 99px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(255,159,67,0.5);
    animation: petiPopup 1.6s ease-out forwards;
    transform: translateX(-50%);
}
@keyframes petiPopup {
    0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.6); }
    20%  { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.1); }
    80%  { opacity: 1; transform: translateX(-50%) translateY(-40px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-55px) scale(0.9); }
}


/* Theme Selector Cards for Map Generator */
.theme-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    user-select: none;
}
.theme-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.theme-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}
.theme-card .theme-title {
    font-weight: 800;
    font-size: 0.85rem;
    margin-top: 4px;
}
.theme-card .theme-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 2px;
}

/* ============================================================
   MODAL / POPUP (Tantangan)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

body.modal-open {
    overflow: hidden !important;
    touch-action: none;
}
body.modal-open .modal-overlay {
    touch-action: auto;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: scale(0.8) translateY(40px);
    transition: var(--transition);
    box-sizing: border-box;
    overflow: hidden;
}

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

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    display: block;
    animation: bounce 1s ease-in-out;
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-main);
    border: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}
.modal-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-scroll-body,
#nodeModalContent {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 4px;
    padding-bottom: 8px;
}

/* Quiz Options */
.quiz-options {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    background: #fff;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    top: 0;
    transition:
        transform 0.1s cubic-bezier(0.25,1,0.5,1),
        box-shadow 0.1s ease,
        border-color 0.15s ease,
        background 0.15s ease;
    box-shadow:
        0 5px 0 rgba(0,0,0,0.08),
        0 8px 16px rgba(0,0,0,0.05),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

.quiz-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateX(4px) translateY(-2px);
    box-shadow:
        0 7px 0 rgba(0,143,132,0.25),
        0 12px 20px rgba(0,180,166,0.12),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

.quiz-option:active {
    transform: translateX(2px) translateY(3px);
    box-shadow:
        0 2px 0 rgba(0,0,0,0.08),
        0 3px 6px rgba(0,0,0,0.05),
        inset 0 1px 0 rgba(255,255,255,0.7);
}

.quiz-option.correct {
    border-color: var(--green);
    background: #E8F8E9;
    color: var(--green-dark);
    transform: translateX(4px) translateY(-1px);
    box-shadow:
        0 5px 0 rgba(16,172,132,0.3),
        0 8px 16px rgba(16,172,132,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
    animation: correct-bounce 0.5s ease;
}

.quiz-option.wrong {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow:
        0 3px 0 rgba(232,65,65,0.25),
        0 5px 10px rgba(232,65,65,0.1);
    animation: shake 0.5s ease;
}

.quiz-option .option-letter {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-main);
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 0.95rem;
    flex-shrink: 0;
    border: 2px solid var(--border);
    box-shadow: 0 2px 0 rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: transform 0.1s ease, background 0.15s ease;
}

.quiz-option:hover .option-letter {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
    box-shadow: 0 3px 0 rgba(232,65,65,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}

.quiz-option .option-text {
    flex: 1;
    word-break: break-word;
    line-height: 1.4;
}


/* ============================================================
   CONFETTI / CELEBRATION
   ============================================================ */
.star-burst {
    position: fixed;
    pointer-events: none;
    font-size: 2rem;
    z-index: 9999;
    animation: star-fly 1.5s ease-out forwards;
}

@keyframes star-fly {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(0); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -80px))) scale(0.5); }
}

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

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

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

@keyframes correct-bounce {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

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

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    opacity: 0.6;
    animation: bounce 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .icon {
    font-size: 1.5rem;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-main);
    border: 2px solid var(--border);
    transition: var(--transition);
    margin-bottom: 10px;
}

.leaderboard-item:hover {
    border-color: var(--accent);
    background: #FFFBE6;
}

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.rank-badge.rank-1,  .rank-1 { background: #FFD700; color: #fff; font-size: 1.3rem; box-shadow: 0 4px 12px rgba(255,215,0,0.4); }
.rank-badge.rank-2,  .rank-2 { background: #C0C0C0; color: #fff; font-size: 1.3rem; box-shadow: 0 4px 12px rgba(192,192,192,0.4); }
.rank-badge.rank-3,  .rank-3 { background: #CD7F32; color: #fff; font-size: 1.3rem; box-shadow: 0 4px 12px rgba(205,127,50,0.4); }
.rank-badge.rank-other, .rank-other { background: var(--bg-main); color: var(--text-secondary); border: 2px solid var(--border); font-size: 0.85rem; }

/* ============================================================
   RESPONSIVE — LARGE TABLET (max 1280px)
   ============================================================ */
@media (max-width: 1280px) {
    .sidebar { width: 260px; }
    .main-content { margin-left: 260px; padding: 28px; }
    .nav-item { font-size: 0.88rem; padding: 11px 14px; }
    .sidebar-logo-text { font-size: 1.4rem; }
}

/* ============================================================
   RESPONSIVE — TABLET (max 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { width: 240px; padding: 20px 16px; }
    .main-content { margin-left: 240px; padding: 20px; }

    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }

    .topbar { padding: 12px 18px; }
    .topbar-title { font-size: 1.2rem; }

    .nav-item { font-size: 0.85rem; padding: 10px 12px; gap: 10px; }
    .sidebar-logo-text { font-size: 1.3rem; }
    .sidebar-user { padding: 12px; }
    .sidebar-user-avatar { width: 40px; height: 40px; font-size: 18px; }

    /* Welcome banner tablet */
    .welcome-banner { padding: 24px 28px !important; }
    .welcome-banner h2 { font-size: 1.5rem !important; }

    /* Table: enable horizontal scroll on tablet too */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Cards: slightly tighter */
    .card { padding: 22px 20px; }
    .card-stat { font-size: 2rem; }
}

/* ============================================================
   RESPONSIVE — MOBILE (max 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* --- Sidebar: Slide-in Overlay --- */
    .sidebar {
        transform: translateX(-100%);
        width: 300px;
        z-index: 999;
        box-shadow: 8px 0 32px rgba(0,0,0,0.25);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Dim overlay behind sidebar */
    .sidebar.open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: -1;
        backdrop-filter: blur(2px);
    }

    /* --- Main content: no left margin, bottom padding for mobile nav --- */
    .main-content {
        margin-left: 0;
        padding: 16px 16px 90px;
        min-height: 100vh;
    }

    /* --- Top Bar: compact --- */
    .topbar {
        padding: 12px 16px;
        margin-bottom: 20px;
        border-radius: var(--radius-md);
    }
    .topbar-title {
        font-size: 1.1rem;
    }

    /* --- Grids: single column for fixed grids --- */
    .grid-3, .grid-4 {
        grid-template-columns: 1fr 1fr;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* --- Cards: tighter padding --- */
    .card {
        padding: 20px 18px;
    }
    .card:hover {
        transform: none;
    }

    /* --- Auth Card --- */
    .auth-card {
        padding: 32px 24px;
        margin: 0;
        border-radius: var(--radius-md);
    }

    /* --- Modal: full-width sheet from bottom --- */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
        overscroll-behavior: contain;
    }
    .modal {
        border-radius: 24px 24px 0 0;
        max-width: 100% !important;
        width: 100%;
        margin: 0;
        padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 16px));
        max-height: 85vh;
        max-height: 85dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }
    .modal-overlay.active .modal {
        transform: translateY(0);
    }
    .modal-header {
        margin-bottom: 12px;
        padding-right: 36px;
        flex-shrink: 0;
    }
    .modal-icon {
        font-size: 2.2rem;
        margin-bottom: 4px;
    }
    #nodeModalTitle {
        font-size: 1.15rem !important;
    }
    #nodeModalSub {
        font-size: 0.82rem !important;
        margin-top: 2px !important;
    }
    .modal-scroll-body,
    #nodeModalContent,
    #siswaModalContent {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-right: 4px;
        padding-bottom: 28px;
    }

    /* --- Class cards: compact --- */
    .class-card-cover { height: 110px; font-size: 3rem !important; }

    /* --- Material cards: stack --- */
    .material-card {
        flex-direction: row;
        gap: 12px;
        padding: 14px 16px;
    }
    .material-type-icon {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }

    /* --- Game Map: smaller nodes --- */
    .node-pin {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    .node-label { font-size: 0.62rem; }

    /* --- Mobile Avatar --- */
    .avatar-3d-badge {
        width: 42px;
        height: 42px;
        border-width: 2.5px;
    }
    .avatar-emoji-figure {
        font-size: 1.6rem;
    }
    .avatar-character-wrapper {
        width: 46px;
        height: 46px;
    }
    .avatar-shadow-pod {
        width: 28px;
        height: 8px;
    }

    /* --- Buttons: larger touch targets --- */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; padding: 8px 14px; }

    /* --- Quiz options: full width --- */
    .quiz-options {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 14px;
    }
    .quiz-option {
        padding: 12px 14px;
        font-size: 0.95rem;
        gap: 12px;
    }
    .quiz-option .option-letter {
        width: 32px;
        height: 32px;
        font-size: 0.88rem;
    }

    /* --- Section header: stack --- */
    .section-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* --- Leaderboard podium: compact --- */
    .podium-block {
        width: 75px !important;
    }
    .podium-avatar {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.2rem !important;
    }
    .podium-name { font-size: 0.78rem !important; max-width: 85px !important; }

    /* --- Reports chart: shorter bars --- */
    .chart-bars { height: 120px !important; }

    /* --- Table responsive: horizontal scroll --- */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
    table { font-size: 0.8rem; }
    th, td { padding: 10px 12px !important; }

    /* --- Teacher: manage class actions stack --- */
    .material-card .btn { padding: 6px 10px !important; font-size: 0.75rem !important; }

    /* --- Topbar: hide greeting on very small screens --- */
    .topbar-greeting { display: none; }

    /* --- Join class input: bigger --- */
    #kode_kelas { font-size: 1.8rem !important; letter-spacing: 8px !important; }

    /* --- Grid 3 single column on mobile --- */
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE — SMALL PHONE (max 480px)
   ============================================================ */
@media (max-width: 480px) {

    .card-stat { font-size: 2rem !important; }
    .card-label { font-size: 0.8rem !important; }
    .card-icon { font-size: 2rem !important; width: 48px !important; height: 48px !important; }

    /* Stats grid: stack to 1 column on small phones */
    .grid-3 { grid-template-columns: 1fr !important; gap: 10px !important; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .grid-2 { grid-template-columns: 1fr; }

    /* Class grid: 2-column compact layout */
    .grid-auto { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .class-card-cover { height: 80px; font-size: 2rem !important; }
    .class-card-body { padding: 10px 12px; }
    .class-card-title { font-size: 0.9rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .class-card-meta { gap: 4px; font-size: 0.68rem; flex-wrap: wrap; }
    .class-card-body .btn-outline { font-size: 0.65rem; padding: 4px 6px; }

    .main-content { padding: 12px 12px 90px; }
    .card { padding: 16px 14px; }

    .btn-xl { padding: 14px 28px; font-size: 1.1rem; }
    .btn-lg { padding: 14px 24px; font-size: 1rem; }

    .auth-card { padding: 28px 18px; }
    .auth-logo h1 { font-size: 1.7rem; }

    /* Podium wrap */
    .podium-wrap { gap: 8px !important; }
    .podium-block { width: 64px !important; }

    /* Topbar tighter */
    .topbar { padding: 10px 14px; }
    .topbar-title { font-size: 1rem; }

    /* Banner text */
    .hero-title { font-size: 2.5rem !important; }
    .welcome-banner { padding: 20px 18px !important; }
    .welcome-banner h2 { font-size: 1.4rem !important; }
    .welcome-banner p { font-size: 0.9rem !important; }
}

/* ============================================================
   RESPONSIVE — VERY SMALL PHONE (max 360px)
   ============================================================ */
@media (max-width: 360px) {
    .main-content { padding: 10px 10px 88px; }
    .topbar { padding: 8px 12px; }
    .topbar-title { font-size: 0.95rem; }
    .grid-auto { grid-template-columns: 1fr; }
    .class-card-cover { height: 80px; }
    .btn { font-size: 0.9rem; }
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION BAR
   Only shows on mobile, replaces the sidebar for quick navigation
   ============================================================ */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: #fff;
        border-top: 2px solid var(--border);
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 4px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 800;
        transition: var(--transition);
        border: none;
        background: none;
        cursor: pointer;
        min-height: 56px;
        justify-content: center;
    }
    .mobile-nav-item.active {
        color: var(--primary);
    }
    .mobile-nav-item .nav-emoji {
        font-size: 1.5rem;
        transition: transform 0.2s ease;
    }
    .mobile-nav-item.active .nav-emoji {
        transform: scale(1.2);
    }
    /* Hamburger button in topbar — shown via CSS on mobile, not JS */
    #menuToggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-sm);
        background: var(--primary-light);
        border: none;
        font-size: 1.3rem;
        cursor: pointer;
        transition: var(--transition);
        flex-shrink: 0;
    }
    #menuToggle:hover { background: var(--primary); color: #fff; }
}

/* Desktop: always hide hamburger */
@media (min-width: 769px) {
    #menuToggle { display: none !important; }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm  { margin-top: 8px; }
.mt-md  { margin-top: 16px; }
.mt-lg  { margin-top: 24px; }
.mt-xl  { margin-top: 40px; }
.mb-sm  { margin-bottom: 8px; }
.mb-md  { margin-bottom: 16px; }
.mb-lg  { margin-bottom: 24px; }
.mb-xl  { margin-bottom: 40px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-danger { color: var(--red); }
.text-success { color: var(--green-dark); }
.fw-900 { font-weight: 900; }
.fw-800 { font-weight: 800; }

/* ============================================================
   WELCOME BANNER (responsive utility class)
   ============================================================ */
.welcome-banner {
    background: var(--primary);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.welcome-banner .banner-deco {
    position: absolute;
    right: -20px;
    top: -20px;
    font-size: 8rem;
    opacity: 0.12;
    pointer-events: none;
    user-select: none;
}
.welcome-banner h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 8px;
    color: #fff;
}
.welcome-banner p {
    opacity: 0.9;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0;
}
.banner-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Table responsive wrapper — use this on every table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
