/* =========================================
   1. RESET & BASIC SETUP
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---- THEME VARIABLES ---- */
:root {
    --bg-body: #f4f6f9;
    --text-main: #333;
    --text-heading: #1b1b1b;
    --text-muted: #666;
    --text-dark: #1f1f1f;
    --bg-card: #ffffff;
    --bg-section: #ffffff;
    --bg-item: #f9f9f9;
    --bg-item-hover: #ffe7e7;
    --border-color: #eee;
    --border-light: #e2e8f0;
    --shadow-card: rgba(0, 0, 0, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --bg-panel: #ffffff;
    --bg-input: #ffffff;
    --border-input: #ccc;
    --bg-desc: #fdf5e6;
    --border-desc: #f0ad4e;
    --text-desc: #666;
    --bg-tabs: #f0f4ff;
    --bg-tab-active: #ffffff;
    --bg-stat: #f9f9f9;
    --bg-level: linear-gradient(135deg, #f0f4ff, #e8f0fe);
    --border-level: #c7d7ff;
    --bg-xp-track: #d1dcff;
    --bg-quiz-box: #fcfdfe;
    --border-quiz-box: #cbd5e1;
    --bg-quiz-btn: #ffffff;
    --bg-quiz-btn-hover: #f8fafc;
    --bg-progress-track: #eef0f3;
    --bg-percent-badge: #e3f2fd;
    --border-percent-badge: #bbdefb;
    --bg-navbar: linear-gradient(135deg, #1f1f1f 0%, #1f1f1f 100%);
    --bg-footer: #1f1f1f;
    --bg-dropdown: #1e1e1e;
    --accent-blue: #1e3c72;
    --accent-red: #ff5e5e;
    --card-text-sub: #555;
    --kanji-text: #222;
    --kanji-meaning: #777;
    --item-span: #666;
    --val-color: #111;
    --stat-item-color: #444;
    --overlay-bg: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] {
    --bg-body: #1a1a2e;
    --text-main: #f0f0f0;
    --text-heading: #ffffff;
    --text-muted: #cccccc;
    --text-dark: #e8e8e8;
    --bg-card: #2a2a3e;
    --bg-section: #1e1e32;
    --bg-item: #2a2a3e;
    --bg-item-hover: #3a3a50;
    --border-color: #4a4a60;
    --border-light: #4a4a60;
    --shadow-card: rgba(0, 0, 0, 0.4);
    --shadow-light: rgba(0, 0, 0, 0.3);
    --bg-panel: #2a2a3e;
    --bg-input: #1e1e32;
    --border-input: #555;
    --bg-desc: #2a2a3e;
    --border-desc: #887744;
    --text-desc: #ccc;
    --bg-tabs: #1e1e32;
    --bg-tab-active: #3a3a50;
    --bg-stat: #1e1e32;
    --bg-level: linear-gradient(135deg, #1e2a4a, #1a2540);
    --border-level: #2a3a5a;
    --bg-xp-track: #2a3a5a;
    --bg-quiz-box: #1e1e32;
    --border-quiz-box: #4a4a60;
    --bg-quiz-btn: #2a2a3e;
    --bg-quiz-btn-hover: #3a3a50;
    --bg-progress-track: #2a2a3e;
    --bg-percent-badge: #1a2a4a;
    --border-percent-badge: #2a3a5a;
    --bg-navbar: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    --bg-footer: #0f0f1a;
    --bg-dropdown: #1a1a2e;
    --accent-blue: #8ab4f8;
    --accent-red: #ff8a8a;
    --card-text-sub: #ccc;
    --kanji-text: #ffffff;
    --kanji-meaning: #cccccc;
    --item-span: #cccccc;
    --val-color: #ffffff;
    --stat-item-color: #ccc;
    --overlay-bg: rgba(0, 0, 0, 0.75);
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* =========================================
   2. NAVBAR UTAMA (UNIVERSAL)
   ========================================= */
header {
    background: var(--bg-navbar);
    color: white;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.3s;
}

nav {
    max-width: 1900px;
    margin: 0 auto;
    padding: 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 29px;
    font-weight: bold;
    cursor: pointer;
}

.logo {
    cursor: pointer;
    /* Membuat kursor berubah jadi gambar tangan saat menunjuk logo */
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

nav ul li {
    display: flex;
    align-items: center;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.2s ease;
    padding: 5px 10px;
    border-radius: 5px;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

nav a.active {
    border-bottom: 3px solid #ff5e5e;
    font-weight: bold;
    border-radius: 0;
    background: transparent;
}

/* ---- THEME TOGGLE BUTTON ---- */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
}

/* =========================================
   3. HERO SECTION (HOME)
   ========================================= */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("pic/yuru.jpg");
    background-size: cover;
    background-position: center;
    color: white;
    padding: 6rem 2rem;
    text-align: left;
}

.hero-content {
    max-width: 800px;
    margin: 0 1.9rem auto;
    z-index: 2;
    text-align: left;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

/* =========================================
   4. COURSES & FEATURES
   ========================================= */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-heading);
}

/* Pastikan margin bawah 0 agar menyambung ke developer */
.courses {
    background-color: var(--bg-section);
    padding: 4rem 2rem 2rem 2rem;
    /* Padding bawah dikurangi sedikit agar transisi mulus */
    margin-bottom: 0;
    transition: background-color 0.3s;
}

.course-grid,
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.course-card,
.feature-card {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-card);
    transition: transform 0.3s, background 0.3s;
    text-align: center;
    padding-bottom: 1.5rem;
}

.course-card:hover,
.feature-card:hover {
    transform: translateY(-5px);
}

.course-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e75252 0%, #e75252 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
}

.course-content,
.feature-card {
    padding: 1.5rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Pastikan ini ada di file CSS Anda */
.features {
    background-color: var(--bg-section);
    /* Ganti warna ini sesuai keinginan Anda */
    padding: 60px 0;
    /* Memberikan jarak agar tidak terlalu rapat */
    transition: background-color 0.3s;
}

/* =========================================
   5. BANNERS (HIRAGANA, KATAKANA, KANJI)
   ========================================= */
.hero-banner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center;
    min-height: 250px;
    color: white;
    padding: 20px;
    margin-bottom: 2rem;
}

.banner-hiragana {
    background-image: url('pic/bottom1.png');
    background-position: center 79%;
}

.banner-katakana {
    background-image: url('pic/bottom1.png');
    background-position: center 79%;
}

.banner-kanji {
    background-image: url('pic/bottom1.png');
    background-position: center 79%;
}

/* Reusing image */

.hero-banner h1 {
    font-size: 70px;
    text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.hero-banner h2 {
    font-size: 40px;
    text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.hero-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    z-index: 1;
}

/* =========================================
   6. GRID HURUF & MATERI
   ========================================= */
.content {
    width: 95%;
    max-width: 1200px;
    margin: auto;
    padding: 20px 0 50px;
}

.card {
    background: var(--bg-card);
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 20px;
    box-shadow: 0 5px 15px var(--shadow-light);
    transition: background 0.3s;
}

.card h2 {
    margin-bottom: 15px;
    color: var(--accent-blue);
}

.card p {
    line-height: 1.8;
    color: var(--card-text-sub);
}

.card ul {
    padding-left: 20px;
    line-height: 2;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.item {
    background: var(--bg-item);
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    font-size: 42px;
    font-weight: bold;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    border: 1px solid var(--border-color);
}

.item:hover {
    transform: translateY(-5px);
    background: var(--bg-item-hover);
    box-shadow: 0 10px 20px var(--shadow-light);
}

.item span {
    display: block;
    margin-top: 8px;
    font-size: 16px;
    color: var(--item-span);
    font-weight: normal;
}

/* Khusus Kanji */
.theme-label {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kanji-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.item .kanji {
    font-size: 46px;
    margin-bottom: 8px;
    color: var(--kanji-text);
}

.item .meaning {
    font-size: 13px;
    color: var(--kanji-meaning);
    margin-bottom: 5px;
}

.item .reading {
    font-size: 14px;
    font-weight: 500;
}

/* =========================================
   7. BUTTONS
   ========================================= */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: #ff5e5e;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold;
    margin-top: 15px;
    /* TAMBAHKAN BARIS INI UNTUK MEMBERI JARAK */
}

.btn:hover {
    background: #e04848;
    transform: translateY(-2px);
}

.back {
    text-align: center;
    margin-top: 30px;
}

/* =========================================
   SECTION DEVELOPER STYLE
   ========================================= */
.developer-section {
    padding: 2rem 20px 60px 20px;
    /* Padding atas dikurangi agar jaraknya pas dengan courses */
    background-color: var(--bg-section);
    /* DISAMAKAN DENGAN BACKGROUND COURSES */
    text-align: center;
    margin-top: 0;
    /* Menghilangkan jarak pembatas */
    transition: background-color 0.3s;
}

.developer-section h2 {
    font-size: 2.5rem;
    /* Disamakan ukurannya dengan .section-title di atasnya */
    margin-bottom: 3rem;
    color: var(--text-heading);
    position: relative;
}

/* Container utama menggunakan Flexbox agar menyamping */
.developer-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

/* Style untuk masing-masing kartu/blok */
.developer-card {
    background: var(--bg-card);
    /* Kartunya dibuat putih agar menonjol di atas latar #f0f0f0 */
    border-radius: 15px;
    padding: 30px 20px;
    width: 280px;
    box-shadow: 0 4px 6px var(--shadow-card);
    /* Disamakan dengan shadow course-card */
    transition: transform 0.3s ease, background 0.3s;
}

.developer-card:hover {
    transform: translateY(-5px);
}

/* =========================================
   BINGKAI & STYLING FOTO DEVELOPER
   ========================================= */

/* Bingkai Bulat Premium dengan Efek Cincin Putih */
.avatar-placeholder {
    width: 140px;
    /* Ukuran diperbesar sedikit agar pas */
    height: 140px;
    margin: 0 auto 20px auto;
    border-radius: 50%;
    /* Membuat bentuk lingkaran sempurna */
    background: var(--bg-card);
    /* Warna latar belakang dalam bingkai */

    /* Bingkai Utama: Tebal 4px dengan warna merah coral khas NihongoQu */
    border: 4px solid #ff5e5e;

    /* Efek jarak (padding) antara bingkai merah dan foto agar ada lingkaran putih di dalamnya */
    padding: 5px;

    /* Bayangan halus di bawah bingkai foto agar terlihat hidup/3D */
    box-shadow: 0 4px 12px rgba(255, 94, 94, 0.2);

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Penyesuaian Foto di Dalam Bingkai */
.avatar-placeholder img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Mengikuti bentuk lingkaran dalam */
    object-fit: cover;
    /* Memastikan foto otomatis terpotong rapi & tidak gepeng */
    display: block;
}

/* Efek Interaktif: Bingkai berubah warna & membesar sedikit saat kartu di-hover */
.developer-card:hover .avatar-placeholder {
    transform: scale(1.05);
    /* Bingkai foto membesar 5% */
    border-color: #1f1f1f;
    /* Warna bingkai berubah jadi hitam elegan */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    /* Bayangan mengikuti perubahan warna */
}

/* =========================================
   8. MENU DROPDOWN PROFILE
   ========================================= */
.profile-menu {
    position: relative;
}

.profile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    padding: 8px;
    border-radius: 5px;
    transition: 0.3s;
    background: rgba(255, 255, 255, 0.1);
}

.profile-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.profile-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.profile-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background: var(--bg-dropdown);
    padding: 15px;
    border-radius: 10px;
    width: 180px;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.profile-dropdown p {
    color: #aaa;
    margin-bottom: 10px;
    font-size: 13px;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}

.profile-dropdown a {
    display: block;
    color: white;
    text-decoration: none;
    margin: 10px 0;
    font-size: 15px;
    padding: 0;
}

.profile-dropdown a:hover {
    color: #ff6b6b;
    background: transparent;
}

.profile-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   9. OVERLAY & POPUP LOGIN/PROFILE
   ========================================= */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: 0.3s;
    z-index: 2000;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.auth-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: var(--bg-panel);
    /* Padding is moved to inner containers to prevent scrollbar layout issues */
    padding: 0;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    transition: right 0.4s ease, background 0.3s;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 0; /* Gap moved to inner containers */
    overflow-y: auto;
    overflow-x: hidden;
}

#authView {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-panel.show {
    right: 0;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.8); /* Translucent so it's visible over dark banner */
    border: none;
    color: #333;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    z-index: 100;
}

