﻿/* 定義 CSS 變數 / กำหนดตัวแปร CSS สำหรับสี เพื่อให้เปลี่ยน Theme ได้แบบ Real-time */
:root {
    --color-primary: #1e3a8a; /* blue-900 */
    --color-secondary: #3b82f6; /* blue-500 */
    --color-accent: #eff6ff; /* blue-50 */
}

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');
body { font-family: 'Prompt', sans-serif; }
.view-section { display: none; }
.view-section.active { display: block; }

.video-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #000;
}
video {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1); /* สลับซ้ายขวาให้เหมือนกระจกตอนใช้กล้องหน้า */
}
video.environment {
    transform: scaleX(1); /* กล้องหลังไม่ต้องสลับ */
}
canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Custom scrollbar for better mobile look */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* ==========================================
   ส่วนสำหรับการพิมพ์ (PRINT LAYOUT)
   ========================================== */
@media print {
    /* 0. ซ่อนแถบ Scrollbar ทิ้งเวลาสั่งพิมพ์ */
    ::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }
    * {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    /* 1. กำหนดขนาดกระดาษและระยะขอบกระดาษให้สมดุล */
    @page {
        size: A4 portrait;
        margin: 10mm; 
    }

    /* 2. ปลดล็อกความสูง เคลียร์ระยะขอบ และ overflow */
    html, body, main {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
        background-color: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. ซ่อนเมนู แถบด้านข้าง และ UI ที่ไม่ต้องการพิมพ์ */
    header, aside, #sidebar, #sidebar-overlay, .no-print, .fixed, .view-section:not(#view-student_card), #fab-menu, #main-fab-btn {
        display: none !important;
    }

    /* 4. ปลด Padding ของกล่องที่ครอบเนื้อหาอยู่ */
    main > div {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        border: none !important;
    }

    /* 5. บังคับให้แสดงผลเฉพาะหน้าบัตรนักเรียน */
    #view-student_card {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    /* 6. ลบ Padding/Shadow ของกล่องขาวในหน้าบัตร */
    #view-student_card > div {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    /* 7. จัด Layout เป็น Grid 3 คอลัมน์ (เพื่อให้กว้าง 54mm แล้วไม่ล้นหน้า A4) */
    #student-card-grid {
        display: grid !important;
        width: 100% !important;
        grid-template-columns: repeat(3, max-content) !important;
        justify-content: center !important;
        gap: 15px !important;
        padding: 0 !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    /* 8. กรอบเส้นประและป้องกันไม่ให้บัตรถูกตัดครึ่งระหว่างรอยต่อหน้ากระดาษ */
    .print-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        border: 1.5px dashed #9ca3af !important; 
        box-shadow: none !important;
        background-color: white !important;
        margin: 0 !important;
        /* เอา width: 100% !important ออก เพื่อให้รักษาขนาด 54mm ได้ */
        box-sizing: border-box !important;
    }

    .admin-card-front, .admin-card-qr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* บังคับให้เบราว์เซอร์พิมพ์สีพื้นหลัง */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Animation สำหรับหน้า Login */
.fade-in { animation: fadeIn 0.5s ease-in-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ซ่อนเมนู/ส่วนประกอบตาม Role */
body.role-student .admin-only { display: none !important; }
body:not(.role-student) .student-only { display: none !important; }
body.role-teacher .admin-strict { display: none !important; } /* ซ่อนส่วนที่เป็นของ Admin เท่านั้น */

/* Animation สำหรับ Pop-up แจ้งเตือนเวลาสแกน (เพิ่มใหม่) */
@keyframes bounceShort {
    0% { transform: translateY(20px); opacity: 0; }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); opacity: 1; }
}
.animate-bounce-short {
    animation: bounceShort 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ==========================================
   HOME VISIT PHOTO SOURCE POPUP
   ========================================== */
.home-visit-zone-marker-wrap {
    background: transparent;
    border: 0;
}

.home-visit-zone-marker {
    position: relative;
    width: 42px;
    height: 48px;
    filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.24));
}

.home-visit-zone-marker-pin {
    position: absolute;
    left: 5px;
    top: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--zone-color, #2563eb);
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--zone-color, #2563eb) 18%, #ffffff), 0 2px 8px rgba(15, 23, 42, 0.18);
}

.home-visit-zone-marker-pin i {
    font-size: 14px;
    transform: rotate(45deg);
}

.home-visit-zone-marker-badge {
    position: absolute;
    right: 0;
    top: 22px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--zone-color, #2563eb);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--zone-border, #93c5fd);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.visit-photo-choice-popup {
    border-radius: 28px !important;
    overflow: hidden !important;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
}
.visit-photo-choice-html {
    margin: 0 !important;
    padding: 0 !important;
}
.visit-photo-choice-close {
    color: #64748b !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 999px !important;
    margin: 14px 14px 0 0 !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
}
.visit-photo-choice-close:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.visit-photo-choice {
    text-align: left;
    color: #0f172a;
}
.visit-photo-choice-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 28px 20px;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(240, 253, 250, 0.94)),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 38%);
    border-bottom: 1px solid #e2e8f0;
}
.visit-photo-choice-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 25px;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
    flex: 0 0 auto;
}
.visit-photo-choice-kicker {
    margin: 0 0 2px;
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}
.visit-photo-choice h3 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: 0;
}
.visit-photo-choice-student {
    margin: 7px 0 0;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}
.visit-photo-choice-student span {
    color: #64748b;
    font-weight: 600;
}
.visit-photo-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 20px 22px 12px;
}
.visit-photo-choice-card {
    appearance: none;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    padding: 18px 14px 16px;
    min-height: 168px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.visit-photo-choice-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.12);
}
.visit-photo-choice-card:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.28);
    outline-offset: 2px;
}
.visit-photo-choice-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.visit-photo-choice-camera .visit-photo-choice-card-icon {
    background: #dbeafe;
    color: #2563eb;
}
.visit-photo-choice-upload .visit-photo-choice-card-icon {
    background: #ccfbf1;
    color: #0f766e;
}
.visit-photo-choice-card-title {
    display: block;
    width: 100%;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 800;
    margin-bottom: 7px;
}
.visit-photo-choice-card-desc {
    display: block;
    width: 100%;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
}
.visit-photo-category {
    display: grid;
    gap: 8px;
    margin: 0 22px 16px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}
