html,
body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}
body {
    margin: 0;
    min-height: 100vh;
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-color: #2c68ee;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3CradialGradient id='a' gradientUnits='objectBoundingBox'%3E%3Cstop offset='0' stop-color='%23FAFDFF'/%3E%3Cstop offset='1' stop-color='%232C68EE'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='0' y1='750' x2='1550' y2='750'%3E%3Cstop offset='0' stop-color='%2393b3f7'/%3E%3Cstop offset='1' stop-color='%232C68EE'/%3E%3C/linearGradient%3E%3Cpath id='s' fill='url(%23b)' d='M1549.2 51.6c-5.4 99.1-20.2 197.6-44.2 293.6c-24.1 96-57.4 189.4-99.3 278.6c-41.9 89.2-92.4 174.1-150.3 253.3c-58 79.2-123.4 152.6-195.1 219c-71.7 66.4-149.6 125.8-232.2 177.2c-82.7 51.4-170.1 94.7-260.7 129.1c-90.6 34.4-184.4 60-279.5 76.3C192.6 1495 96.1 1502 0 1500c96.1-2.1 191.8-13.3 285.4-33.6c93.6-20.2 185-49.5 272.5-87.2c87.6-37.7 171.3-83.8 249.6-137.3c78.4-53.5 151.5-114.5 217.9-181.7c66.5-67.2 126.4-140.7 178.6-218.9c52.3-78.3 96.9-161.4 133-247.9c36.1-86.5 63.8-176.2 82.6-267.6c18.8-91.4 28.6-184.4 29.6-277.4c0.3-27.6 23.2-48.7 50.8-48.4s49.5 21.8 49.2 49.5c0 0.7 0 1.3-0.1 2L1549.2 51.6z'/%3E%3Cg id='g'%3E%3Cuse href='%23s' transform='scale(0.12) rotate(60)'/%3E%3Cuse href='%23s' transform='scale(0.2) rotate(10)'/%3E%3Cuse href='%23s' transform='scale(0.25) rotate(40)'/%3E%3Cuse href='%23s' transform='scale(0.3) rotate(-20)'/%3E%3Cuse href='%23s' transform='scale(0.4) rotate(-30)'/%3E%3Cuse href='%23s' transform='scale(0.5) rotate(20)'/%3E%3Cuse href='%23s' transform='scale(0.6) rotate(60)'/%3E%3Cuse href='%23s' transform='scale(0.7) rotate(10)'/%3E%3Cuse href='%23s' transform='scale(0.835) rotate(-40)'/%3E%3Cuse href='%23s' transform='scale(0.9) rotate(40)'/%3E%3Cuse href='%23s' transform='scale(1.05) rotate(25)'/%3E%3Cuse href='%23s' transform='scale(1.2) rotate(8)'/%3E%3Cuse href='%23s' transform='scale(1.333) rotate(-60)'/%3E%3Cuse href='%23s' transform='scale(1.45) rotate(-30)'/%3E%3Cuse href='%23s' transform='scale(1.6) rotate(10)'/%3E%3C/g%3E%3C/defs%3E%3Cg transform='rotate(0 0 0)'%3E%3Cg transform='rotate(0 0 0)'%3E%3Ccircle fill='url(%23a)' r='3000'/%3E%3Cg opacity='0.5'%3E%3Ccircle fill='url(%23a)' r='2000'/%3E%3Ccircle fill='url(%23a)' r='1800'/%3E%3Ccircle fill='url(%23a)' r='1700'/%3E%3Ccircle fill='url(%23a)' r='1651'/%3E%3Ccircle fill='url(%23a)' r='1450'/%3E%3Ccircle fill='url(%23a)' r='1250'/%3E%3Ccircle fill='url(%23a)' r='1175'/%3E%3Ccircle fill='url(%23a)' r='900'/%3E%3Ccircle fill='url(%23a)' r='750'/%3E%3Ccircle fill='url(%23a)' r='500'/%3E%3Ccircle fill='url(%23a)' r='380'/%3E%3Ccircle fill='url(%23a)' r='250'/%3E%3C/g%3E%3Cg transform='rotate(0 0 0)'%3E%3Cuse href='%23g' transform='rotate(10)'/%3E%3Cuse href='%23g' transform='rotate(120)'/%3E%3Cuse href='%23g' transform='rotate(240)'/%3E%3C/g%3E%3Ccircle fill-opacity='0.1' fill='url(%23a)' r='3000'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-attachment: fixed;
    background-size: cover;
}
.btn:focus,
.btn:active,
.btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
#app-shell {
    width: 400px;
    max-width: 100%;
    height: calc(100dvh - 30px);
    max-height: calc(100dvh - 30px);
    min-height: 480px;
    background: #ffffed;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    border: 3px solid #2b4865;
    overflow: hidden;
    container-type: size;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}