.close-btn:hover {
    background: #ff5e5e;
    color: white;
}

#authView {
    padding-top: 30px;
}

.auth-panel h2 {
    color: var(--accent-blue);
    font-size: 24px;
    margin-top: 10px;
}

.desc {
    background: var(--bg-desc);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-desc);
    border-left: 4px solid var(--border-desc);
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-input);
    border-radius: 6px;
    font-size: 15px;
    background: var(--bg-input);
    color: var(--text-main);
}

.register-btn {
    width: 100%;
    background: #1e3c72;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold;
}

.register-btn:hover {
    background: #16305f;
}

.register-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
}

/* ---- AUTH TABS ---- */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin: 15px 0;
    background: var(--bg-tabs);
    border-radius: 10px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.25s;
}

.auth-tab.active {
    background: var(--bg-tab-active);
    color: var(--accent-blue);
    box-shadow: 0 2px 8px var(--shadow-card);
}

/* ---- PROFILE VIEW (DISCORD STYLE) ---- */
#profileView {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.profile-header-container {
    position: relative;
    width: 100%;
    overflow: visible;
    background: var(--bg-panel);
}

.profile-banner-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #1e1f22, #2a2a3e);
    cursor: pointer;
    transition: opacity 0.2s;
    display: block;
    overflow: hidden;
}