.visit-photo-category span {
    display: flex;
    align-items: center;
    gap: 7px;
}
.visit-photo-category select {
    width: 100%;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    padding: 11px 12px;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.visit-photo-category select:focus {
    border-color: #38bdf8;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);
}
.visit-photo-choice-cancel {
    width: calc(100% - 44px);
    margin: 0 22px 22px;
    border: 0;
    border-radius: 14px;
    background: #f8fafc;
    color: #475569;
    padding: 12px 16px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.visit-photo-choice-cancel:hover {
    background: #e2e8f0;
    color: #0f172a;
}

@media (max-width: 520px) {
    .visit-photo-choice-hero {
        padding: 24px 22px 18px;
        gap: 12px;
    }
    .visit-photo-choice-icon {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        font-size: 22px;
    }
    .visit-photo-choice h3 {
        font-size: 20px;
    }
    .visit-photo-choice-grid {
        grid-template-columns: 1fr;
        padding: 16px 18px 10px;
    }
    .visit-photo-choice-card {
        min-height: auto;
        align-items: flex-start;
        text-align: left;
        padding: 15px;
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr);
        column-gap: 12px;
    }
    .visit-photo-choice-card-icon {
        width: 46px;
        height: 46px;
        margin: 0;
        grid-row: span 2;
    }
    .visit-photo-choice-card-title {
        margin-bottom: 4px;
    }
    .visit-photo-category {
        margin: 0 18px 14px;
    }
    .visit-photo-choice-cancel {
        width: calc(100% - 36px);
        margin: 0 18px 18px;
    }
}

.home-visit-gallery-popup {
    border-radius: 24px !important;
}
.home-visit-gallery-html {
    margin: 0 !important;
}
.home-visit-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 8px 4px 2px;
}
.home-visit-gallery-card {
    appearance: none;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
    padding: 0;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.home-visit-gallery-card:hover {
    transform: translateY(-2px);
    border-color: #38bdf8;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}
.home-visit-gallery-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f1f5f9;
}
.home-visit-gallery-meta {
    display: grid;
    gap: 3px;
    padding: 10px 12px 12px;
}
.home-visit-gallery-meta b {
    color: #0f172a;
    font-size: 13px;
    line-height: 1.35;
}
.home-visit-gallery-meta small {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

/* ==========================================
   MODERN TOP-CENTER LOGIN LOADER (RESPONSIVE BACKGROUND)
   ========================================== */
.cyber-loader-container {
    position: fixed;
    inset: 0;
    z-index: 999999;
    /* ค่าเริ่มต้นสำหรับหน้าจอมือถือ/แนวตั้ง: ใช้ภาพ klassin.png */
    background: url('klassin.png') no-repeat center center / cover;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    padding-top: 40px; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

/* เมื่อเปิดบนคอมพิวเตอร์ / หน้าจอแนวนอนขนาดกว้าง (Desktop 1024px ขึ้นไป) */
@media (min-width: 1024px) {
    .cyber-loader-container {
        /* เปลี่ยนเป็นภาพแนวตั้ง/แนวนอนอัตราส่วน 16:9 คมชัดสวยงามตามต้องการ */
        background: url('klassinH.png') no-repeat center center / cover;
    }
}

.cyber-loader-container.active {
    opacity: 1;
    visibility: visible;
}

/* กล่อง Loading ด้านบนตรงกลาง สไตล์มินิมอลโปร่งแสงเพื่อให้เห็นพื้นหลังชัด */
.cyber-loading-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 18px 28px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    gap: 20px;
    max-width: 90%;
    width: 480px;
}

/* โลโก้อยู่ฝั่งซ้าย */
.cyber-logo-left {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
    flex-shrink: 0;
}

/* ส่วนข้อมูลฝั่งขวา (ข้อความ + แถบโหลดด้านล่าง) */
.cyber-content-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ข้อความ ยินดีต้อนรับเข้าสู่ Klassin.cc */
.cyber-text {
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin: 0;
}

/* รางแถบเลื่อน Loading ด้านใต้ข้อความ */
.cyber-progress-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(226, 232, 240, 0.8); 
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* ตัวแถบวิ่งจากซ้ายไปขวา ใช้เวลาปรับเป็น 5 วินาที */
.cyber-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 4px;
}

/* สั่งให้แอนิเมชันทำงานเมื่อคลาส active แสดงผล (3s) */
.cyber-loader-container.active .cyber-progress-bar {
    animation: slideProgress 3s linear forwards;
}

/* --- Keyframes สำหรับแถบวิ่งจากซ้ายไปขวา --- */
@keyframes slideProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}
/* Randomizer winner effects */
.randomizer-ready-avatar {
    width: 10rem;
    height: 10rem;
    border-radius: 9999px;
    background: #e5e7eb;
    border: 8px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 3.75rem;
    margin: 0 auto 1rem;
    box-shadow: inset 0 10px 30px rgba(15, 23, 42, 0.08);
}

@media (min-width: 768px) {
    .randomizer-ready-avatar {
        width: 14rem;
        height: 14rem;
        font-size: 4.5rem;
        margin-bottom: 1.5rem;
    }
}

#random-display.randomizer-shuffling {
    background: radial-gradient(circle at 50% 30%, #fff7ed 0%, #fdf2f8 46%, #ffffff 100%);
    overflow: hidden;
}

#random-display.randomizer-shuffling::before,
#random-display.randomizer-winner-active::before {
    content: '';
    position: absolute;
    inset: -45%;
    background: conic-gradient(from 0deg, transparent, rgba(236, 72, 153, 0.18), transparent, rgba(245, 158, 11, 0.16), transparent);
    animation: randomizerSpin 1.5s linear infinite;
    pointer-events: none;
}

.randomizer-shuffle-frame,
.randomizer-winner-card {
    position: relative;
    z-index: 1;
}

.randomizer-shuffle-frame {
    animation: randomizerFlipIn 0.18s ease-out both;
}

.randomizer-shuffle-photo {
    width: 10rem;
    height: 10rem;
    border-radius: 9999px;
    border: 8px solid rgba(236, 72, 153, 0.25);
    box-shadow: 0 18px 45px rgba(236, 72, 153, 0.18);
    margin: 0 auto 1rem;
}

@media (min-width: 768px) {
    .randomizer-shuffle-photo {
        width: 14rem;
        height: 14rem;
        margin-bottom: 1.5rem;
    }
}

#random-display.randomizer-winner-active {
    background: radial-gradient(circle at 50% 20%, #fef3c7 0%, #fce7f3 42%, #ffffff 100%);
    overflow: hidden;
}

.randomizer-winner-card {
    width: min(100%, 32rem);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 0.8rem);
    animation: randomizerWinnerPop 0.72s cubic-bezier(0.2, 1.35, 0.32, 1) both;
}

.randomizer-winner-card-large {
    width: 100%;
    padding: 0.15rem 0.15rem 0;
}

.randomizer-winner-photo,
.randomizer-winner-photo-large {
    border-radius: 9999px;
    border: 10px solid #ffffff;
    outline: 6px solid #ec4899;
    box-shadow: 0 24px 70px rgba(236, 72, 153, 0.32), 0 0 0 14px rgba(245, 158, 11, 0.14);
    background: #fff;
}

.randomizer-winner-photo {
    width: clamp(8rem, 46vw, 16rem);
    height: clamp(8rem, 46vw, 16rem);
}

.randomizer-winner-photo-large {
    width: clamp(9rem, 48vw, 18rem);
    height: clamp(9rem, 48vw, 18rem);
}

.randomizer-winner-badge {
    position: absolute;
    top: -0.45rem;
    right: calc(50% - 8.7rem);
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    box-shadow: 0 12px 26px rgba(236, 72, 153, 0.25);
    animation: randomizerBadgePulse 1.1s ease-in-out infinite;
}

.randomizer-winner-copy {
    text-align: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.randomizer-winner-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.85rem;
    margin-bottom: 0.45rem;
    border-radius: 9999px;
    color: #be185d;
    background: #fce7f3;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0;
}

.randomizer-winner-popup {
    border-radius: 1.5rem !important;
    max-width: calc(100vw - 1rem) !important;
    overflow: visible;
}