#app-header {
    padding: .75rem 1rem;
    border-bottom: 2px dotted rgba(0, 0, 0, 0.8);
    text-align: center;
    flex-shrink: 0;
    position: relative;
}
#logo {
    width: 110px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
}
#btnFullscreen {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2b4865 !important;
    transition: opacity .15s;
    font-size: 18px;
}
#btnFullscreen:focus, #btnFullscreen:active { outline: none; }
#btnFullscreen:hover { opacity: .8; color: #2b4865 !important; }
#btnFullscreen:active { transform: scale(0.9); }
#app-main {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.screen {
    height: 100%;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.screen.d-none {
    display: none !important;
}
.screen-nav {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}
.screen-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 15px;
    -webkit-overflow-scrolling: touch;
}
.screen-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}
.screen-footer {
    flex-shrink: 0;
    border-top: 2px dashed rgba(43, 72, 101, 0.35);
    padding: 12px 15px;
    background: transparent;
    margin-top: auto;
}
.screen-content::-webkit-scrollbar { width: 3px; }
.screen-content::-webkit-scrollbar-track { background: transparent; }
.screen-content::-webkit-scrollbar-thumb {
    background: rgba(44, 104, 238, 0.25);
    border-radius: 8px;
}
.screen-content::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 104, 238, 0.45);
}
.aturan {
    font-size: 0.97rem;
    color: #475569;
    line-height: 1.65;
}

/* ===== NEXT / PREV BUTTONS ===== */
.next-btn {
    width: 120px;
    padding: 9px 20px;
    border-radius: 999px;
    line-height: 1.3;
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c68ee 0%, #1e54cc 100%);
    color: #fff;
    border: none;
    text-shadow: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 14px rgba(44, 104, 238, 0.35), 0 2px 6px rgba(44, 104, 238, 0.2);
    cursor: pointer;
}
.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(44, 104, 238, 0.45), 0 4px 10px rgba(44, 104, 238, 0.25);
    background: linear-gradient(135deg, #3b76f6 0%, #2c68ee 100%);
    color: #fff;
}
.next-btn:active {
    transform: scale(0.95) translateY(0);
    box-shadow: 0 2px 8px rgba(44, 104, 238, 0.3);
}
.prev-btn {
    line-height: 1;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    border-width: 0px;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
}
.prev-btn:hover {
    color: #2c68ee;
    background: rgba(44, 104, 238, 0.08);
}
.prev-btn:active { transform: scale(0.9); }

/* ===== PILIHAN WAKTU ===== */
#pilihan-waktu {
    margin: 16px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
#pilihan-waktu button {
    padding: 8px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    background: #f1f5f9;
    color: #334155;
    border: 1.5px solid #e2e8f0;
    text-shadow: none;
    transition: all 0.2s;
    cursor: pointer;
}
#pilihan-waktu button:hover {
    background: rgba(44, 104, 238, 0.08);
    border-color: rgba(44, 104, 238, 0.35);
    color: #2c68ee;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(44, 104, 238, 0.15);
}
.waktu-dipilih {
    background: linear-gradient(135deg, #2c68ee 0%, #1e54cc 100%) !important;
    border-color: #1e54cc !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(44, 104, 238, 0.35) !important;
    text-shadow: none !important;
    transform: translateY(-1px) !important;
}
#hasil-pilihan-waktu button {
    padding: 5px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
    background: #f1f5f9;
    color: #334155;
    border: 1.5px solid #e2e8f0;
    text-shadow: none;
    transition: all 0.2s;
    cursor: pointer;
    margin: 2px;
}
#hasil-pilihan-waktu button:hover,
#hasil-pilihan-waktu button.waktu-dipilih {
    background: linear-gradient(135deg, #2c68ee 0%, #1e54cc 100%) !important;
    border-color: #1e54cc !important;
    color: #fff !important;
}

