* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'DM Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fb;
    color: #333;
    overflow-x: hidden;
    max-width: 100%;
    min-height: 100vh;
}

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: #1e293b;
    color: #ffffff !important;
    padding: 10px 18px;
    border-radius: 8px;
    z-index: 99999;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: top 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}
.skip-link:focus {
    top: 16px;
}

/* Focus Visible for Keyboard Accessibility (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 50px;
}

/* SCREEN 1: HOME */
.header {
    margin-top: clamp(30px, 6vw, 60px);
    margin-bottom: clamp(20px, 4vw, 40px);
    text-align: center;
    padding: 0 20px;
    width: 100%;
    max-width: 1000px;
}

.welcome-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}

/* NAVBAR */
.app-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(14px, env(safe-area-inset-top)) max(clamp(16px, 3.5vw, 40px), env(safe-area-inset-right)) 14px max(clamp(16px, 3.5vw, 40px), env(safe-area-inset-left));
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

.app-navbar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    flex-shrink: 0;
}

.app-navbar .logo-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}
.theme-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
}
.theme-btn:active {
    transform: scale(0.95);
}

.app-navbar nav a, 
.app-navbar nav button {
    text-decoration: none;
    background-color: #f1f5f9;
    color: #475569;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    border: none;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    flex-shrink: 0;
}

.app-navbar nav a:hover,
.app-navbar nav button:hover {
    background-color: #e2e8f0;
}

.header h2 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    margin: 0;
    color: #2c3e50;
    line-height: 1.2;
}

.header p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #64748b;
    margin: 0;
}

/* PHASE SECTION */
.phase-section {
    width: min(92%, 1000px);
    margin-bottom: 24px;
    background: #ffffff;
    padding: clamp(18px, 3vw, 28px);
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}

.phase-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    border-bottom: 2px solid #eee;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
}

.phase-title::before {
    content: "🎓";
    margin-right: 10px;
    font-size: 1.2rem;
}