.randomizer-winner-html {
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

.randomizer-winner-name {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    letter-spacing: 0;
}

.randomizer-winner-name-normal {
    font-size: clamp(1.55rem, 6.2vw, 2.25rem);
}

.randomizer-winner-name-large {
    font-size: clamp(1.6rem, 6.6vw, 3rem);
}

.randomizer-winner-meta {
    font-size: clamp(0.85rem, 3.4vw, 1.125rem);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    .randomizer-winner-card {
        gap: 0.45rem;
    }

    .randomizer-winner-photo,
    .randomizer-winner-photo-large {
        border-width: 6px;
        outline-width: 4px;
        box-shadow: 0 14px 36px rgba(236, 72, 153, 0.26), 0 0 0 8px rgba(245, 158, 11, 0.12);
    }

    .randomizer-winner-badge {
        top: -0.25rem;
        right: calc(50% - 5.4rem);
        width: 2.45rem;
        height: 2.45rem;
        font-size: 0.9rem;
    }

    .randomizer-winner-label {
        font-size: 0.72rem;
        margin-bottom: 0.25rem;
    }
}

.randomizer-confetti-layer {
    position: fixed;
    left: 50%;
    top: 54%;
    width: 1px;
    height: 1px;
    pointer-events: none;
    z-index: 1000000;
}

.randomizer-confetti-layer span {
    position: absolute;
    width: 10px;
    height: 16px;
    border-radius: 3px;
    background: var(--c);
    animation: randomizerConfetti 1.35s ease-out forwards;
}

@keyframes randomizerSpin {
    to { transform: rotate(360deg); }
}

@keyframes randomizerFlipIn {
    from { opacity: 0.2; transform: scale(0.88) rotate(-2deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes randomizerWinnerPop {
    0% { opacity: 0; transform: translateY(16px) scale(0.62); filter: blur(6px); }
    55% { opacity: 1; transform: translateY(-8px) scale(1.07); filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes randomizerBadgePulse {
    0%, 100% { transform: scale(1) rotate(-8deg); }
    50% { transform: scale(1.14) rotate(8deg); }
}

@keyframes randomizerConfetti {
    0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
    100% { opacity: 0; transform: translate3d(var(--x), var(--y), 0) rotate(var(--r)); }
}
/* App drawer menu inspired by the provided mobile reference */
#sidebar.app-sidebar {
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: 22px 0 48px rgba(15, 23, 42, 0.18);
}

.sidebar-brand-panel {
    position: relative;
    padding: 26px 22px 16px;
    background: #ffffff;
}

.sidebar-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: #64748b;
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-close-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.sidebar-compact-toggle-row {
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px 8px;
    background: #ffffff;
}

.sidebar-mode-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #64748b;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.sidebar-mode-toggle:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.sidebar-logo-lockup {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    margin-top: 2px;
    text-align: left;
}

.sidebar-logo-mark {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.sidebar-logo-lockup h1 {
    margin: 0;
    color: #1f2937;
    font-size: 31px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0;
}

.sidebar-logo-lockup p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-title-brand {
    color: inherit;
    min-width: 0;
}

#page-title {
    color: #0ea5e9;
}

.dashboard-title-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
}

.dashboard-title-name {
    color: #0ea5e9;
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0;
}

.dashboard-title-subtitle {
    margin-top: 3px;
    color: #64748b;
    font-size: 0.68rem;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 1;
}

.topbar-clock-card {
    position: relative;
    min-width: 188px;
    min-height: 54px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #f8fafc;
    color: #0f172a;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 34px 8px 16px;
    margin-left: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.topbar-clock-mobile-icon {
    display: none;
    color: #0ea5e9;
    font-size: 1.1rem;
}

.topbar-clock-card:hover {
    border-color: #93c5fd;
    background: #ffffff;
    transform: translateY(-1px);
}

.topbar-clock-time {
    color: #0f172a;
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.topbar-clock-date {
    color: #475569;
    font-size: 0.72rem;
    line-height: 1.15;
    font-weight: 650;
    white-space: nowrap;
}

.topbar-clock-expand {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #0ea5e9;
    font-size: 0.9rem;
}

@media (max-width: 639px) {
    .topbar-clock-card {
        min-width: 44px;
        width: 44px;
        min-height: 44px;
        height: 44px;
        border-radius: 999px;
        padding: 0;
        flex: 0 0 44px;
    }

    .topbar-clock-mobile-icon {
        display: inline-flex;
    }

    .topbar-clock-time,
    .topbar-clock-date,
    .topbar-clock-expand {
        display: none;
    }
}

.clock-fullscreen-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #e0f2fe 0%, #f8fafc 48%, #dbeafe 100%);
    color: #0f172a;
}

.clock-fullscreen-modal.clock-timer-warning {
    animation: clockQuake 0.18s linear infinite;
}

.clock-fullscreen-modal.clock-timer-finished {
    animation: clockQuake 0.12s linear infinite;
}

.clock-fullscreen-modal.hidden {
    display: none;
}

.clock-weather-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(to bottom, #4facfe 0%, #00f2fe 100%);
    transition: background 1.5s ease;
}

.clock-weather-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.clock-fullscreen-content {
    position: relative;
    z-index: 2;
    width: min(860px, calc(100vw - 40px));
    min-height: 360px;
    max-height: calc(100dvh - 40px);
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.54);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.36);
    backdrop-filter: blur(12px);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.14);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 28px;
}

.clock-fullscreen-time {
    color: #0f172a;
    font-size: clamp(4rem, 14vw, 9.5rem);
    line-height: 0.92;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.clock-fullscreen-date {
    margin-top: 18px;
    color: #334155;
    font-size: clamp(1rem, 3vw, 1.65rem);
    line-height: 1.2;
    font-weight: 650;
}

.clock-weather-panel {
    margin-top: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 10px 16px;
    color: #334155;
    font-weight: 800;
}

.clock-weather-panel i {
    color: #0ea5e9;
    font-size: 1.1rem;
}

#clock-weather-location {
    color: #64748b;
    font-size: 0.82rem;
    max-width: min(52vw, 360px);
    overflow-wrap: anywhere;
}

.clock-fullscreen-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(226, 232, 240, 0.85);
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.clock-fullscreen-close:hover {
    background: #ffffff;
    transform: rotate(90deg);
}

.clock-control-toggle {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left));
    z-index: 10030;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, 0.72);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(226, 232, 240, 0.78);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    opacity: 0.78;
    transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.clock-control-toggle i {
    font-size: 1rem;
}

.clock-control-toggle:hover,
.clock-control-toggle.is-open {
    background: rgba(255, 255, 255, 0.88);
    opacity: 1;
    transform: rotate(18deg) scale(1.02);
}

