* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background: #000; font-family: 'Montserrat', sans-serif; font-weight: 400; overflow: hidden; width: 100vw; height: 100vh; display: none; }

#iframe-wrapper { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; display: flex; justify-content: center; align-items: center; background: #000; }
iframe { width: 100vw; height: 56.25vw; max-height: 100vh; max-width: 177.78vh; border: none; pointer-events: none; }

.mouse-blocker { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 3; background: transparent; pointer-events: auto; }
body.panel-active-mode .mouse-blocker { display: none; }

.footer-banner { position: fixed; bottom: 0; left: 0; width: 100%; height: 80px; background-image: url('https://kydaoquan.com/view/footer1.PNG'); background-size: contain; background-repeat: no-repeat; background-position: center bottom; z-index: 5; pointer-events: none; display: block; }

.overlay { position: fixed; top: 0; left: 0; width: 100%; z-index: 10; display: flex; justify-content: space-between; padding: 0; pointer-events: none; transition: top 0.1s, padding 0.1s; }

.player { padding: 6px 20px !important; border-radius: 25px; font-size: 27px; color: #fff; text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.3); box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: transform 0.1s, opacity 0.1s, padding 0.1s; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.red { background: linear-gradient(135deg, rgba(255,60,60,0.8), rgba(150,0,0,0.8)); }
.blue { background: linear-gradient(135deg, rgba(0,45,140,0.8), rgba(0,10,70,0.8)); }

#tournament-container { position: fixed; top: 1px; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none; display: none; }
#tournament-display { color: #FFD700; font-size: 20px; font-weight: 600; text-shadow: 0 2px 10px rgba(255,215,0,0.5), 0 0 20px rgba(0,0,0,0.8); background: rgba(0,0,0,0.85); padding: 5px 20px; border-radius: 30px; border: 1px solid rgba(255,215,0,0.5); white-space: nowrap; }
#btnResetPos:hover {
    background: rgba(255, 152, 0, 0.3) !important;
    color: #fff !important;
}
#extra-info-container { 
    position: fixed; 
    left: 0; 
    width: 100%; 
    z-index: 10; 
    pointer-events: none; 
    display: none; 
    overflow: hidden; 
    background: rgba(0, 0, 0, 0.4); 
    padding: 1px 0;
    transition: bottom 0.2s ease-out; 
}
#extra-info-display { 
    color: #FFD700; 
    font-size: 14px; 
    font-weight: 500; 
    text-align: left;
    white-space: nowrap;
    display: inline-block;
    padding-left: 100%; 
    animation: marquee-effect 45s linear infinite; 
}

@keyframes marquee-effect {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

.obs-image { 
    position: fixed; 
    max-width: 130px; 
    max-height: 130px; 
    z-index: 85; 
    object-fit: contain; 
    top: 120px; 
    left: 20px;
    pointer-events: none; 
    user-select: none;
    -webkit-user-drag: none;
}
body.panel-active-mode .obs-image { 
    pointer-events: auto !important; 
    cursor: move; 
    border: 1px dashed rgba(0, 230, 118, 0.5);
    background: rgba(0,0,0,0.2);
    max-width: 130px;
    max-height: 130px;
}

#custom-toast {
    position: fixed;
    top: -70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid #00e676;
    color: #fff;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.5px;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 230, 118, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}
#custom-toast.show { top: 25px; }
#custom-toast.error-toast { border-color: #ff3d00; box-shadow: 0 10px 30px rgba(255, 61, 0, 0.2); }

.panel { 
    position: fixed; 
    bottom: 95px; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 95%; 
    max-width: 680px; 
    max-height: calc(100vh - 110px); 
    overflow-y: auto; 
    background: rgba(20, 24, 33, 0.96); 
    backdrop-filter: blur(14px); 
    -webkit-backdrop-filter: blur(14px); 
    padding: 8px 12px; 
    border-radius: 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 5px; 
    z-index: 100; 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.8); 
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s; 
}

.panel::-webkit-scrollbar, textarea::-webkit-scrollbar {
    width: 5px;
}
.panel::-webkit-scrollbar-track, textarea::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.panel::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.panel::-webkit-scrollbar-thumb:hover, textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 230, 118, 0.5);
}

.panel.hidden-mode { transform: translate(-50%, calc(100% + 120px)); opacity: 0; pointer-events: none; }