.phase-1 { color: #5f7a65; border-bottom-color: #A2B9A7; }
.phase-2 { color: #8e585f; border-bottom-color: #D4A3A8; }
.phase-3 { color: #50667a; border-bottom-color: #97A9B9; }

.phase-section .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 16px;
    width: 100%;
}

.menu-item {
    padding: clamp(16px, 2.5vw, 20px);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.15s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
    position: relative;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
    border-radius: 16px;
    pointer-events: none;
}

.card-icon {
    font-size: 2rem;
    background: rgba(255,255,255,0.35);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.card-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.card-info p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
    font-weight: 500;
    line-height: 1.3;
}

.menu-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.menu-item:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

/* WARNA CERAH, BERSIH & MODERN (Vibrant & Clean) */
.btn-cat-1 { background-color: #ffffff; border: 1px solid #f1f5f9; color: #1e293b; }
.btn-cat-1 .card-icon { background-color: #ecfdf5; color: #047857; }
.btn-cat-1:hover { border-color: #10b981; box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15); }

.btn-cat-2 { background-color: #ffffff; border: 1px solid #f1f5f9; color: #1e293b; }
.btn-cat-2 .card-icon { background-color: #fdf2f8; color: #be185d; }
.btn-cat-2:hover { border-color: #ec4899; box-shadow: 0 10px 25px rgba(236, 72, 153, 0.15); }

.btn-cat-3 { background-color: #ffffff; border: 1px solid #f1f5f9; color: #1e293b; }
.btn-cat-3 .card-icon { background-color: #f0f9ff; color: #0369a1; }
.btn-cat-3:hover { border-color: #0ea5e9; box-shadow: 0 10px 25px rgba(14, 165, 233, 0.15); }

/* SCREEN 2: DETAIL */
.detail-container {
    width: min(92%, 920px);
    margin: clamp(20px, 4vw, 40px) auto;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.back-btn {
    padding: 10px 18px;
    font-size: 0.95rem;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 44px;
}

.back-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

#title-text {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.85rem);
    color: #1e293b;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

/* SUB MENU BAR */
.sub-menu-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 14px 2px;
    scrollbar-width: thin;
}

.sub-menu-bar::-webkit-scrollbar {
    height: 6px;
}

.sub-menu-bar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.sub-menu-btn {
    padding: 9px 18px;
    border-radius: 25px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.95rem;
    color: #475569;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s ease-in-out;
    flex-shrink: 0;
    min-height: 40px;
}

.sub-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.sub-menu-btn.active {
    background-color: #1e293b;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.text-content {
    background-color: #ffffff;
    padding: clamp(20px, 4vw, 36px);
    border-radius: 16px;
    line-height: 1.8;
    font-size: clamp(1rem, 2vw, 1.12rem);
    color: #334155;
    box-shadow: 0 4px 16px rgba(0,0,0,0.03);
    margin-bottom: 30px;
    transition: background-color 0.3s ease;
}

#text-body {
    white-space: pre-line;
    margin: 0;
}

.audio-wrapper, .ar-wrapper {
    background-color: #ffffff;
    padding: clamp(18px, 3.5vw, 30px);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.03);
    margin-bottom: 25px;
}

.audio-wrapper h3, .ar-wrapper h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: #1e293b;
}

.media-desc {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.5;
}

audio {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
}

model-viewer {
    width: 100%;
    height: clamp(260px, 45vh, 420px);
    background-color: #f1f5f9;
    border-radius: 12px;
    margin-top: 12px;
    position: relative;
}

#ar-button {
    background-image: url(https://modelviewer.dev/shared-assets/icons/ic_view_in_ar_new_googblue_48dp.png);
    background-repeat: no-repeat;
    background-size: 20px 20px;
    background-position: 12px center;
    background-color: white; 
    color: #1e293b;
    font-weight: 700;
    border-radius: 8px; 
    border: 1px solid #cbd5e1; 
    position: absolute; 
    top: 16px; 
    right: 16px; 
    padding: 10px 18px 10px 40px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

#ar-button:hover {
    background-color: #f8fafc;
}

/* --- MULTI-DEVICE RESPONSIVENESS & BREAKPOINTS --- */

/* Ultrawide & 2K/4K Monitors (>= 1400px): Clean centered container alignment */
@media (min-width: 1400px) {
    .app-navbar {
        padding-left: calc((100% - 1200px) / 2 + 24px);
        padding-right: calc((100% - 1200px) / 2 + 24px);
    }
}

/* Tablet & Mobile responsive adjustments */
@media (max-width: 640px) {
    .detail-header {
        flex-direction: row;
        align-items: center;
    }
    .phase-title {
        font-size: 1.15rem;
    }
    .sub-menu-btn {
        font-size: 0.88rem;
        padding: 8px 14px;
        min-height: 40px;
    }
}

@media (max-width: 520px) {
    .app-navbar {
        padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    }
    .app-navbar .logo {
        font-size: 1.15rem;
        gap: 8px;
    }
    .app-navbar .logo-img {
        width: 34px;
        height: 34px;
        border-radius: 6px;
    }
    .theme-btn {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
    }
    .app-navbar nav a,
    .app-navbar nav button {
        padding: 8px 12px;
        font-size: 0.82rem;
        min-height: 40px;
        border-radius: 6px;
    }
    .header h2 {
        font-size: 1.8rem;
    }
    .menu-item {
        padding: 14px;
    }
}

@media (max-width: 380px) {
    .app-navbar .logo span {
        font-size: 1.05rem;
    }
    .app-navbar nav a,
    .app-navbar nav button {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* Ultra-Compact Foldables & Small Screens (<= 330px, e.g. Galaxy Z Fold 280px) */
@media (max-width: 330px) {
    .app-navbar {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
    .app-navbar .logo {
        font-size: 0.92rem;
        gap: 6px;
    }
    .app-navbar .logo-img {
        width: 26px;
        height: 26px;
    }
    .theme-btn {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
    }
    .app-navbar nav a,
    .app-navbar nav button {
        padding: 6px 8px;
        font-size: 0.76rem;
        min-height: 36px;
    }
    .menu-item {
        padding: 12px;
        gap: 10px;
    }
    .card-icon {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }
    .card-info h4 {
        font-size: 1rem;
    }
    .card-info p {
        font-size: 0.8rem;
    }
    .sub-menu-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        min-height: 36px;
    }
}

/* Touch screen interaction polish */
@media (hover: none) and (pointer: coarse) {
    .menu-item:hover, .sub-menu-btn:hover {
        transform: none;
    }
}

/* === DARK MODE === */
body.dark-mode {
    background-color: #0f172a;
    color: #f8fafc;
}
body.dark-mode .app-navbar {
    background-color: rgba(15, 23, 42, 0.85);
    border-bottom-color: #1e293b;
}
body.dark-mode .app-navbar nav a, body.dark-mode .app-navbar nav button {
    background-color: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
}
body.dark-mode .app-navbar nav a:hover, body.dark-mode .app-navbar nav button:hover {
    background-color: #334155;
}
body.dark-mode .logo span, body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #f8fafc;
}
body.dark-mode .menu-item {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
body.dark-mode .phase-section {
    background-color: transparent;
    box-shadow: none;
}
body.dark-mode .btn-cat-1 .card-icon { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
body.dark-mode .btn-cat-2 .card-icon { background-color: rgba(236, 72, 153, 0.2); color: #f472b6; }
body.dark-mode .btn-cat-3 .card-icon { background-color: rgba(14, 165, 233, 0.2); color: #38bdf8; }
body.dark-mode .card-info p { color: #cbd5e1; }
body.dark-mode .audio-wrapper, body.dark-mode .ar-wrapper {
    background-color: #1e293b;
    border-color: #334155;
}
body.dark-mode .audio-wrapper h3, body.dark-mode .ar-wrapper h3 {
    color: #f8fafc;
}
body.dark-mode .media-desc {
    color: #cbd5e1;
}
body.dark-mode #text-body {
    background-color: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}
body.dark-mode .sub-menu-btn {
    background-color: #1e293b;
    color: #cbd5e1;
    border-color: #334155;
}
body.dark-mode .sub-menu-btn:hover, body.dark-mode .sub-menu-btn.active {
    background-color: #334155;
    color: #f8fafc;
}
body.dark-mode .welcome-badge {
    background-color: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.3);
}
body.dark-mode audio {
    filter: invert(90%) hue-rotate(180deg);
}
body.dark-mode .phase-1 { border-bottom-color: #10b981; }
body.dark-mode .phase-2 { border-bottom-color: #ec4899; }
body.dark-mode .phase-3 { border-bottom-color: #0ea5e9; }
body.dark-mode .text-content {
    background-color: #0f172a;
}
body.dark-mode .header p {
    color: #cbd5e1;
}
/* Accessibility Focus */
a:focus-visible, button:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 3px;
}
body.dark-mode model-viewer {
    background-color: #0f172a;
}
body.dark-mode .logo-img {
    filter: brightness(0) invert(1);
}