/* ===== HITUNG MUNDUR ===== */
#hitung-mundur { position: relative; }
#mundur {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateY(-50%) translateX(-50%);
    font-size: 80px;
    font-weight: bold;
}

/* ===== TAMPIL NOMOR ===== */
#tampil-nomor {
    position: relative;
    flex-grow: 1;
    font-weight: bold;
    padding: 0;
    margin: 0px 0px 20px 0;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
#tampil-nomor p {
    position: absolute;
    margin: 0;
    left: 50%;
    transform: translateX(-50%);
    transition: 0.3s;
}
#tampil-nomor p:nth-of-type(1) { top: 0; font-size: 25px; opacity: 0.5; }
#tampil-nomor p:nth-of-type(2) { top: 33.33%; transform: translateX(-50%) translateY(-50%); font-size: 65px; margin: 0; }
#tampil-nomor p:nth-of-type(3) { top: 66.66%; transform: translateX(-50%) translateY(-50%); font-size: 65px; }
#tampil-nomor p:nth-of-type(4) { top: 100%; font-size: 25px; transform: translateX(-50%) translateY(-100%); opacity: 0.5; }
#tampil-nomor p:nth-of-type(5) { top: 100%; font-size: 25px; transform: translateX(-50%); opacity: 0; z-index: -1; }
#tampil-nomor div:nth-of-type(1) { position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); transition: 0.3s; }
#tampil-nomor div:nth-of-type(2) { position: absolute; left: 50%; top: 60%; transform: translateX(-50%) translateY(-50%); opacity: 0; transition: 0.3s; }

/* ===== TOMBOL NOMOR ===== */
#tombol-nomor {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 8px;
    padding: 0 4px;
}
#tombol-nomor div {
    background-color: #ee5253;
    border-width: 1px 1px 5px 1px;
    border-style: solid;
    border-color: rgba(47, 54, 64, 1);
    border-radius: 20px;
    padding: 6px 20px;
    font-size: 30px;
    text-align: center;
    font-weight: bold;
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    cursor: pointer;
    transition: 0.15s ease;
}
#tombol-nomor div:hover {
    background-color: #ff6b6b;
}
#tombol-nomor div:active {
    opacity: 0.85;
    border-width: 1px 1px 2px 1px;
    transform: translateY(3px);
}
#tombol-nomor p {
    text-align: center; margin: 0; padding: 0;
    font-size: 36px; font-weight: bold;
    cursor: pointer; transition: 0.2s;
    color: #64748b;
}
#tombol-nomor p:active { transform: scale(80%); }
#tombol-nomor p i { vertical-align: middle; }
#tombol-kembali { opacity: 0.55; }
#tombol-kembali:hover { opacity: 1; color: #ef4444; }
#tombol-selesai { color: #10b981; }
#tombol-selesai:hover { color: #059669; }

/* ===== TOMBOL TES (MODAL) ===== */
.tombol-tes {
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 700;
    border-width: 2px;
    border-style: solid;
    transition: all 0.2s;
}
#tombol-tes-batal {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.07);
    color: #ef4444;
}
#tombol-tes-batal:hover { background: rgba(239, 68, 68, 0.14); border-color: #ef4444; }
#tombol-tes-tidak-batal {
    border-color: rgba(44, 104, 238, 0.4);
    background: rgba(44, 104, 238, 0.08);
    color: #2c68ee;
}
#tombol-tes-tidak-batal:hover { background: rgba(44, 104, 238, 0.16); border-color: #2c68ee; }

/* ===== TABEL HASIL ===== */
#tabel-hasil {
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 14px;
    background: #f8fafc;
}
#tabel-hasil p { margin: 0; }
#hasil-persen-benar {
    font-weight: 800;
    font-size: 50px;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #2c68ee 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    line-height: 1;
}
#tombol-ulangi-tes { width: auto; }
.hasil-poin {
    padding: 4px 10px !important;
    border-radius: 8px;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

/* ===== CONTAINER BREAKPOINTS ===== */
@container (max-height: 600px) {
    #tombol-nomor { padding: 0px 20px; gap: 5px 20px; }
    #tombol-nomor div { font-size: 22px; border-radius: 12px; padding: 6px 16px; }
    #tombol-nomor p { font-size: 28px; }
    #tampil-nomor { margin: -10px 0px 10px 0; }
    #tampil-nomor p:nth-of-type(1) { font-size: 20px; }
    #tampil-nomor p:nth-of-type(2) { font-size: 40px; top: 30%; transform: translateX(-50%) translateY(-50%); }
    #tampil-nomor p:nth-of-type(3) { font-size: 40px; top: 68%; transform: translateX(-50%) translateY(-50%); }
    #tampil-nomor p:nth-of-type(4) { font-size: 20px; }
}

/* ===== FLASH EFFECT ===== */
#tombol-nomor div.flash {
    box-shadow: 0 0 0 3px rgba(44, 104, 238, 0.45);
    transform: translateY(3px);
    transition: 0.08s;
}

