:root{
    --accent:#f0d978;
    --panel:rgba(6,25,16,.88);
}

html,body{
    width:100%;
    height:100%;
    min-height:100%;
    margin:0;
    overflow:hidden;
    background:#020604;
}

body{
    font-family:Arial,Helvetica,sans-serif;
    color:#fff;
}

.tv-app{
    position:fixed;
    inset:0;
    width:100vw;
    height:100vh;
    min-height:100vh;
    overflow:hidden;
    background:#020604;
}

.screen{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    min-height:100%;
    display:none;
    align-items:center;
    justify-content:center;
    padding:clamp(22px,4vw,70px);
    overflow:hidden;
    text-align:center;
    background:radial-gradient(circle at 50% 15%,#17452f 0,#071b11 44%,#020604 100%);
}

.screen.active{
    display:flex;
}

.boot-screen,
.pair-screen{
    flex-direction:column;
    gap:18px;
}

.boot-screen h1,
.pair-screen h1{
    margin:0;
    font-size:clamp(34px,5vw,86px);
    line-height:1.05;
    letter-spacing:.05em;
}

.boot-screen p,
.pair-screen p{
    margin:0;
    max-width:900px;
    color:#c8d4cd;
    font-size:clamp(16px,1.8vw,30px);
}

.loader{
    width:clamp(58px,7vw,110px);
    aspect-ratio:1;
    border:clamp(5px,.65vw,10px) solid rgba(255,255,255,.16);
    border-top-color:var(--primary,#28c879);
    border-radius:50%;
    animation:tv-spin .85s linear infinite;
}

@keyframes tv-spin{to{transform:rotate(360deg)}}

.brand-icon{
    width:clamp(82px,10vw,150px);
    aspect-ratio:1;
    display:grid;
    place-items:center;
    border:2px solid var(--gold,#d8c875);
    border-radius:50%;
    color:var(--gold,#d8c875);
    font-size:clamp(36px,5vw,76px);
    background:rgba(0,0,0,.25);
}

.pair-code{
    min-width:min(84vw,760px);
    padding:clamp(18px,2.2vw,34px) clamp(24px,4vw,64px);
    border:2px solid var(--gold,#d8c875);
    border-radius:22px;
    background:rgba(0,0,0,.35);
    color:var(--gold,#d8c875);
    font-size:clamp(44px,8vw,132px);
    font-weight:900;
    letter-spacing:.18em;
    line-height:1;
    font-variant-numeric:tabular-nums;
}

.pair-screen small{
    color:#aebbb3;
    font-size:clamp(14px,1.4vw,24px);
}

.qr-box{
    width:clamp(190px,24vw,340px);
    aspect-ratio:1;
    display:grid;
    place-items:center;
    overflow:hidden;
    border-radius:14px;
    background:#fff;
}

.qr-box img,
.qr-box canvas{
    display:block!important;
    width:100%!important;
    height:100%!important;
    object-fit:contain;
}
#roomQr,
#expiredQr {
    width: min(42vh, 420px);
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 14px;
    margin: 20px auto;

    overflow: hidden;
    border-radius: 18px;
    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(255, 215, 90, .75),
        0 20px 60px rgba(0, 0, 0, .45);
}

#roomQr canvas,
#roomQr img,
#expiredQr canvas,
#expiredQr img {
    display: block;

    width: 100% !important;
    height: 100% !important;

    max-width: none !important;
    max-height: none !important;

    object-fit: contain;

    /* Mencegah QR menjadi blur saat diperbesar */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#roomQr,
#expiredQr {
    background: #000 !important;
    padding: 18px !important;
    border-radius: 12px;
}

#roomQr img,
#expiredQr img {
    background: #000 !important;
    display: block !important;
}

/* Canvas qrcode.js biasanya hanya sumber gambar dan disembunyikan */
#roomQr canvas,
#expiredQr canvas {
    display: none !important;
}
.tv-app.theme-modern{--accent:#f0d978}
.tv-app.theme-classic{--accent:#ffef8f}

.theme-classic .screen{
    background:linear-gradient(rgba(0,34,19,.82),rgba(0,13,8,.94)),repeating-linear-gradient(90deg,rgba(255,255,255,.025) 0 1px,transparent 1px 70px),#04150d;
}
.theme-classic.qr-frame{
    border-radius:10px;
    border-width:4px;
    box-shadow:inset 0 0 0 3px #473c14,0 0 25px rgba(255,239,143,.2);
}

.theme-classic .tv-countdown,
.theme-classic .now-playing-card{
    border-radius:7px;
    border-color:#e1d177;
    background:linear-gradient(#24211d,#050505);
}

.tv-time-warning{
    position:fixed;
    z-index:9999;
    top:24px;
    left:50%;
    transform:translate(-50%,-140%);
    display:flex;
    align-items:center;
    gap:18px;
    padding:14px 22px;
    border:1px solid rgba(255,255,255,.25);
    border-radius:16px;
    background:rgba(140,29,42,.94);
    box-shadow:0 18px 45px rgba(0,0,0,.42);
    opacity:0;
    transition:.25s ease;
}
.tv-time-warning.show{transform:translate(-50%,0);opacity:1}

/* Center alignment fix */
button,.header-icon,.player-strip button,.duration-button,.stop-session-button,
.search-form button,.preview-footer button,.source-tabs button,.primary-button,.secondary-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    line-height:1.15;
}
button i,.header-icon i,.player-strip button i,.search-form button i{line-height:1;pointer-events:none}

@media (max-aspect-ratio:4/3){
    .screen{padding:28px}
    .pair-code{min-width:min(90vw,700px)}
}
.screen-dim-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;

    display: block;
    visibility: hidden;
    opacity: 0;

    background: #000;
    pointer-events: none;

    transition:
        opacity .18s ease,
        visibility .18s ease;
}

.screen-dim-overlay.show {
    visibility: visible;
    opacity: 1;
}

.tv-mic-status {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;

    padding: 12px 18px;
    border-radius: 30px;

    color: #fff;
    background: rgba(0, 0, 0, .78);
    border: 1px solid rgba(255,255,255,.25);

    font-size: 16px;
    font-weight: 600;

    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;

    transition: .25s ease;
}

.tv-mic-status.show {
    opacity: 1;
    transform: translateY(0);
}