.profile-banner-wrap:hover {
    opacity: 0.8;
}

#profileBanner, .profile-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-wrap {
    position: absolute;
    bottom: -38px;   /* Avatar menonjol ke bawah banner */
    left: 30px;      /* 30px = kompensasi -30px margin dari #profileView */
    width: 80px;
    height: 80px;
    z-index: 10;
}

.profile-avatar {
    font-size: 36px;
    background: var(--bg-item-hover);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--bg-panel);
    box-sizing: content-box;
    margin-left: -4px;
    margin-top: -4px;
}

#profileAvatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-panel);
    box-sizing: content-box;
    display: block;
    margin-left: -4px;
    margin-top: -4px;
}

.avatar-upload-btn {
    position: absolute;
    top: 0;
    right: -5px;
    background: var(--accent-blue);
    color: var(--bg-panel); /* Icon color matches panel */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    border: 2px solid var(--bg-panel);
    transition: background 0.2s;
    z-index: 10;
}

.avatar-upload-btn:hover {
    background: var(--accent-red);
}

.profile-body {
    padding: 0 30px 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing antar elemen (level box, form bio, dll) */
}

.profile-info-section {
    padding-top: 48px; /* Ruang untuk avatar 80px yang menonjol 38px ke bawah banner */
    margin-bottom: 4px;
}