.btn-toggle-panel { position: fixed; bottom: 15px; right: 15px; z-index: 101; padding: 10px 16px; border-radius: 20px; background: #00e676; color: #000; font-size: 12px; font-weight: 600; cursor: pointer; border: none; box-shadow: 0 4px 15px rgba(0,230,118,0.3); font-family: 'Montserrat', sans-serif; text-transform: uppercase; transition: all 0.2s; display: none; }
.btn-toggle-panel:hover { transform: scale(1.05); background: #fff; }
.btn-toggle-panel.active-btn { background: #ff3d00; color: #fff; box-shadow: 0 4px 15px rgba(255,61,0,0.3); }

input[type="text"], textarea { 
    background: rgba(255, 255, 255, 0.04); 
    color: #fff; 
    padding: 6px 10px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    border-radius: 8px; 
    outline: none; 
    width: 100%; 
    font-family: 'Montserrat', sans-serif; 
    font-size: 11px; 
    font-weight: 300; 
    letter-spacing: 0.3px;
    transition: all 0.2s; 
}
input:focus, textarea:focus { border-color: #00b0ff; background: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 3px rgba(0,176,255,0.15); }

.image-manager-box { background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); padding: 6px 8px; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.image-manager-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; gap: 10px; }
.image-manager-header span { font-size: 10px; color: #FFD700; font-weight: 500; letter-spacing: 0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-toggle-images-wrapper { font-size: 10px; color: #999; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05); padding: 3px 8px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.image-rows-container { display: flex; flex-direction: column; gap: 4px; max-height: 0; overflow: hidden; transition: max-height 0.3s cubic-bezier(0.25, 1, 0.5, 1); }
.image-rows-container.show-area { max-height: 600px; }

.image-row { display: flex; gap: 5px; align-items: center; background: rgba(0,0,0,0.2); padding: 5px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.03); } 
.img-preview-slot { width: 26px; height: 26px; border-radius: 4px; object-fit: contain; background: #000; border: 1px solid rgba(255,255,255,0.1); }
.btn-add-image { background: rgba(255,215,0,0.05); color: #FFD700; border: 1px dashed rgba(255,215,0,0.3); padding: 6px; border-radius: 6px; font-size: 10px; font-weight: 500; cursor: pointer; text-align: center; margin-top: 2px; transition: all 0.2s; }
.btn-add-image:hover { background: rgba(255,215,0,0.1); }

.img-toggle-label { display: flex; align-items: center; gap: 4px; color: #bbb; font-size: 10px; font-weight: 500; cursor: pointer; user-select: none; padding-right: 2px; }
.img-toggle-label input[type="checkbox"] { width: 13px; height: 13px; accent-color: #00e676; cursor: pointer; }

.input-inline-row { display: flex; gap: 5px; width: 100%; align-items: center; }
.input-inline-row input, .input-inline-row textarea { flex: 1; }

.btn-custom-toggle { 
    width: 120px !important; 
    min-width: 120px !important; 
    flex-shrink: 0; 
    padding: 6px 0; 
    background: rgba(255,255,255,0.04); 
    color: #999; 
    text-align: center; 
    border-radius: 8px; 
    font-size: 10px; 
    font-weight: 500; 
    cursor: pointer; 
    border: 1px solid rgba(255,255,255,0.05); 
    transition: all 0.2s; 
    user-select: none; 
    white-space: nowrap; 
}
.btn-custom-toggle.active-toggle { background: rgba(0, 176, 255, 0.15); color: #00b0ff; border-color: rgba(0, 176, 255, 0.3); font-weight: 600; }

#btnSwap { background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08); color:#fff; padding:6px 10px; border-radius:8px; cursor:pointer; font-size:11px; }

.footer-control-row { display: flex; gap: 5px; width: 100%; }
.settings-toggle { flex: 1; color: #bbb; font-size: 10px; font-weight: 500; cursor: pointer; text-align: center; padding: 6px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.05); transition: all 0.2s; }
.settings-toggle:hover { background: rgba(255,255,255,0.08); }

.advanced-settings { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; display: flex; flex-direction: column; gap: 4px; }
.slider-group { background: rgba(0,0,0,0.2); padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.03); display: flex; flex-direction: column; gap: 2px; }

.slider-group label { color: #FFD700; font-size: 10px; font-weight: 400; display: flex; justify-content: space-between; width: 100%; margin-bottom: 2px; }
.slider-group input[type="range"] { width: 100%; accent-color: #00b0ff; background: rgba(255,255,255,0.1); height: 3px; border-radius: 2px; outline: none; margin: 3px 0; }

.btn-action { padding: 8px; border: none; border-radius: 8px; background: linear-gradient(135deg, #00e676, #00b0ff); color: #000; font-weight: 600; cursor: pointer; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,230,118,0.15); font-family: 'Montserrat', sans-serif; width: 100%; }
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(0,176,255,0.25); }
.btn-action:disabled { background: #374151; color: #9ca3af; cursor: not-allowed; box-shadow: none; }

.panel-nav-links { display: flex; justify-content: space-between; align-items: center; margin-top: 1px; padding: 0 2px; }
.btn-home, .btn-logout { color: #888; text-decoration: none; padding: 2px; font-size: 10px; font-weight: 400; transition: color 0.2s; letter-spacing: 0.3px; cursor: pointer; background: none; border: none; font-family: 'Montserrat', sans-serif; }
.btn-home:hover { color: #fff; }
.btn-logout:hover { color: #ff3d00; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 10px;
    margin: -8px -12px 6px -12px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 12px 0 0;
    cursor: grab;
    user-select: none;
}
.panel-header:active {
    cursor: grabbing;
}
.panel-title {
    color: #00e676;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.btn-close-panel {
    color: #ff3d00;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0 4px;
}
.btn-close-panel:hover {
    transform: scale(1.3);
}

.panel.is-dragged {
    transform: none !important;
    bottom: auto !important;
    margin: 0 !important;
    transition: opacity 0.3s !important;
}

.panel.hidden-mode { 
    opacity: 0; 
    pointer-events: none; 
    transform: scale(0.9) !important; 
}