/* =========================================
           1. PENGATURAN REMOTE TV (D-PAD NAVIGATION)
           ========================================= */
        input:focus, select:focus, button:focus, [tabindex]:focus, input[type="checkbox"]:focus {
            outline: 4px solid #00ff88 !important;
            outline-offset: 4px;
            box-shadow: 0 0 30px rgba(0, 255, 136, 0.7) !important;
            background-color: #0f172a !important;
            transform: scale(1.04);
            transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            z-index: 100;
        }

        ::-webkit-scrollbar { width: 10px; }
        ::-webkit-scrollbar-track { background: #0f172a; border-radius: 5px; }
        ::-webkit-scrollbar-thumb { background: #38bdf8; border-radius: 5px; }

        /* =========================================
           2. BACKGROUND & OVERLAY
           ========================================= */
        #bg-layer {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -2;
            background-color: #000; background-position: center; background-repeat: no-repeat;
            background-size: cover; background-image: url('defaultbackground.png');
        }

        .overlay {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(0, 0, 0, 0.4); z-index: -1;
        }

        .device-id-tag {
            position: fixed; bottom: 10vh; right: 2vw; background: rgba(0,0,0,0.8);
            padding: 5px 15px; border-radius: 5px; font-size: clamp(0.8rem, 1vw, 1rem);
            color: #00ff88; font-family: monospace; z-index: 100; border: 1px solid #00ff88; display: none;
        }

        /* =========================================
           3. STRUKTUR LAYOUT UTAMA
           ========================================= */
        body, html {
            margin: 0; padding: 0; overflow: hidden; width: 100%; height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: transparent;
        }

        .content {
            display: flex; flex-direction: column; justify-content: space-between;
            height: 100vh; padding: 2vh 2vw 8vh 2vw; box-sizing: border-box;
        }

        /* =========================================
           4. HEADER KLASIK (DENGAN TANGGAL)
           ========================================= */
        .top-bar-modern {
            display: flex; justify-content: space-between; align-items: center;
            background: rgba(255, 255, 255, 0.95); width: 100%; padding: 2vh 2vw;
            box-sizing: border-box; border-bottom: 4px solid #d97706; border-radius: 0 0 15px 15px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.5); margin: 0; z-index: 30;
        }

        .header-divider { width: 2px; height: 6vh; background-color: #d97706; margin: 0 1vw; }
        .header-clock { flex: 1; text-align: left; }
        .header-center { flex: 2; text-align: center; }
        .header-date { flex: 1; text-align: right; }

        #masjid-name {
            margin: 0; font-size: clamp(2rem, 4vw, 3.5rem) !important; font-weight: 900 !important;
            color: #0f172a; text-transform: uppercase; letter-spacing: 2px;
            display: flex; align-items: center; justify-content: center; gap: 10px;
        }
        .mosque-icon { font-size: clamp(2rem, 3.5vw, 3rem); display: none; }

        #masjid-address {
            margin: 0.5vh 0 0 0; font-size: clamp(1rem, 1.5vw, 1.5rem) !important;
            font-weight: bold; color: #475569; text-align: center;
        }

        #hijri-date, #current-date {
            font-size: clamp(1.2rem, 2vw, 1.8rem); font-weight: bold;
            color: #0f172a; margin: 0; line-height: 1.3;
        }

        /* =========================================
           5. SISTEM SLIDESHOW
           ========================================= */
        #slideshow-container {
            flex-grow: 1; position: relative; width: 100%; display: flex;
            justify-content: center; align-items: center;
            margin: 2vh 0; /* Membatasi jarak aman atas dan bawah */
            overflow: hidden; /* Mencegah elemen keluar dari wadah utama */
            box-sizing: border-box;
        }
        .tv-slide {
            display: none; flex-direction: column; justify-content: center; align-items: center;
            width: 100%; position: absolute; animation: fadeInOut 1s ease-in-out;
            max-height: 100%; /* Memastikan tinggi maksimal tidak melebihi container */
            box-sizing: border-box;
        }
        .active-slide { display: flex !important; z-index: 10; }
        @keyframes fadeInOut { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

        .clock-container { width: 100%; text-align: center; display: flex; justify-content: center; align-items: center; }
        #digital-clock {
            font-size: clamp(8rem, 18vw, 20rem) !important; font-weight: bold; color: #ffffff;
            line-height: 1; text-shadow: 2px 5px 10px rgba(0,0,0,0.8); letter-spacing: 5px;
            font-variant-numeric: tabular-nums; margin: 0;
        }

        /* PEMBARUAN: Merapatkan list kegiatan majelis agar tidak tabrakan */
        #slide-3 ul {
            line-height: 1.2 !important; /* Diperkecil dari 1.8 */
            margin-top: 1vh; /* Jarak aman di atas list */
        }
        #slide-3 ul li {
            margin-bottom: 0.8vh !important; /* Diperkecil dari 1.5vh */
        }

        /* =========================================
           6. JADWAL SHALAT & RUNNING TEXT
           ========================================= */
        .prayer-grid {
            display: flex; flex-direction: row; justify-content: space-around; align-items: stretch;
            background: rgba(255, 255, 255, 0.95); padding: 0; margin: 0 1vw; border-radius: 10px;
            border: 3px solid #d97706; box-shadow: 0 10px 20px rgba(0,0,0,0.5); min-height: 9.5vh;
        }
        .prayer-card {
            text-align: center; flex: 1; padding: 1.0vh 0.4vw; display: flex;
            flex-direction: column; justify-content: center; border-right: 2px solid #d97706;
        }
        .prayer-card:last-child { border-right: none; }

        .prayer-card h4 {
            margin: 0; font-size: clamp(1.1rem, 1.8vw, 1.6rem); color: #334155;
            font-weight: bold; text-transform: uppercase;
        }
        .prayer-card p { margin: 0.5vh 0 0 0; font-size: clamp(2.2rem, 4vw, 4.5rem); color: #0f172a; font-weight: bold; }
        .active-prayer { background: #ea580c !important; border-right: 2px solid #ea580c !important; }
        .active-prayer h4, .active-prayer p { color: #ffffff !important; }

        .countdown {
            font-size: clamp(0.9rem, 1.3vw, 1.3rem); color: #ffeb3b;
            font-weight: bold; margin-top: 0.5vh; display: none;
        }
        .active-prayer .countdown { display: block; }

        footer {
            width: 100%; position: fixed; bottom: 0; left: 0; background: #0f172a;
            z-index: 50; height: 8vh; display: flex; align-items: center; border-top: 4px solid #ea580c;
        }
        .marquee { width: 100%; overflow: hidden; white-space: nowrap; box-sizing: border-box; }

        #running-text {
            display: inline-block; font-size: clamp(1.8rem, 3.5vw, 3.5rem); font-weight: bold;
            color: #f8fafc; padding-left: 100vw; margin: 0;
            white-space: nowrap; width: max-content;
            animation: moveMarquee 20s linear infinite;
            will-change: transform;
        }

        @keyframes moveMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

        /* =========================================
           7. MODAL LAYAR KHUSUS & FORM
           ========================================= */
        #visible-settings-trigger, #update-system-btn {
            position: fixed; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.9);
            font-size: clamp(1.5rem, 2.5vw, 2.5rem); cursor: pointer; z-index: 9999; opacity: 0.5; border: 2px solid #333;
        }
        #visible-settings-trigger { left: 0; padding: 1vh 1vw; border-radius: 0 10px 10px 0; border-left: none; }
        #visible-settings-trigger:hover { opacity: 1; background: #fff; }
        #update-system-btn { right: 0; padding: 1vh 1vw; border-radius: 10px 0 0 10px; border-right: none; display: block; }
        #update-system-btn:hover { opacity: 1; background: #fff; }

        #iqomah-screen, #shalat-screen {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background-color: #0b0f19;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            z-index: 500; display: none; flex-direction: column;
            justify-content: center; align-items: center; text-align: center;
        }

        #iqomah-title {
            color: #ffaa00; font-size: clamp(1.5rem, 3vw, 3rem); font-weight: bold;
            letter-spacing: 5px; margin: 0 0 2vh 0;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
        }
        #iqomah-timer {
            color: #ffffff; font-size: clamp(7.5rem, 15vw, 17rem); font-weight: bold; line-height: 1; margin: 0;
            text-shadow: 4px 4px 10px rgba(0,0,0,0.9);
        }
        #iqomah-subtitle {
            color: #94a3b8; font-size: clamp(0.75rem, 1.5vw, 1.5rem); margin-top: 2vh; text-transform: uppercase;
            text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
        }

        #shalat-title {
            color: #ffaa00; font-size: clamp(1.5rem, 3vw, 3rem);
            font-weight: bold; letter-spacing: 5px; margin: 0 0 2vh 0;
            text-transform: uppercase;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
        }
        #shalat-clock {
            color: #ffffff; font-size: clamp(5rem, 10vw, 11rem); font-weight: bold; line-height: 1; margin: 0;
            text-shadow: 4px 4px 10px rgba(0,0,0,0.9);
        }

        #license-lock-screen {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #0f172a;
            z-index: 999999; display: none; flex-direction: column;
            justify-content: center; align-items: center; text-align: center; color: white;
        }

        .lock-container {
            background: #1e293b; padding: 4vh 4vw; border-radius: 10px;
            border: 2px solid #ef4444; max-width: 80vw; box-shadow: 6px 6px 0px rgba(0,0,0,0.8);
        }

        #settings-modal {
            display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(0,0,0,0.9); z-index: 10000; justify-content: center; align-items: center;
        }

        #registration-screen input[readonly] { cursor: pointer; opacity: 0.8; border-style: dashed !important; }
        #registration-screen input:not([readonly]) { background-color: #0284c7 !important; border-color: #00ff88 !important; }

        #typing-popup {
            display: none; position: fixed; top: 5vh; left: 50%; transform: translateX(-50%);
            background: rgba(11, 17, 33, 0.98); border: 4px solid #00ff88;
            box-shadow: 0 15px 50px rgba(0,0,0,0.9); padding: 4vh 5vw; border-radius: 20px;
            z-index: 1000000; text-align: center; min-width: 50vw; max-width: 90vw;
        }
        #typing-popup-label {
            font-size: clamp(1.2rem, 1.8vw, 1.8rem); color: #94a3b8; margin-bottom: 2vh;
            font-weight: bold; text-transform: uppercase; letter-spacing: 1px;
        }
        #typing-popup-value {
            font-size: clamp(3rem, 5vw, 5rem); color: #00ff88; font-weight: bold;
            word-wrap: break-word; font-family: monospace;
        }