:root {
    --bg: #090a0d;
    --panel: #14171d;
    --panel-2: #1b2028;
    --line: rgba(255, 255, 255, 0.12);
    --text: #f7f8fb;
    --muted: #9da6b5;
    --primary: #ff2d68;
    --primary-2: #ff6b35;
    --cyan: #00d4ff;
    --green: #35e27b;
    --warning: #ffd166;
    --danger: #ff4d4f;
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: "Kanit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    user-select: none;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

[hidden] {
    display: none !important;
}

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, rgba(255, 45, 104, 0.18), transparent 38%), #050506;
}

.login-panel {
    width: min(420px, 100%);
    display: grid;
    gap: 14px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(20, 23, 29, 0.92);
    box-shadow: var(--shadow);
}

.login-logo {
    width: 94px;
    height: 94px;
    object-fit: contain;
    justify-self: center;
    filter: drop-shadow(0 0 16px rgba(255, 45, 104, 0.28));
}

.login-panel h1 {
    margin: 0 0 4px;
    text-align: center;
    font-size: 1.85rem;
    line-height: 1.15;
}

.login-panel label,
.admin-form,
.search-form {
    display: grid;
    gap: 7px;
}

.login-panel label span {
    color: var(--muted);
    font-size: 0.92rem;
}

.login-panel input,
.search-form input,
.admin-form input,
.speed-select {
    width: 100%;
    min-height: 44px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    background: rgba(0, 0, 0, 0.26);
    padding: 0 13px;
}

.login-panel input:focus,
.search-form input:focus,
.admin-form input:focus,
.speed-select:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.16);
}

.form-error {
    min-height: 22px;
    margin: 0;
    color: var(--danger);
    font-size: 0.92rem;
}

.primary-action,
.secondary-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.primary-action {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    font-weight: 700;
}

.secondary-action {
    background: rgba(255, 255, 255, 0.11);
    border: 1px solid var(--line);
}

.primary-action:hover,
.secondary-action:hover,
.icon-btn:hover,
.round-btn:hover,
.play-btn:hover,
.sfx-btn:hover {
    filter: brightness(1.08);
}

.primary-action:active,
.secondary-action:active,
.icon-btn:active,
.round-btn:active,
.play-btn:active,
.sfx-btn:active {
    transform: translateY(1px);
}

.app-shell {
    width: 100vw;
    height: 100svh;
    position: relative;
    display: block;
    background: #000;
}

.stage {
    position: relative;
    min-width: 0;
    width: 100%;
    height: 100svh;
    overflow: hidden;
    background: #000;
}

.screen-display .login-screen {
    display: none !important;
}

.stage-header,
.now-playing,
.progress-panel,
.control-bar,
.marquee-container {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.stage.ui-hidden .stage-header,
.stage.ui-hidden .now-playing,
.stage.ui-hidden .marquee-container {
    opacity: 0;
    transform: translateY(-16px);
    pointer-events: none;
}

.stage.ui-hidden .progress-panel,
.stage.ui-hidden .control-bar {
    opacity: 0;
    transform: translateY(26px);
    pointer-events: none;
}

.corner-logo {
    position: absolute;
    z-index: 15;
    top: calc(max(12px, env(safe-area-inset-top)) + 6px);
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(14px);
    pointer-events: none;
}

.corner-logo img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.corner-logo strong,
.corner-logo span {
    display: block;
    line-height: 1.05;
}

.corner-logo strong {
    font-size: 0.92rem;
}

.corner-logo span {
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.74rem;
}

.marquee-container {
    position: absolute;
    z-index: 12;
    top: 0;
    left: 0;
    right: 0;
    height: 35px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.86);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    pointer-events: none;
}

.marquee-container.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.marquee-content {
    display: inline-block;
    min-width: 100%;
    white-space: nowrap;
    color: #fff;
    padding-left: 100%;
    text-shadow: 0 0 7px rgba(0, 0, 0, 0.9);
    animation: marquee-scroll 25s linear infinite;
}

.txt-playing {
    color: var(--green);
    font-weight: 700;
    text-shadow: 0 0 12px rgba(53, 226, 123, 0.75);
}