.clock-control-panel {
    position: fixed;
    top: max(78px, calc(env(safe-area-inset-top) + 78px));
    left: max(18px, env(safe-area-inset-left));
    z-index: 10029;
    width: min(360px, calc(100vw - 36px));
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(15, 23, 42, 0.58);
    color: #f8fafc;
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    padding: 16px;
    max-height: calc(100dvh - max(96px, calc(env(safe-area-inset-top) + 96px)) - 18px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.clock-control-panel.hidden {
    display: none;
}

.clock-control-section + .clock-control-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.clock-control-title {
    font-size: 0.85rem;
    line-height: 1.2;
    font-weight: 800;
    color: rgba(248, 250, 252, 0.82);
    margin-bottom: 10px;
}

.clock-weather-choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.clock-weather-choice {
    min-height: 62px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 750;
    line-height: 1.15;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.clock-weather-choice i {
    font-size: 1.1rem;
    color: #67e8f9;
}

.clock-weather-choice:hover,
.clock-weather-choice.is-active {
    transform: translateY(-1px);
    background: rgba(14, 165, 233, 0.32);
    border-color: rgba(125, 211, 252, 0.72);
}

.clock-timer-form {
    display: grid;
    grid-template-columns: auto minmax(58px, 1fr) auto minmax(58px, 1fr);
    align-items: center;
    gap: 8px;
}

.clock-timer-form label {
    color: rgba(248, 250, 252, 0.8);
    font-size: 0.82rem;
    font-weight: 750;
}

.clock-timer-form input {
    min-width: 0;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 0 10px;
    font-weight: 800;
    outline: none;
}

.clock-timer-start,
.clock-timer-stop {
    height: 40px;
    border-radius: 12px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.clock-timer-start {
    grid-column: 1 / 3;
}

.clock-timer-stop {
    grid-column: 3 / 5;
}

.clock-timer-start {
    color: #022c22;
    background: #5eead4;
}

.clock-timer-stop {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.clock-timer-panel-status {
    margin-top: 10px;
    color: rgba(226, 232, 240, 0.86);
    font-size: 0.8rem;
    font-weight: 650;
}

.clock-preset-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.clock-preset-item {
    position: relative;
    min-width: 0;
}

.clock-preset-button,
.clock-tool-grid button {
    min-width: 0;
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.15;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.clock-preset-button {
    position: relative;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
}

.clock-preset-button i,
.clock-tool-grid button i {
    color: #67e8f9;
}

.clock-preset-button b {
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.clock-preset-button:hover,
.clock-tool-grid button:hover {
    transform: translateY(-1px);
    background: rgba(14, 165, 233, 0.28);
    border-color: rgba(125, 211, 252, 0.58);
}

.clock-preset-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 113, 113, 0.9);
    color: #ffffff;
    border: 1px solid rgba(254, 202, 202, 0.5);
    font-size: 0.72rem;
}

.clock-announcement-form {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.clock-announcement-form {
    grid-template-columns: 1fr auto auto;
}

.clock-announcement-form input,
.clock-sound-select {
    min-width: 0;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 750;
    outline: none;
}

.clock-sound-select {
    width: 100%;
    color: #f8fafc;
}

.clock-sound-select option {
    color: #0f172a;
}

.clock-announcement-form button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(94, 234, 212, 0.9);
    color: #022c22;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.clock-announcement-form button:last-child {
    background: rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.clock-tool-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.clock-random-room-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.clock-random-room-row label {
    color: rgba(248, 250, 252, 0.82);
    font-size: 0.78rem;
    font-weight: 800;
}

.clock-random-room-row select {
    min-width: 0;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 0 10px;
    font-size: 0.82rem;
    font-weight: 800;
    outline: none;
}

.clock-random-room-row option {
    color: #0f172a;
}

.clock-timer-display {
    margin-top: 16px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.14);
    border: 1px solid rgba(14, 165, 233, 0.24);
    color: #0f172a;
    padding: 8px 16px;
    font-size: clamp(1rem, 2.4vw, 1.7rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.clock-fullscreen-modal.clock-timer-active .clock-fullscreen-time,
.clock-fullscreen-modal.clock-timer-active .clock-fullscreen-date {
    display: none;
}

.clock-fullscreen-modal.clock-timer-active .clock-timer-display {
    margin-top: 0;
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    padding: 18px 34px;
    font-size: clamp(4rem, 13vw, 9rem);
    line-height: 1;
    font-weight: 650;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.clock-timer-display.hidden,
.clock-timeup-display.hidden {
    display: none;
}

.clock-timeup-display {
    margin-top: 16px;
    color: #fee2e2;
    background: rgba(220, 38, 38, 0.74);
    border: 1px solid rgba(254, 202, 202, 0.4);
    border-radius: 999px;
    padding: 10px 22px;
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1;
    font-weight: 850;
    box-shadow: 0 0 40px rgba(248, 113, 113, 0.42);
    animation: clockTimeupPulse 0.65s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.clock-timeup-display:hover {
    background: rgba(185, 28, 28, 0.84);
    box-shadow: 0 0 46px rgba(248, 113, 113, 0.58);
}

.clock-announcement-display {
    margin-bottom: 18px;
    max-width: min(760px, 88vw);
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.18);
    border: 1px solid rgba(125, 211, 252, 0.42);
    color: #0f172a;
    padding: 10px 22px;
    font-size: clamp(1rem, 2.4vw, 1.55rem);
    line-height: 1.25;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.clock-classroom-layer {
    width: min(760px, 92vw);
    margin-top: 22px;
}

.clock-announcement-display.hidden,
.clock-classroom-layer.hidden {
    display: none;
}

.clock-random-card,
.clock-breathing-card,
.clock-team-card {
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.32);
    color: #f8fafc;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    padding: 22px;
}

.clock-random-card {
    position: relative;
    overflow: hidden;
}

.clock-random-card::before {
    content: "";
    position: absolute;
    inset: -45%;
    background:
        radial-gradient(circle at 20% 20%, rgba(103, 232, 249, 0.24), transparent 28%),
        radial-gradient(circle at 78% 30%, rgba(250, 204, 21, 0.18), transparent 24%),
        conic-gradient(from 90deg, transparent, rgba(14, 165, 233, 0.22), transparent, rgba(94, 234, 212, 0.18), transparent);
    opacity: 0.65;
    animation: clockRandomSweep 4s linear infinite;
}

.clock-random-card > * {
    position: relative;
    z-index: 1;
}

.clock-random-kicker {
    color: #67e8f9;
    font-size: 0.9rem;
    font-weight: 850;
    letter-spacing: 0;
}

.clock-random-stage {
    margin: 14px auto 12px;
    width: clamp(150px, 22vw, 210px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.clock-random-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.clock-random-photo {
    width: 78%;
    height: 78%;
    border-radius: 34px;
    object-fit: cover;
    background: #e2e8f0;
    border: 5px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.35);
    transform: rotate(-1deg);
}

.clock-random-orbit {
    position: absolute;
    inset: 0;
    border-radius: 34px;
    border: 2px dashed rgba(103, 232, 249, 0.75);
    animation: clockRandomOrbit 2.8s linear infinite;
}

.clock-random-orbit.orbit-b {
    inset: 13px;
    border-color: rgba(250, 204, 21, 0.65);
    animation-direction: reverse;
    animation-duration: 2s;
}

.clock-random-name {
    margin-top: 4px;
    font-size: clamp(2rem, 6.4vw, 5.2rem);
    line-height: 1;
    font-weight: 850;
    text-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
}

.clock-random-room {
    margin-top: 10px;
    color: #cbd5e1;
    font-size: clamp(1rem, 2.4vw, 1.45rem);
    font-weight: 800;
}

.clock-random-drumroll {
    margin: 16px auto 0;
    width: min(360px, 72vw);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.clock-random-drumroll span {
    height: 8px;
    border-radius: 999px;
    background: rgba(103, 232, 249, 0.72);
    animation: clockDrumroll 0.72s ease-in-out infinite;
}

.clock-random-drumroll span:nth-child(2) { animation-delay: 0.08s; }
.clock-random-drumroll span:nth-child(3) { animation-delay: 0.16s; }
.clock-random-drumroll span:nth-child(4) { animation-delay: 0.24s; }
.clock-random-drumroll span:nth-child(5) { animation-delay: 0.32s; }

.clock-random-again {
    margin: 18px auto 0;
    min-height: 44px;
    border-radius: 999px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #022c22;
    background: linear-gradient(135deg, #5eead4, #67e8f9);
    border: 1px solid rgba(255, 255, 255, 0.44);
    box-shadow: 0 14px 34px rgba(14, 165, 233, 0.24);
    font-size: 0.9rem;
    font-weight: 900;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.clock-random-again:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 42px rgba(14, 165, 233, 0.32);
}

.clock-random-card.is-spinning .clock-random-again {
    opacity: 0.72;
}

.clock-random-card.is-spinning .clock-random-name,
.clock-random-card.is-spinning .clock-random-photo {
    animation: clockNameFlip 0.22s ease-in-out infinite;
}

.clock-random-card.is-near-miss {
    animation: clockNearMiss 0.58s ease-in-out;
}

.clock-random-card.is-rewind .clock-random-photo-wrap,
.clock-random-card.is-rewind .clock-random-name {
    animation: clockRandomRewind 0.6s cubic-bezier(.2, 1.4, .22, 1);
}

.clock-random-card.is-revealed .clock-random-photo {
    animation: clockWinnerPop 0.76s cubic-bezier(.2, 1.5, .32, 1);
}

.clock-random-card.is-revealed .clock-random-drumroll {
    opacity: 0;
}

.clock-random-spotlight {
    position: fixed;
    inset: 0;
    z-index: 10025;
    display: grid;
    place-items: center;
    pointer-events: none;
    background:
        radial-gradient(circle at center, rgba(14, 165, 233, 0.2), transparent 36%),
        rgba(15, 23, 42, 0.22);
    animation: clockSpotlightBackdrop 2.25s ease forwards;
}

.clock-random-spotlight-rays {
    position: absolute;
    width: min(92vw, 920px);
    aspect-ratio: 1;
    border-radius: 999px;
    background:
        conic-gradient(from 0deg, transparent 0 9deg, rgba(103, 232, 249, 0.34) 10deg 14deg, transparent 15deg 28deg, rgba(250, 204, 21, 0.26) 29deg 33deg, transparent 34deg 52deg);
    filter: blur(1px);
    animation: clockSpotlightRays 2.2s linear infinite;
}

.clock-random-spotlight-card {
    position: relative;
    width: min(92vw, 760px);
    display: grid;
    justify-items: center;
    gap: 18px;
    animation: clockSpotlightPop 2.25s cubic-bezier(.18, 1.18, .25, 1) forwards;
}

.clock-random-spotlight-card img {
    width: clamp(300px, 48vw, 620px);
    height: clamp(300px, 62vh, 620px);
    object-fit: cover;
    border-radius: clamp(28px, 4vw, 52px);
    border: clamp(8px, 1.2vw, 14px) solid rgba(255, 255, 255, 0.95);
    background: #e2e8f0;
    box-shadow:
        0 36px 100px rgba(15, 23, 42, 0.46),
        0 0 0 12px rgba(14, 165, 233, 0.22),
        0 0 70px rgba(103, 232, 249, 0.48);
}

.clock-random-spotlight-card div {
    min-width: min(88vw, 460px);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f8fafc;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.clock-random-spotlight-card small {
    color: #67e8f9;
    font-size: 0.9rem;
    font-weight: 900;
}

.clock-random-spotlight-card strong {
    font-size: clamp(1.4rem, 4vw, 2.6rem);
    line-height: 1;
    font-weight: 950;
}

.clock-random-spotlight-card span {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 850;
}

.clock-random-spark {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: #facc15;
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.9);
    animation: clockSpotlightSpark 1.25s ease-out infinite;
}

.clock-random-spark.spark-1 { top: 8%; left: 14%; animation-delay: 0s; }
.clock-random-spark.spark-2 { top: 18%; right: 10%; animation-delay: 0.16s; background: #67e8f9; }
.clock-random-spark.spark-3 { bottom: 22%; left: 12%; animation-delay: 0.32s; background: #5eead4; }
.clock-random-spark.spark-4 { bottom: 18%; right: 16%; animation-delay: 0.48s; }

.clock-random-spotlight.is-leaving {
    animation: clockSpotlightLeave 0.6s ease forwards;
}

.clock-breathing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.clock-breathing-circle {
    width: clamp(150px, 26vw, 240px);
    aspect-ratio: 1;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle, rgba(125, 211, 252, 0.4), rgba(14, 165, 233, 0.08) 68%);
    border: 1px solid rgba(125, 211, 252, 0.42);
    animation: clockBreathing 8s ease-in-out infinite;
}

.clock-breathing-circle span {
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    font-weight: 850;
}

.clock-breathing-card p {
    color: #e2e8f0;
    font-weight: 800;
}

.clock-breathing-card b {
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
}

.clock-team-card {
    text-align: left;
}

.clock-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-weight: 900;
}

.clock-team-header button {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    padding: 7px 12px;
    font-size: 0.78rem;
    font-weight: 850;
}

.clock-team-grid-display {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.clock-team-box {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 14px 10px;
    text-align: center;
}

.clock-team-box strong {
    display: block;
    color: #bae6fd;
    font-size: 0.9rem;
}

.clock-team-box b {
    display: block;
    margin: 7px 0 10px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.clock-team-box div {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.clock-team-box button {
    width: 38px;
    height: 34px;
    border-radius: 12px;
    background: rgba(94, 234, 212, 0.9);
    color: #022c22;
    font-size: 1.2rem;
    font-weight: 900;
}

.clock-fullscreen-modal.weather-night .clock-timer-display,
.clock-fullscreen-modal.weather-storm .clock-timer-display,
.clock-fullscreen-modal.weather-rainy .clock-timer-display {
    color: #e0f2fe;
    background: rgba(15, 23, 42, 0.44);
    border-color: rgba(255, 255, 255, 0.16);
}

.weather-cloudy {
    background: linear-gradient(to bottom, #9fb7d4 0%, #dbe4ee 100%);
}

.weather-rainy {
    background: linear-gradient(to bottom, #4b6cb7 0%, #182848 100%);
}

.weather-storm {
    background: linear-gradient(to bottom, #141e30 0%, #243b55 100%);
}

.weather-snowy {
    background: linear-gradient(to bottom, #c3cfe2 0%, #f5f7fa 100%);
}

.weather-night {
    background: linear-gradient(to bottom, #0f2027 0%, #203a43 50%, #2c5364 100%);
}

.weather-autumn {
    background: linear-gradient(to bottom, #8e4a23 0%, #d38312 48%, #f5af19 100%);
}

.clock-fullscreen-modal.weather-night .clock-fullscreen-content,
.clock-fullscreen-modal.weather-storm .clock-fullscreen-content,
.clock-fullscreen-modal.weather-rainy .clock-fullscreen-content {
    background: rgba(15, 23, 42, 0.34);
    border-color: rgba(255, 255, 255, 0.2);
}

.clock-fullscreen-modal.weather-night .clock-fullscreen-time,
.clock-fullscreen-modal.weather-night .clock-fullscreen-date,
.clock-fullscreen-modal.weather-storm .clock-fullscreen-time,
.clock-fullscreen-modal.weather-storm .clock-fullscreen-date,
.clock-fullscreen-modal.weather-rainy .clock-fullscreen-time,
.clock-fullscreen-modal.weather-rainy .clock-fullscreen-date {
    color: #f8fafc;
}

.clock-fullscreen-modal.weather-night .clock-weather-panel,
.clock-fullscreen-modal.weather-storm .clock-weather-panel,
.clock-fullscreen-modal.weather-rainy .clock-weather-panel {
    background: rgba(15, 23, 42, 0.52);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
}

.clock-fullscreen-modal.weather-night #clock-weather-location,
.clock-fullscreen-modal.weather-storm #clock-weather-location,
.clock-fullscreen-modal.weather-rainy #clock-weather-location {
    color: #cbd5e1;
}

.clock-fullscreen-modal.clock-random-active,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) {
    align-items: center;
}

.clock-fullscreen-modal.clock-random-active .clock-fullscreen-content,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) .clock-fullscreen-content {
    width: min(820px, calc(100vw - 32px));
    min-height: auto;
    max-height: calc(100dvh - 28px);
    padding-top: clamp(20px, 3vh, 36px);
    padding-bottom: clamp(18px, 3vh, 32px);
    overflow: visible;
}

.clock-fullscreen-modal.clock-random-active .clock-fullscreen-time,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) .clock-fullscreen-time {
    font-size: clamp(2.7rem, 8vw, 6rem);
}

.clock-fullscreen-modal.clock-random-active .clock-fullscreen-date,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) .clock-fullscreen-date {
    margin-top: 8px;
    font-size: clamp(0.85rem, 2vw, 1.2rem);
}

.clock-fullscreen-modal.clock-random-active .clock-weather-panel,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) .clock-weather-panel {
    margin-top: 10px;
    padding: 7px 12px;
    font-size: 0.78rem;
}

.clock-fullscreen-modal.clock-random-active .clock-classroom-layer,
.clock-fullscreen-modal:has(.clock-random-mode:not(.hidden)) .clock-classroom-layer {
    margin-top: 12px;
}

@keyframes clockQuake {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
    20% { transform: translate3d(-4px, 3px, 0) rotate(-0.25deg); }
    40% { transform: translate3d(4px, -3px, 0) rotate(0.25deg); }
    60% { transform: translate3d(-3px, -2px, 0) rotate(0.18deg); }
    80% { transform: translate3d(3px, 2px, 0) rotate(-0.18deg); }
}

@keyframes clockTimeupPulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.06); filter: brightness(1.22); }
}

@keyframes clockNameFlip {
    0%, 100% { transform: translateY(0); filter: blur(0); }
    50% { transform: translateY(-5px); filter: blur(1px); }
}

@keyframes clockRandomSweep {
    to { transform: rotate(360deg); }
}

@keyframes clockRandomOrbit {
    to { transform: rotate(360deg); }
}

@keyframes clockDrumroll {
    0%, 100% { transform: scaleY(0.45); opacity: 0.38; }
    50% { transform: scaleY(1.4); opacity: 1; }
}

@keyframes clockNearMiss {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-16px) rotate(-1deg); }
    62% { transform: translateX(18px) rotate(1deg); }
}

@keyframes clockRandomRewind {
    0% { transform: translateX(70px) scale(0.92) rotate(5deg); filter: blur(3px); opacity: 0.62; }
    62% { transform: translateX(-18px) scale(1.08) rotate(-2deg); filter: blur(0); opacity: 1; }
    100% { transform: translateX(0) scale(1) rotate(0); }
}

@keyframes clockWinnerPop {
    0% { transform: scale(0.86) rotate(-3deg); }
    55% { transform: scale(1.08) rotate(1deg); }
    100% { transform: scale(1) rotate(-1deg); }
}

@keyframes clockSpotlightBackdrop {
    0% { opacity: 0; }
    12%, 72% { opacity: 1; }
    100% { opacity: 0.92; }
}

@keyframes clockSpotlightRays {
    to { transform: rotate(360deg); }
}

@keyframes clockSpotlightPop {
    0% { transform: scale(0.2) rotate(-8deg); opacity: 0; }
    16% { transform: scale(1.08) rotate(2deg); opacity: 1; }
    28% { transform: scale(0.98) rotate(-1deg); }
    70% { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(0.72) translateY(20px); opacity: 0; }
}

@keyframes clockSpotlightSpark {
    0% { transform: translate3d(0, 0, 0) scale(0.4) rotate(0deg); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translate3d(0, -60px, 0) scale(1.2) rotate(180deg); opacity: 0; }
}

@keyframes clockSpotlightLeave {
    to { opacity: 0; transform: scale(0.96); }
}

@keyframes clockBreathing {
    0%, 100% { transform: scale(0.82); opacity: 0.78; }
    50% { transform: scale(1); opacity: 1; }
}

@media (min-width: 641px) and (max-height: 820px) {
    .clock-fullscreen-modal.clock-random-active .clock-fullscreen-content {
        width: min(760px, calc(100vw - 28px));
        max-height: calc(100dvh - 24px);
        padding: 16px 20px;
        border-radius: 26px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-fullscreen-time {
        font-size: clamp(2.3rem, 8vh, 4.5rem);
        line-height: 0.95;
    }

    .clock-fullscreen-modal.clock-random-active .clock-fullscreen-date {
        margin-top: 5px;
        font-size: 0.9rem;
    }

    .clock-fullscreen-modal.clock-random-active .clock-weather-panel {
        margin-top: 7px;
        padding: 5px 10px;
        gap: 6px;
        font-size: 0.72rem;
    }

    .clock-fullscreen-modal.clock-random-active #clock-weather-location {
        max-width: 220px;
        font-size: 0.7rem;
    }

    .clock-fullscreen-modal.clock-random-active .clock-classroom-layer {
        width: min(680px, 88vw);
        margin-top: 8px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-card {
        padding: 14px 18px;
        border-radius: 22px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-kicker {
        font-size: 0.78rem;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-stage {
        width: clamp(118px, 24vh, 160px);
        margin: 8px auto 7px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-photo {
        border-width: 4px;
        border-radius: 26px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-name {
        font-size: clamp(1.7rem, 7vh, 3.4rem);
        line-height: 0.98;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-room {
        margin-top: 5px;
        font-size: 0.92rem;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-drumroll {
        margin-top: 9px;
        width: min(300px, 62vw);
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-drumroll span {
        height: 6px;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-again {
        margin-top: 10px;
        min-height: 38px;
        padding: 0 16px;
        font-size: 0.82rem;
    }
}

@media (min-width: 641px) and (max-height: 680px) {
    .clock-fullscreen-modal.clock-random-active .clock-fullscreen-date {
        display: none;
    }

    .clock-fullscreen-modal.clock-random-active .clock-weather-panel {
        max-width: min(520px, 82vw);
    }

    .clock-fullscreen-modal.clock-random-active #clock-weather-location {
        display: none;
    }

    .clock-fullscreen-modal.clock-random-active .clock-random-stage {
        width: clamp(108px, 22vh, 140px);
    }
}

@media (max-width: 640px) {
    .clock-control-panel {
        top: max(76px, calc(env(safe-area-inset-top) + 76px));
        left: max(12px, env(safe-area-inset-left));
        width: calc(100vw - 24px);
        max-height: calc(100dvh - max(92px, calc(env(safe-area-inset-top) + 92px)) - max(12px, env(safe-area-inset-bottom)));
        padding: 12px;
        border-radius: 18px;
    }

    .clock-control-section + .clock-control-section {
        margin-top: 10px;
        padding-top: 10px;
    }

    .clock-control-title {
        margin-bottom: 8px;
    }

    .clock-weather-choices {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .clock-weather-choice {
        min-height: 50px;
        border-radius: 12px;
        font-size: 0.64rem;
        gap: 3px;
    }

    .clock-weather-choice i {
        font-size: 1rem;
    }

    .clock-timer-form {
        grid-template-columns: auto 1fr auto 1fr;
    }

    .clock-timer-start,
    .clock-timer-stop {
        width: 100%;
    }

    .clock-preset-list,
    .clock-tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .clock-preset-button,
    .clock-tool-grid button {
        min-height: 42px;
        border-radius: 12px;
        font-size: 0.72rem;
    }

    .clock-random-room-row,
    .clock-announcement-form {
        gap: 6px;
    }

    .clock-random-room-row select,
    .clock-announcement-form input,
    .clock-sound-select {
        height: 38px;
    }

    .clock-fullscreen-content {
        min-height: 300px;
        padding: 34px 18px;
    }

    .clock-team-grid-display {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .clock-random-card,
    .clock-breathing-card,
    .clock-team-card {
        padding: 16px;
        border-radius: 22px;
    }

    .clock-random-again {
        min-height: 42px;
        padding: 0 16px;
        font-size: 0.84rem;
    }
}

.dashboard-quick-menu {
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)) !important;
}

.dashboard-quick-menu > button {
    min-height: 112px;
    padding: 14px 10px !important;
    border-radius: 14px;
}

.dashboard-quick-menu h4 {
    line-height: 1.28;
    overflow-wrap: normal;
    word-break: normal;
}

@media (min-width: 768px) {
    .dashboard-quick-menu .quick-student-title {
        font-size: 0.72rem !important;
        line-height: 1.05;
        font-weight: 800;
        white-space: nowrap;
    }
}

@media (min-width: 768px) and (max-width: 1180px) {
    .dashboard-quick-menu {
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)) !important;
    }

    .dashboard-quick-menu > button {
        min-height: 118px;
        padding: 16px 12px !important;
    }
}

.quick-student-summary-html {
    margin-left: 1.2em !important;
    margin-right: 1.2em !important;
    overflow: visible !important;
}

.quick-student-summary-popup {
    max-height: calc(88dvh - 84px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    padding-bottom: 6px;
}

.quick-student-summary-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 8px;
    padding-bottom: 2px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, rgba(255, 255, 255, 0));
}

@media (max-width: 640px) {
    .quick-student-summary-html {
        margin-left: 0.8em !important;
        margin-right: 0.8em !important;
    }

    .quick-student-summary-popup {
        max-height: calc(86dvh - 76px);
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .quick-student-photo-card {
        align-items: flex-start;
        gap: 12px;
        padding: 12px !important;
    }

    .quick-student-photo-card img {
        width: 82px !important;
        height: 82px !important;
        border-radius: 20px !important;
    }

    .quick-student-photo-hint {
        display: block;
        line-height: 1.25;
    }

    .quick-student-subject-list {
        max-height: 28dvh !important;
    }
}

.sidebar-clock-wrap {
    padding: 2px 22px 14px;
}

.sidebar-clock-card {
    width: 100%;
    min-height: 72px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #111827;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.sidebar-clock-time {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.sidebar-clock-date {
    max-width: 100%;
    padding: 0 0.7rem;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.2;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar nav ul {
    padding: 0 8px 14px;
}

#sidebar nav li {
    margin: 0;
}

#sidebar .nav-link,
#sidebar nav a:not(.nav-link) {
    --sidebar-icon-color: #38a9d6;
    --sidebar-icon-bg: #eef8ff;
    --sidebar-icon-border: #c7eaff;
    --sidebar-icon-shadow: rgba(56, 169, 214, 0.18);
    min-height: 51px;
    display: flex !important;
    align-items: center;
    gap: 13px;
    padding: 6px 14px !important;
    border-radius: 16px;
    color: #111827 !important;
    background: transparent !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

#sidebar .nav-link:hover,
#sidebar nav a:not(.nav-link):hover {
    background: #f8fafc !important;
    color: #0f172a !important;
    transform: translateX(2px);
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

#sidebar .nav-link.bg-white\/20 {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(255, 255, 255, 0.9)) !important;
    color: #0f172a !important;
    box-shadow: inset 4px 0 0 #38bdf8;
}

#sidebar .nav-link i,
#sidebar nav a:not(.nav-link) i {
    width: 40px !important;
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-icon-color) !important;
    font-size: 20px;
    line-height: 1;
    text-align: center;
    border-radius: 14px;
    border: 1px solid var(--sidebar-icon-border);
    background:
        radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.16) 38%, transparent 58%),
        linear-gradient(145deg, #ffffff 0%, var(--sidebar-icon-bg) 100%);
    box-shadow:
        0 8px 16px var(--sidebar-icon-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#sidebar .nav-link:hover i,
#sidebar nav a:not(.nav-link):hover i,
#sidebar .nav-link.bg-white\/20 i {
    transform: translateY(-1px) scale(1.04);
    box-shadow:
        0 10px 18px var(--sidebar-icon-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

#sidebar .nav-link.bg-white\/20 i {
    border-color: color-mix(in srgb, var(--sidebar-icon-color) 34%, #ffffff);
    background:
        radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.18) 38%, transparent 58%),
        linear-gradient(145deg, #ffffff 0%, var(--sidebar-icon-bg) 72%, color-mix(in srgb, var(--sidebar-icon-color) 12%, #ffffff) 100%);
}

#sidebar .nav-link[data-target="dashboard"] {
    --sidebar-icon-color: #0ea5e9;
    --sidebar-icon-bg: #e0f2fe;
    --sidebar-icon-border: #bae6fd;
    --sidebar-icon-shadow: rgba(14, 165, 233, 0.2);
}

#sidebar .nav-link[data-target="live_monitor"] {
    --sidebar-icon-color: #22c55e;
    --sidebar-icon-bg: #dcfce7;
    --sidebar-icon-border: #bbf7d0;
    --sidebar-icon-shadow: rgba(34, 197, 94, 0.2);
}

#sidebar .nav-link[data-target*="scan"],
#sidebar .nav-link[data-target="scanning"] {
    --sidebar-icon-color: #475569;
    --sidebar-icon-bg: #f1f5f9;
    --sidebar-icon-border: #cbd5e1;
    --sidebar-icon-shadow: rgba(71, 85, 105, 0.16);
}

#sidebar .nav-link[data-target="assembly_report"],
#sidebar .nav-link[data-target="attendance_data"],
#sidebar .nav-link[data-target="summary"],
#sidebar .nav-link[data-target="gradebook"] {
    --sidebar-icon-color: #f59e0b;
    --sidebar-icon-bg: #fef3c7;
    --sidebar-icon-border: #fde68a;
    --sidebar-icon-shadow: rgba(245, 158, 11, 0.2);
}

#sidebar .nav-link[data-target="manual"],
#sidebar .nav-link[data-target="subjects"] {
    --sidebar-icon-color: #eab308;
    --sidebar-icon-bg: #fef9c3;
    --sidebar-icon-border: #fde68a;
    --sidebar-icon-shadow: rgba(234, 179, 8, 0.2);
}

#sidebar .nav-link[data-target="management"],
#sidebar .nav-link[data-target="teachers"],
#sidebar .nav-link[data-target*="history"] {
    --sidebar-icon-color: #3b82f6;
    --sidebar-icon-bg: #dbeafe;
    --sidebar-icon-border: #bfdbfe;
    --sidebar-icon-shadow: rgba(59, 130, 246, 0.2);
}

#sidebar .nav-link[data-target="manual_assembly"],
#sidebar .nav-link[data-target="manual_check"],
#sidebar .nav-link[data-target="settings"] {
    --sidebar-icon-color: #64748b;
    --sidebar-icon-bg: #f1f5f9;
    --sidebar-icon-border: #cbd5e1;
    --sidebar-icon-shadow: rgba(100, 116, 139, 0.16);
}

#sidebar .nav-link[data-target="enrollment"],
#sidebar .nav-link[data-target="my_profile"] {
    --sidebar-icon-color: #10b981;
    --sidebar-icon-bg: #d1fae5;
    --sidebar-icon-border: #a7f3d0;
    --sidebar-icon-shadow: rgba(16, 185, 129, 0.2);
}

#sidebar .nav-link[data-target="report"],
#sidebar .nav-link[data-target="student_card"],
#sidebar .nav-link[data-target="manage_exams"] {
    --sidebar-icon-color: #ef4444;
    --sidebar-icon-bg: #fee2e2;
    --sidebar-icon-border: #fecaca;
    --sidebar-icon-shadow: rgba(239, 68, 68, 0.2);
}

#sidebar .nav-link[data-target="randomizer"],
#sidebar .nav-link[data-target="scoring"],
#sidebar .nav-link[data-target="advisory_room"] {
    --sidebar-icon-color: #a855f7;
    --sidebar-icon-bg: #f3e8ff;
    --sidebar-icon-border: #e9d5ff;
    --sidebar-icon-shadow: rgba(168, 85, 247, 0.2);
}

#sidebar .nav-link[data-target="home_visit"] {
    --sidebar-icon-color: #14b8a6;
    --sidebar-icon-bg: #ccfbf1;
    --sidebar-icon-border: #99f6e4;
    --sidebar-icon-shadow: rgba(20, 184, 166, 0.2);
}

#sidebar nav a[onclick="performLogout()"] {
    --sidebar-icon-color: #ef4444;
    --sidebar-icon-bg: #fee2e2;
    --sidebar-icon-border: #fecaca;
    --sidebar-icon-shadow: rgba(239, 68, 68, 0.2);
    color: #b91c1c !important;
}

#sidebar li.mt-4 {
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #e2e8f0 !important;
}