/* ===== USER MENU (STARTUP-GRADE DROPDOWN) ===== */
#userMenu {
    width: 290px;
    padding: 10px;
    border-radius: 18px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    position: absolute;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    margin-top: 0 !important;
    transform: none !important;
    animation: fadeInMenu .18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInMenu {
    from { opacity: 0; }
    to { opacity: 1; }
}
.menu-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 12px 10px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}
.avatar-wrap { position: relative; flex-shrink: 0; }
.menu-avatar {
    width: 44px; height: 44px;
    object-fit: cover; border-radius: 50%;
    border: 2px solid #2c68ee;
    box-shadow: 0 2px 8px rgba(44, 104, 238, 0.2);
}
.membership-corner {
    position: absolute;
    width: 18px; height: 18px;
    right: -4px; bottom: -4px;
    background: #fff; border-radius: 50%; padding: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.menu-user { flex: 1; min-width: 0; }
.menu-name {
    color: #1e293b;
    font-size: .92rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.menu-username {
    color: #64748b;
    font-size: .74rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#userMenu .dropdown-divider {
    margin: .55rem 0;
    border-color: #f1f5f9;
}
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 2px;
}
.menu-tile {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    text-decoration: none;
    color: #334155;
    font-size: .82rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all .18s ease;
    font-weight: 600;
}
.menu-tile:hover {
    color: #2c68ee;
    background: rgba(44, 104, 238, 0.08);
    border-color: rgba(44, 104, 238, 0.3);
    transform: translateY(-1px);
}
.menu-tile:active { transform: scale(.98); }
.bromax-tile {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.06) 100%);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #b45309;
}
.bromax-tile img { width: 16px; height: 16px; }
.bromax-tile:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.12) 100%);
    border-color: #f59e0b;
    color: #92400e;
}
.logout-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ef4444 !important;
    font-weight: 600;
    font-size: 0.82rem;
    border-radius: 10px;
    padding: 8px 12px;
    transition: .18s;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #dc2626 !important;
}
#avatarImg {
    border-radius: 50%;
    border: 2px solid rgba(43, 72, 101, 0.2);
    transition: .2s;
    cursor: pointer;
}
#avatarImg:hover { transform: scale(1.05); }

/* Dark mode userMenu */
#app-shell.theme-dark #userMenu {
    background: #181d28;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}
#app-shell.theme-dark .menu-profile {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}
#app-shell.theme-dark .menu-name { color: #f1f5f9; }
#app-shell.theme-dark .menu-username { color: #94a3b8; }
#app-shell.theme-dark #userMenu .dropdown-divider { border-color: rgba(255, 255, 255, 0.08); }
#app-shell.theme-dark .menu-tile {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}
#app-shell.theme-dark .menu-tile:hover {
    background: rgba(44, 104, 238, 0.2);
    border-color: rgba(44, 104, 238, 0.4);
    color: #fff;
}

/* ===== CUSTOM WAKTU INPUT ===== */
#custom-waktu-wrap { margin-top: 12px; }
#custom-waktu-input {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid #e2e8f0; border-radius: 14px;
    font-size: 1.05rem; font-weight: 600; text-align: center;
    background: #f8fafc; color: #1e293b; outline: none; transition: .2s;
}
#custom-waktu-input:focus {
    border-color: #2c68ee;
    box-shadow: 0 0 0 3px rgba(44, 104, 238, .15);
    background: #fff;
}
#custom-waktu-input::placeholder { color: #94a3b8; font-weight: 400; }
.custom-label { display: block; margin-bottom: 6px; font-size: 0.84rem; font-weight: 600; color: #475569; }