.txt-next {
    color: var(--cyan);
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.75);
}

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

.player-layer,
#youtube-player,
.player-layer iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.player-layer {
    background: #000;
}

.player-layer iframe {
    border: 0;
    pointer-events: none;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 14px;
    padding: 30px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(9, 10, 13, 0.28), rgba(9, 10, 13, 0.78)),
        #08090b;
}

.empty-state.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.empty-state img {
    width: min(170px, 42vw);
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 0 24px rgba(0, 212, 255, 0.2));
}

.empty-state h2 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.1;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

.quick-recommend {
    width: min(860px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.stage-header {
    position: absolute;
    z-index: 4;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: calc(max(14px, env(safe-area-inset-top)) + 28px) 18px 14px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.stage-header > * {
    pointer-events: auto;
}

.brand-mark {
    display: none;
}

.brand-mark img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.brand-mark strong,
.brand-mark span {
    display: block;
    line-height: 1.05;
}

.brand-mark strong {
    font-size: 1.06rem;
}

.brand-mark span,
.session-tools span {
    color: var(--muted);
    font-size: 0.88rem;
}

.session-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn,
.round-btn,
.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    background: rgba(20, 23, 29, 0.82);
    border: 1px solid var(--line);
    backdrop-filter: blur(14px);
    transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.header-settings-btn {
    color: var(--cyan);
    border-color: rgba(0, 212, 255, 0.34);
}

.now-playing {
    position: absolute;
    z-index: 4;
    top: 110px;
    left: 18px;
    width: min(532px, calc(100% - 36px));
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(16px);
}

.now-playing p,
.now-playing h1 {
    margin: 0;
}

.now-playing p {
    color: var(--muted);
    font-size: 0.6rem;
}

.now-playing h1 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(0.74rem, 1.54vw, 1.09rem);
    line-height: 1.25;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 4px rgba(157, 166, 181, 0.15);
}

.status-dot.is-playing {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(53, 226, 123, 0.16), 0 0 14px rgba(53, 226, 123, 0.35);
}

.message-toast {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: 132px;
    max-width: min(560px, calc(100% - 30px));
    padding: 10px 14px;
    color: #fff;
    border-radius: 8px;
    background: rgba(20, 23, 29, 0.94);
    border: 1px solid var(--line);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.message-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.auto-overlay {
    position: absolute;
    z-index: 7;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.68);
}

.auto-overlay.show {
    display: flex;
}

.auto-overlay > div {
    width: min(520px, 100%);
    display: grid;
    gap: 8px;
    padding: 26px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(20, 23, 29, 0.94);
    box-shadow: var(--shadow);
}

.auto-overlay span {
    color: var(--muted);
}

.auto-overlay strong {
    font-size: 1.35rem;
    line-height: 1.3;
}

.auto-overlay em {
    width: 62px;
    height: 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    color: #111;
    background: var(--warning);
    border-radius: 50%;
    font-style: normal;
    font-size: 2rem;
    font-weight: 800;
}

.score-overlay {
    position: absolute;
    z-index: 25;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.score-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.score-box {
    width: min(520px, 100%);
    padding: 30px;
    text-align: center;
    border: 2px solid var(--cyan);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.96), rgba(0, 0, 0, 0.96));
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.24);
    transform: scale(0.88);
    transition: transform 0.34s ease;
}

.score-overlay.show .score-box {
    transform: scale(1);
}

.score-header-text {
    color: var(--muted);
    font-size: 1.05rem;
}

.score-number {
    color: var(--green);
    font-size: clamp(4rem, 12vw, 6rem);
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 24px rgba(53, 226, 123, 0.72);
}

.score-comment {
    color: var(--warning);
    margin-top: 10px;
    font-size: clamp(1.1rem, 4vw, 1.55rem);
    font-weight: 700;
}

.next-in-score {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.next-label {
    color: var(--muted);
    font-size: 0.86rem;
}

.next-title {
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.15rem;
}

.next-countdown {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    color: #fff;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
}

.progress-panel {
    position: absolute;
    z-index: 5;
    left: 18px;
    right: 18px;
    bottom: 104px;
    display: grid;
    gap: 6px;
}

#seekBar {
    width: 100%;
    accent-color: var(--primary);
}