.profile-title-badge {
    font-size: 14px; 
    background: linear-gradient(135deg, #f6c90e, #ff6b00); 
    color: white; 
    padding: 4px 10px; 
    border-radius: 6px; 
    font-weight: bold; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.profile-username-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 5px;
}

.profile-username-row h3 {
    color: var(--accent-blue);
    font-size: 20px;
    margin: 0;
}

.profile-bio-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    margin-bottom: 15px;
}

.bio-text {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
    max-width: 260px;
    text-align: left;
}

.edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.edit-btn:hover {
    opacity: 1;
}

.edit-btn.small {
    font-size: 12px;
}

/* ---- XP / LEVEL BOX ---- */
.level-box {
    background: var(--bg-level);
    border: 1px solid var(--border-level);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 12px 0;
    text-align: left;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.level-label {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 16px;
}

.xp-text {
    font-size: 13px;
    color: var(--card-text-sub);
    font-weight: 600;
}

.xp-bar-track {
    height: 10px;
    background: var(--bg-xp-track);
    border-radius: 20px;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e3c72, #4a90e2);
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- XP TOAST NOTIFICATION ---- */
.xp-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #1e3c72, #4a90e2);
    color: white;
    padding: 14px 22px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    line-height: 1.4;
}

.xp-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.stat-box {
    background: var(--bg-stat);
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    margin-bottom: 20px;
}

.stat-box strong {
    display: block;
    color: var(--accent-blue);
    margin-bottom: 5px;
}



/* =========================================
   10A. Quiz pages
   ========================================= */
.quiz-access-card {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
    margin: 40px auto 20px auto;
    max-width: 700px;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow-light);
}