@media (max-width: 767px) {
    #sidebar.app-sidebar {
        width: min(286px, 86vw) !important;
    }

    .sidebar-brand-panel {
        padding-top: 28px;
    }
}

@media (min-width: 768px) {
    #sidebar.app-sidebar {
        flex: 0 0 286px;
        width: 286px !important;
        transition: width 0.24s ease, flex-basis 0.24s ease, transform 0.3s ease;
    }

    #sidebar .sidebar-brand-panel {
        display: none;
    }

    #sidebar .sidebar-clock-wrap {
        padding-top: 18px;
    }

    #sidebar .nav-link,
    #sidebar nav a:not(.nav-link) {
        font-size: 14px;
    }

    body.on-dashboard #page-title .dashboard-title-brand {
        display: flex !important;
    }

    body.sidebar-compact #sidebar.app-sidebar {
        flex-basis: 56px;
        width: 56px !important;
        min-width: 56px;
        overflow-x: hidden;
        box-shadow: none;
    }

    body.sidebar-compact #sidebar .sidebar-compact-toggle-row {
        justify-content: center;
        padding: 8px 0 6px;
        border-bottom: 1px solid #e5e7eb;
    }

    body.sidebar-compact #sidebar .sidebar-mode-toggle {
        width: 40px;
        height: 40px;
        border-radius: 0;
        color: #6b7280;
        background: transparent;
    }

    body.sidebar-compact #sidebar .sidebar-clock-wrap {
        display: none;
    }

    body.sidebar-compact #sidebar nav {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    body.sidebar-compact #sidebar nav ul {
        padding: 0;
    }

    body.sidebar-compact #sidebar nav li {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    body.sidebar-compact #sidebar .nav-link,
    body.sidebar-compact #sidebar nav a:not(.nav-link) {
        --sidebar-icon-color: #71717a;
        --sidebar-icon-bg: transparent;
        --sidebar-icon-border: transparent;
        --sidebar-icon-shadow: rgba(0, 0, 0, 0);
        width: 100%;
        min-height: 48px;
        justify-content: center;
        gap: 0;
        padding: 4px 0 !important;
        border-radius: 0;
        font-size: 0;
        line-height: 0;
        color: transparent !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none;
    }

    body.sidebar-compact #sidebar .nav-link:hover,
    body.sidebar-compact #sidebar nav a:not(.nav-link):hover {
        background: #f3f4f6 !important;
        transform: none;
        box-shadow: none;
    }

    body.sidebar-compact #sidebar .nav-link.bg-white\/20 {
        background: #e0f2fe !important;
        box-shadow: inset 3px 0 0 #0ea5e9 !important;
    }

    body.sidebar-compact #sidebar .nav-link i,
    body.sidebar-compact #sidebar nav a:not(.nav-link) i {
        width: 44px !important;
        min-width: 44px;
        height: 44px;
        border: 0;
        border-radius: 8px;
        color: #737373 !important;
        background: transparent;
        box-shadow: none;
        font-size: 18px;
        transform: none;
    }

    body.sidebar-compact #sidebar .nav-link:hover i,
    body.sidebar-compact #sidebar nav a:not(.nav-link):hover i {
        color: #525252 !important;
        transform: none;
        box-shadow: none;
    }

    body.sidebar-compact #sidebar .nav-link.bg-white\/20 i {
        color: #0284c7 !important;
        background: transparent;
        box-shadow: none;
        transform: none;
    }

    body.sidebar-compact #sidebar li.mt-4 {
        margin-top: 8px !important;
        padding-top: 8px !important;
        border-top: 1px solid #e5e7eb !important;
    }
}