.time-row {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.86rem;
}

.control-bar {
    position: absolute;
    z-index: 13;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 94px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 18px max(14px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.08));
}

.round-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
}

.mobile-more-btn {
    display: none;
}

.desktop-volume-btn {
    display: none;
}

.hide-ui-btn {
    color: var(--cyan);
    border-color: rgba(0, 212, 255, 0.34);
}

.menu-pulse {
    color: var(--green);
    border-color: rgba(53, 226, 123, 0.45);
    animation: menu-pulse 2s infinite;
}

@keyframes menu-pulse {
    0% { box-shadow: 0 0 0 0 rgba(53, 226, 123, 0.42); }
    70% { box-shadow: 0 0 0 12px rgba(53, 226, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(53, 226, 123, 0); }
}

.play-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: rgba(255, 255, 255, 0.22);
    font-size: 1.38rem;
    box-shadow: 0 12px 30px rgba(255, 45, 104, 0.25);
}

.control-cluster {
    min-width: 140px;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(20, 23, 29, 0.72);
}

.control-cluster input {
    width: 92px;
    accent-color: var(--cyan);
}

.speed-select {
    width: 92px;
    min-height: 48px;
    background: rgba(20, 23, 29, 0.76);
}

.display-panel {
    display: none;
}

@media (min-width: 761px) {
    .desktop-volume-btn {
        display: inline-flex;
    }

    .control-cluster {
        width: 0;
        min-width: 0;
        opacity: 0;
        overflow: hidden;
        padding: 0;
        border-color: transparent;
        pointer-events: none;
        transition: width 0.18s ease, opacity 0.18s ease, padding 0.18s ease, border-color 0.18s ease;
    }

    .control-bar.volume-open .control-cluster {
        width: 172px;
        min-width: 172px;
        opacity: 1;
        padding: 0 12px;
        border-color: var(--line);
        pointer-events: auto;
    }

    .control-cluster input {
        width: 100%;
    }
}