.quiz-access-card h3 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.quiz-access-card p {
    color: var(--text-muted);
    font-size: 15px;
    max-width: 550px;
    margin: 0 auto 20px auto;
}

.quiz-badge {
    display: inline-block;
    background: #ff5e5e;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.btn-start-quiz {
    display: inline-block;
    padding: 14px 35px;
    background: #28a745;
    /* Warna hijau indikasi siap mulai */
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.btn-start-quiz:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3);
}

/* =========================================
   10B, HiraganaQuiz pages
   ========================================= */

.quiz-main-container {
    max-width: 800px;
    margin: 40px auto;
    background: var(--bg-card);
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-light);
    border-top: 5px solid var(--accent-red);
}

.quiz-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-item {
    font-size: 16px;
    font-weight: 600;
    color: var(--stat-item-color);
}

.val {
    font-weight: 800;
    color: var(--val-color);
    margin-left: 5px;
}

.percent-badge {
    background: var(--bg-percent-badge);
    color: var(--accent-blue);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-percent-badge);
}

.quiz-progress-track {
    width: 100%;
    height: 12px;
    background: var(--bg-progress-track);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff5e5e, #28a745);
    width: 0%;
    border-radius: 20px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-box-card {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-quiz-box);
    border: 2px dashed var(--border-quiz-box);
    border-radius: 12px;
    margin-bottom: 30px;
}

.quiz-char-display {
    font-size: 95px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 550px;
    margin: 0 auto;
}

.quiz-opt-btn {
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    background: var(--bg-quiz-btn);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.quiz-opt-btn:hover:not([disabled]) {
    background: var(--bg-quiz-btn-hover);
    border-color: var(--accent-red);
    transform: translateY(-2px);
}

.quiz-opt-btn.state-correct {
    background: #d4edda !important;
    border-color: #28a745 !important;
    color: #155724 !important;
}

.quiz-opt-btn.state-wrong {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24 !important;
}

.quiz-footer-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn-quiz-back {
    padding: 12px 24px;
    background: #1f1f1f;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-quiz-back:hover {
    background: #444;
}

.btn-restart {
    padding: 12px 24px;
    background: #ff5e5e;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

/* =========================================
   11. MENU SELEKTOR JUMLAH SOAL (SETUP SCREEN)
   ========================================= */
.quiz-setup-container {
    text-align: center;
    padding: 25px 15px;
    animation: fadeIn 0.4s ease;
}

.quiz-setup-container h3 {
    font-size: 26px;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-weight: 700;
}

.quiz-setup-container p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 35px;
}

/* Container penampung tombol agar responsif */
.quiz-size-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 380px;
    margin: 0 auto;
}

/* Desain tombol opsi jumlah kuis */
.btn-size-opt {
    padding: 16px 24px;
    font-size: 17px;
    font-weight: 700;
    background: var(--bg-quiz-btn);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Efek Hover tombol opsi */
.btn-size-opt:hover {
    background: var(--bg-item-hover);
    border-color: var(--accent-red);
    color: var(--accent-red);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(255, 94, 94, 0.12);
}

/* Efek aktif klik */
.btn-size-opt:active {
    transform: translateY(-1px);
}

/* Animasi halus saat transisi menu */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout horizontal saat di layar komputer / tablet */
@media (min-width: 650px) {
    .quiz-size-options {
        flex-direction: row;
        max-width: 100%;
        justify-content: center;
    }

    .btn-size-opt {
        flex: 1;
        max-width: 200px;
    }
}

.btn-restart:hover {
    background: #e04848;
}

/* =========================================
   10. FOOTER
   ========================================= */
footer {
    background-color: var(--bg-footer);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 50px;
    transition: background-color 0.3s;
}

/* =========================================
   12. RESPONSIVE DESIGN - MOBILE FIRST
   =========================================
   Breakpoints:
   - Mobile:  max-width 480px  (HP kecil)
   - Tablet:  max-width 768px  (HP besar / tablet kecil)
   - Laptop:  max-width 1024px (laptop)
   ========================================= */

/* ---- TOUCH-FRIENDLY GLOBAL ---- */
@media (max-width: 768px) {

    button,
    a,
    .btn,
    .register-btn,
    .btn-size-opt,
    .quiz-opt-btn,
    .auth-tab,
    .close-btn {
        min-height: 44px;
    }

    .course-card:hover,
    .feature-card:hover {
        transform: none;
    }

    .item:hover {
        transform: none;
    }
}

/* ============================================
   MOBILE DRAWER (slide-in dari kanan)
   ============================================ */
#mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: #1a1a2e;
    z-index: 9999;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0,0,0,0.5);
    overflow-y: auto;
}
#mobile-nav-drawer.open { right: 0; }

#mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
    backdrop-filter: blur(2px);
}
#mobile-nav-overlay.open { display: block; }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.drawer-header span {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}
.drawer-close {
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    font-size: 22px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    min-height: unset;
    padding: 0;
}
.drawer-close:hover { background: rgba(255,255,255,0.18); }

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}
.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    min-height: unset;
}
.drawer-link:hover {
    background: rgba(255,255,255,0.07);
    color: white;
    border-left-color: #ff5e5e;
}
.drawer-link.active {
    background: rgba(255,94,94,0.12);
    color: #ff5e5e;
    border-left-color: #ff5e5e;
    font-weight: 700;
}

.drawer-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 0;
}

.drawer-profile {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.drawer-profile p {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    margin-bottom: 8px;
}
.drawer-profile strong {
    color: white;
    font-size: 16px;
    display: block;
    margin-bottom: 12px;
}
.drawer-profile a {
    display: block;
    padding: 11px 14px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 15px;
    border-radius: 10px;
    transition: all 0.2s;
    min-height: unset;
}
.drawer-profile a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

/* ============================================
   TABLET (max 1024px)
   ============================================ */
@media (max-width: 1024px) {
    nav {
        padding: 0 16px;
    }

    nav ul {
        gap: 15px;
    }

    nav a {
        font-size: 16px;
    }

    .hero h1 {
        font-size: 2.8rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .developer-section h2 {
        font-size: 2rem;
    }
}

/* ============================================
   MOBILE TABLET (max 768px)
   ============================================ */
@media (max-width: 768px) {

    /* -- NAVBAR -- */
    header { padding: 0; }
    nav {
        padding: 12px 20px;
        position: relative;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
    }
    .logo {
        font-size: 20px;
        flex: 1;
    }

    /* Sembunyikan menu ul di mobile — navigasi via drawer */
    nav ul {
        display: none !important;
    }

    /* Profile icon selalu visible di kanan navbar */
    nav ul li.profile-menu {
        display: none !important;
    }

    /* Profile-menu yang dipindahkan ke luar ul oleh JS tetap tampil */
    nav > li.profile-menu,
    nav > .profile-menu {
        display: list-item;
        list-style: none;
    }

    /* -- HERO -- */
    .hero {
        padding: 4rem 1.2rem;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-content {
        margin: 0;
    }

    /* -- SECTION TITLE -- */
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }

    /* -- COURSES & FEATURES -- */
    .courses {
        padding: 2.5rem 1rem 1.5rem;
    }

    .features {
        padding: 2.5rem 1rem;
    }

    .course-grid,
    .features-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .course-image {
        height: 140px;
        font-size: 3rem;
    }

    .course-content {
        padding: 1rem;
    }

    .course-card h3 {
        font-size: 1rem;
    }

    .course-card p {
        font-size: 13px;
    }

    /* -- DEVELOPER SECTION -- */
    .developer-section {
        padding: 2rem 1rem 2.5rem;
    }

    .developer-section h2 {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }

    .developer-container {
        gap: 16px;
    }

    .developer-card {
        width: 100%;
        max-width: 340px;
    }

    /* -- HERO BANNER -- */
    .hero-banner {
        min-height: 180px;
        padding: 16px;
        margin-bottom: 1.2rem;
    }

    .hero-banner h1 {
        font-size: 44px;
    }

    .hero-banner h2 {
        font-size: 26px;
    }

    /* -- CONTENT WRAPPER -- */
    .content {
        width: 100%;
        padding: 12px 12px 40px;
    }

    .card {
        padding: 18px;
        margin-bottom: 20px;
        border-radius: 14px;
    }

    /* -- GRID HURUF -- */
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }

    .item {
        font-size: 30px;
        padding: 14px 8px;
        min-height: 90px;
        border-radius: 12px;
    }

    .item span {
        font-size: 13px;
        margin-top: 6px;
    }

    .kanji-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .item .kanji {
        font-size: 34px;
    }

    .item .meaning {
        font-size: 12px;
    }

    .item .reading {
        font-size: 13px;
    }

    /* -- AUTH PANEL -- */
    .auth-panel {
        width: 100%;
        right: -100%;
        padding: 0;
    }
    
    #authView {
        padding: 20px 18px;
    }
    
    .profile-body {
        padding: 0 20px 20px 20px;
    }

    .auth-panel.show {
        right: 0;
    }

    /* -- XP TOAST -- */
    .xp-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        font-size: 14px;
        padding: 12px 16px;
        border-radius: 12px;
    }

    /* -- QUIZ & ACCESS -- */
    .quiz-access-card {
        margin: 20px 12px;
        padding: 20px 16px;
        border-radius: 12px;
    }

    .quiz-access-card h3 {
        font-size: 18px;
    }

    .quiz-access-card p {
        font-size: 14px;
    }

    .quiz-main-container {
        margin: 20px 10px;
        padding: 20px 14px;
        border-radius: 12px;
    }

    .quiz-char-display {
        font-size: 70px;
    }

    .quiz-options-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .quiz-opt-btn {
        padding: 12px 8px;
        font-size: 16px;
    }

    .quiz-score-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* -- QUIZ SETUP -- */
    .quiz-size-options {
        flex-direction: column;
        max-width: 100%;
        gap: 10px;
    }

    .btn-size-opt {
        max-width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }

    /* -- FOOTER -- */
    footer {
        padding: 1.5rem 1rem;
        margin-top: 30px;
        font-size: 14px;
    }

    /* -- BUTTONS -- */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .back {
        margin-top: 20px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .back .btn {
        margin-top: 0;
    }
}