.dj-panel {
    position: absolute;
    z-index: 14;
    right: 22px;
    bottom: 108px;
    display: grid;
    grid-template-columns: repeat(2, 88px);
    gap: 9px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(20, 23, 29, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.dj-sound-btn {
    min-height: 70px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 5px;
    color: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.09);
    cursor: pointer;
}

.dj-sound-btn i {
    color: var(--cyan);
}

.dj-sound-btn span {
    font-size: 0.78rem;
}

.song-panel {
    position: fixed;
    z-index: 30;
    top: 120px;
    right: 22px;
    width: min(460px, calc(100vw - 28px));
    height: min(620px, calc(100svh - 160px));
    min-width: 320px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(20, 23, 29, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, height 0.18s ease;
}

.song-panel.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.song-panel.collapsed {
    height: 58px;
    grid-template-rows: auto;
}

.panel-head {
    position: relative;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    cursor: move;
}

.panel-head strong {
    font-size: 1.12rem;
}

.panel-head-actions {
    display: flex;
    gap: 7px;
}

.panel-small-btn {
    width: 36px;
    height: 36px;
}

.song-panel.collapsed .panel-tabs,
.song-panel.collapsed .tab-panel {
    display: none;
}

.panel-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.tab-btn {
    min-width: 0;
    height: 46px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    color: var(--muted);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.tab-btn span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.76rem;
}

.tab-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.tab-panel {
    min-height: 0;
    display: none;
    overflow: auto;
    padding: 12px;
}

.tab-panel.active {
    display: block;
}

.search-form {
    grid-template-columns: 1fr 50px;
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 12px;
    background: var(--panel);
}

.search-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.search-suggest {
    display: grid;
    gap: 6px;
    margin: -4px 0 10px;
}

.search-suggest-btn {
    min-height: 44px;
    display: grid;
    justify-items: start;
    gap: 2px;
    padding: 8px 12px;
    color: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    text-align: left;
}

.search-suggest-main {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggest-meta {
    color: var(--muted);
    font-size: 0.74rem;
}

.icon-action {
    padding: 0;
}

.queue-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.wide {
    width: 100%;
    margin-bottom: 12px;
}

.result-list {
    display: grid;
    gap: 9px;
}

.song-card,
.admin-row,
.log-row {
    display: grid;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.song-card {
    grid-template-columns: 92px 1fr auto;
    min-height: 78px;
    padding: 8px;
}

.song-card.is-active {
    border-color: rgba(53, 226, 123, 0.55);
    background: rgba(53, 226, 123, 0.08);
}

.song-card img {
    width: 92px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
}

.song-meta {
    min-width: 0;
}

.song-title,
.song-channel,
.admin-main,
.admin-sub,
.log-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-title {
    font-weight: 600;
    line-height: 1.25;
}

.song-channel,
.admin-sub,
.log-row small {
    color: var(--muted);
    font-size: 0.84rem;
}

.song-actions,
.queue-move {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mini-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.mini-btn.add {
    color: #111;
    background: var(--green);
}

.mini-btn.danger {
    background: rgba(255, 77, 79, 0.18);
    color: #ffb3b3;
}

.empty-list,
.loading-list {
    color: var(--muted);
    text-align: center;
    padding: 24px 10px;
}

.settings-grid {
    display: grid;
    gap: 12px;
}

.toggle-row {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.toggle-row input {
    width: 46px;
    height: 26px;
    accent-color: var(--green);
}

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

.sfx-btn {
    min-height: 72px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 5px;
    color: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    cursor: pointer;
}

.sfx-btn span {
    font-size: 0.86rem;
}

.settings-overlay {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(5px);
}

.settings-modal {
    width: min(760px, 100%);
    height: min(86svh, 760px);
    max-height: min(86svh, 760px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(20, 23, 29, 0.98);
    box-shadow: var(--shadow);
}

.settings-header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.settings-header h2 {
    margin: 0;
    font-size: 1.16rem;
}

.settings-tabs {
    min-width: 0;
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.settings-tab-btn {
    min-width: 104px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.settings-tab-btn i {
    color: var(--cyan);
}

.settings-tab-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.86rem;
}

.settings-tab-btn.active {
    color: #fff;
    border-color: rgba(0, 212, 255, 0.22);
    background: rgba(0, 212, 255, 0.1);
}

.settings-body {
    min-height: 0;
    overflow: hidden;
}

.settings-page {
    min-height: 0;
    display: none;
    gap: 12px;
    padding: 14px 16px max(18px, env(safe-area-inset-bottom));
    overflow: auto;
}

.settings-page.active {
    display: grid;
}

.setting-field {
    display: grid;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.setting-field span {
    color: var(--muted);
    font-size: 0.88rem;
}

.setting-field input[type="text"] {
    width: 100%;
    min-height: 42px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
    padding: 0 12px;
}

.setting-field input[type="range"] {
    width: 100%;
    accent-color: var(--cyan);
}

.admin-form {
    grid-template-columns: 1fr 1fr auto;
    margin-bottom: 16px;
}

.admin-block {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.admin-block h3 {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.admin-list {
    display: grid;
    gap: 8px;
}

.admin-row {
    grid-template-columns: 1fr auto;
    padding: 10px;
}

.log-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 10px;
}

@media (max-width: 1100px) {
    .app-shell {
        display: block;
    }

    .song-panel {
        width: min(460px, calc(100vw - 28px));
    }
}

@media (min-width: 1101px) {
    #openPanelBtn {
        display: none;
    }
}

@media (max-width: 760px) {
    body {
        overflow: auto;
    }

    .stage {
        min-height: 100svh;
    }

    .stage-header {
        padding: calc(max(10px, env(safe-area-inset-top)) + 28px) 10px 10px;
    }

    .brand-mark div {
        display: none;
    }

    .brand-mark img {
        width: 40px;
        height: 40px;
    }

    .session-tools span {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .now-playing {
        top: 94px;
        left: 10px;
        width: min(420px, calc(100% - 20px));
    }

    .empty-state {
        align-content: start;
        padding: 162px 18px 190px;
        overflow: auto;
    }

    .empty-state img {
        width: 132px;
    }

    .empty-state h2 {
        font-size: 2rem;
    }

    .quick-recommend {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }

    .quick-recommend .song-card:nth-child(n + 3) {
        display: none;
    }

    .quick-recommend .song-card {
        grid-template-columns: 76px minmax(0, 1fr) 46px;
        min-height: 66px;
        align-items: center;
    }

    .quick-recommend .song-actions {
        grid-column: auto;
        justify-content: center;
    }

    .progress-panel {
        left: 12px;
        right: 12px;
        bottom: 146px;
    }

    .dj-panel {
        right: 10px;
        bottom: 150px;
        grid-template-columns: repeat(2, 78px);
    }

    .control-bar {
        min-height: 136px;
        flex-wrap: wrap;
        gap: 8px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .round-btn {
        width: 46px;
        height: 46px;
    }

    .play-btn {
        width: 62px;
        height: 62px;
    }

    .control-cluster {
        order: 2;
        width: calc(100% - 116px);
        min-width: 0;
    }

    .control-cluster input {
        width: 100%;
    }

    .speed-select {
        order: 2;
    }

    .song-panel {
        width: calc(100vw - 20px);
        min-width: 0;
        top: 112px;
        right: 10px;
        height: min(620px, calc(100svh - 220px));
    }

    .song-card {
        grid-template-columns: 82px 1fr auto;
    }

    .song-card img {
        width: 82px;
        height: 52px;
    }

    .admin-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) and (min-width: 761px) {
    .song-panel {
        width: min(500px, calc(100vw - 34px));
        height: min(650px, calc(100svh - 150px));
    }

    .quick-recommend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .now-playing {
        width: min(476px, calc(100% - 36px));
    }

    .control-bar {
        gap: 10px;
    }
}

@media (max-width: 760px) {
    body {
        overflow: hidden;
    }

    .corner-logo {
        top: calc(max(8px, env(safe-area-inset-top)) + 4px);
        right: 10px;
        gap: 7px;
        padding: 6px 9px;
    }

    .corner-logo img {
        width: 28px;
        height: 28px;
    }

    .corner-logo span {
        font-size: 0.68rem;
    }

    .login-screen {
        align-items: stretch;
        overflow: auto;
    }

    .login-panel {
        align-self: center;
        padding: 22px;
    }

    .stage {
        height: 100svh;
        min-height: 100svh;
    }

    .progress-panel {
        left: 12px;
        right: 12px;
        bottom: 88px;
    }

    .stage.controls-expanded .progress-panel {
        bottom: 154px;
    }

    .control-bar {
        min-height: 82px;
        flex-wrap: nowrap;
        gap: 9px;
        padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    }

    .control-bar.controls-expanded {
        min-height: 148px;
        flex-wrap: wrap;
        align-content: center;
        padding-top: 10px;
    }

    .mobile-more-btn {
        display: inline-flex;
    }

    #restartBtn,
    #forwardBtn,
    #openPanelBarBtn,
    #screen2Btn,
    #settingsBtn,
    #djBtn,
    #fullscreenBtn,
    .control-cluster,
    .speed-select {
        display: none;
    }

    .control-bar.controls-expanded #restartBtn,
    .control-bar.controls-expanded #forwardBtn,
    .control-bar.controls-expanded #openPanelBarBtn,
    .control-bar.controls-expanded #screen2Btn,
    .control-bar.controls-expanded #settingsBtn,
    .control-bar.controls-expanded #djBtn,
    .control-bar.controls-expanded #fullscreenBtn {
        width: 42px;
        height: 42px;
        display: inline-flex;
        order: 2;
    }

    .control-bar.controls-expanded #controlsMoreBtn {
        color: var(--cyan);
        border-color: rgba(0, 212, 255, 0.5);
        background: rgba(0, 212, 255, 0.12);
    }

    .control-bar.controls-expanded .control-cluster {
        height: 42px;
        display: flex;
        flex: 1 1 210px;
        order: 3;
        min-width: 0;
        max-width: 260px;
        padding: 0 10px;
    }

    .control-bar.controls-expanded .control-cluster input {
        width: 100%;
    }

    .control-bar.controls-expanded .speed-select {
        width: 76px;
        min-height: 42px;
        height: 42px;
        display: block;
        flex: 0 0 76px;
        order: 3;
    }

    .empty-state {
        align-content: start;
        padding: 162px 18px 190px;
        overflow: auto;
    }

    .empty-state img {
        width: 132px;
    }

    .empty-state h2 {
        font-size: 2rem;
    }

    .song-panel {
        top: 112px;
        right: 10px;
        bottom: auto;
        width: calc(100vw - 20px);
        height: min(620px, calc(100svh - 220px));
        border-radius: 10px;
    }

    .settings-overlay {
        padding: 10px;
    }

    .settings-modal {
        width: 100%;
        height: calc(100svh - 20px);
        max-height: calc(100svh - 20px);
    }

    .settings-header {
        min-height: 56px;
        padding: 10px 12px;
    }

    .settings-tabs {
        gap: 6px;
        padding: 8px 10px;
    }

    .settings-tab-btn {
        min-width: 88px;
        min-height: 40px;
        padding: 0 10px;
    }

    .settings-tab-btn span {
        font-size: 0.78rem;
    }

    .settings-page {
        padding: 10px 10px max(14px, env(safe-area-inset-bottom));
    }

    .panel-head {
        min-height: 56px;
        padding: 10px 14px;
    }

    .panel-head::before {
        display: none;
    }

    .panel-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow-x: auto;
        padding: 8px 10px;
        scrollbar-width: none;
    }

    .panel-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        height: 44px;
    }

    .tab-panel {
        padding: 10px 10px max(18px, env(safe-area-inset-bottom));
    }

    .search-form {
        grid-template-columns: minmax(0, 1fr) 48px;
        padding-bottom: 10px;
    }

    .song-card {
        grid-template-columns: 76px minmax(0, 1fr);
        min-height: 76px;
        align-items: start;
    }

    .song-card img {
        width: 76px;
        height: 48px;
    }

    .song-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .quick-recommend .song-actions {
        grid-column: auto;
        justify-content: center;
    }

    .mini-btn {
        width: 42px;
        height: 42px;
    }

    .log-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) and (orientation: landscape) {
    .song-panel {
        top: 82px;
        right: 10px;
        bottom: auto;
        width: min(430px, calc(100vw - 20px));
        height: min(420px, calc(100svh - 180px));
        border-radius: 10px;
    }

    .panel-head::before {
        display: none;
    }

    .control-bar {
        min-height: 78px;
    }

    .control-bar.controls-expanded {
        min-height: 132px;
    }

    .progress-panel {
        bottom: 82px;
    }

    .stage.controls-expanded .progress-panel {
        bottom: 138px;
    }

    .dj-panel {
        bottom: 138px;
    }
}

.screen-display {
    overflow: hidden;
    background: #000;
}

.screen-display .song-panel,
.screen-display .settings-overlay,
.screen-display .stage-header,
.screen-display .now-playing,
.screen-display .progress-panel,
.screen-display .control-bar,
.screen-display .marquee-container,
.screen-display .message-toast,
.screen-display .auto-overlay,
.screen-display .score-overlay {
    display: none !important;
}

.screen-display .display-panel {
    position: absolute;
    z-index: 16;
    top: calc(max(16px, env(safe-area-inset-top)) + 52px);
    right: 16px;
    width: min(340px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    justify-items: stretch;
}

.screen-display .display-track {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(12px);
}

.screen-display .display-track span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
}

.screen-display .display-track strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
}

.screen-display .display-track.next strong {
    color: var(--cyan);
}

.screen-display .display-fullscreen-btn {
    width: 54px;
    height: 54px;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(20, 23, 29, 0.82);
    cursor: pointer;
}

.screen-display .stage,
.screen-display .player-layer,
.screen-display .app-shell {
    width: 100vw;
    height: 100svh;
}

.screen-display .player-layer iframe {
    pointer-events: none;
}

.screen-display .empty-state {
    background: linear-gradient(180deg, rgba(9, 10, 13, 0.15), rgba(9, 10, 13, 0.74)), #08090b;
}

.screen-display .quick-recommend {
    display: none;
}

.screen-display .stage * {
    pointer-events: none;
}

.screen-display #displayFullscreenBtn {
    pointer-events: auto;
}