/* ============================================
   MOBILE KECIL (max 480px)
   ============================================ */
@media (max-width: 480px) {
    .logo {
        font-size: 17px;
    }

    .hero {
        padding: 3rem 1rem;
    }

    .hero h1 {
        font-size: 1.7rem;
    }

    .hero p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .course-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .hero-banner h1 {
        font-size: 34px;
    }

    .hero-banner h2 {
        font-size: 20px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 8px;
    }

    .item {
        font-size: 26px;
        padding: 10px 6px;
        min-height: 80px;
        border-radius: 10px;
    }

    .item span {
        font-size: 11px;
    }

    .kanji-grid {
        grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    }

    .quiz-char-display {
        font-size: 60px;
    }

    .quiz-options-grid {
        gap: 8px;
    }

    .quiz-opt-btn {
        font-size: 14px;
        padding: 10px 6px;
    }

    .quiz-main-container {
        margin: 12px 8px;
        padding: 16px 10px;
    }

    .auth-panel {
        padding: 0;
    }
    
    #authView {
        padding: 16px 14px;
    }
    
    .profile-body {
        padding: 0 16px 16px 16px;
    }

    .auth-panel h2 {
        font-size: 20px;
    }

    .register-btn {
        padding: 12px;
        font-size: 15px;
    }

    .auth-form input {
        padding: 10px;
        font-size: 14px;
    }

    .level-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .level-label {
        font-size: 14px;
    }

    .xp-text {
        font-size: 12px;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .developer-section h2 {
        font-size: 1.4rem;
    }

    .back {
        flex-direction: column;
        align-items: center;
    }

    .back .btn {
        width: 100%;
        max-width: 280px;
        text-align: center;
        margin-left: 0 !important;
    }
}