/* =====================================================================
   디자인 시스템 — Modern Clean (Light 기본 + Dark 토글)
   - 액센트: 인디고(#6366f1)
   - 색은 전부 시맨틱 토큰으로 관리한다. 테마는 <html data-theme="..."> 로 전환.
   - 초기 테마는 head 인라인 스크립트가 저장값/시스템 설정을 반영해 지정한다.
   ===================================================================== */
:root {
    /* Brand accent (Indigo) */
    --accent: #6366f1;
    --accent-strong: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --accent-border: rgba(99, 102, 241, 0.35);
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-on-accent: #ffffff;
    --link: #2563eb;

    /* Surface (Light) */
    --bg-app: #f5f5f7;
    --bg-0: #eceef2;
    --bg-1: #ffffff;
    --bg-2: #f4f4f6;
    --bg-elev: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.045);
    --bg-hover-strong: rgba(0, 0, 0, 0.075);
    --surface-raise: rgba(0, 0, 0, 0.04);
    --surface-glass: rgba(255, 255, 255, 0.78);

    /* Border */
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.16);
    --border-soft: rgba(0, 0, 0, 0.06);

    /* Text */
    --text-1: #1a1a1f;
    --text-2: #55555f;
    --text-3: #8a8a94;

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-full: 999px;

    /* Spacing (8pt scale) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-6: 24px;

    /* Shadow (soft, light) */
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-glass: 0 12px 40px rgba(0, 0, 0, 0.16);

    /* Motion */
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Typography */
    --font-sans: "Pretendard Variable", "Pretendard", "Inter", -apple-system,
        BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
    /* Brand accent (Indigo, 다크에서 약간 밝게) */
    --accent: #818cf8;
    --accent-strong: #6366f1;
    --accent-soft: rgba(129, 140, 248, 0.16);
    --accent-border: rgba(129, 140, 248, 0.4);
    --accent-glow: rgba(129, 140, 248, 0.35);
    --text-on-accent: #ffffff;
    --link: #3ea6ff;

    /* Surface (Dark) */
    --bg-app: #0d0d0f;
    --bg-0: #0d0d0f;
    --bg-1: #16161a;
    --bg-2: #1e1e24;
    --bg-elev: #22222a;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-hover-strong: rgba(255, 255, 255, 0.1);
    --surface-raise: rgba(255, 255, 255, 0.06);
    --surface-glass: rgba(22, 22, 26, 0.72);

    /* Border */
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --border-soft: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-1: #f2f2f4;
    --text-2: #a4a4ac;
    --text-3: #6a6a72;

    /* Shadow (dark) */
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-glass: 0 12px 40px rgba(0, 0, 0, 0.5);
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-sans);
    color: var(--text-1);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
#main-container {
    display: flex;
    height: 100%;
    position: relative;
}
#play-index {
    position: absolute;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--text-on-accent);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    font-family: sans-serif;
    width: 100%;
    text-align: center;
}
#iframe-container {
    flex-grow: 1;
    height: 100%;
    overflow-y: hidden;
    background: #000;
    position: relative;
}
iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
/* 빈 상태는 항상 검은 영상 스테이지 위에 있으므로 텍스트를 밝게 고정 */
#message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--sp-3);
    height: 100%;
    padding: var(--sp-6);
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
}
#message i {
    font-size: 3.5rem;
    color: #818cf8;
    opacity: 0.95;
    filter: drop-shadow(0 4px 18px rgba(129, 140, 248, 0.4));
}
#message .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}
#message .empty-hint {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.45);
    max-width: 320px;
    line-height: 1.55;
}
#message .empty-guide-link {
    margin-top: var(--sp-2);
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c7ccff;
    text-decoration: none;
    border: 1px solid rgba(129, 140, 248, 0.5);
    border-radius: var(--r-full);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
#message .empty-guide-link:hover {
    background: rgba(129, 140, 248, 0.16);
    border-color: #818cf8;
}
.ytp-svg-fill {
    fill: white;
    opacity: 0.3;
    stroke: black;
    stroke-width: 0.5px;
}
#unmute-button {
    display: none;
    position: absolute;
    z-index: 8;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.12);
    left: 0;
    top: 0;
    cursor: pointer;
    border: none;
    outline: none;
}

/* 메뉴 토글 버튼 스타일 */
#menu-toggle {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#menu-toggle:hover {
    background: rgba(99, 102, 241, 0.8);
    border: 2px solid var(--border);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-50%) scale(1.1);
}

#menu-toggle .menu-icon {
    width: 18px;
    height: 18px;
    background: none;
    position: relative;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    top: -1px;
}

#menu-toggle .menu-icon::before,
#menu-toggle .menu-icon::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
    transform-origin: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#menu-toggle .menu-icon::before {
    top: 6px;
}

#menu-toggle .menu-icon::after {
    top: 12px;
}

#menu-toggle.active {
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
}

#menu-toggle.active .menu-icon::before {
    transform: translateY(4px) rotate(45deg);
}

#menu-toggle.active .menu-icon::after {
    transform: translateY(-2px) rotate(-45deg);
}

#list-container {
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    transition: width 0.3s var(--ease);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 9;
    color: var(--text-1);
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}

#list-container.active {
    width: 280px;
}

/* 상단 헤더: 로고(좌) + 내보내기/가져오기(우) */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 4px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.list-header #logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 4px 2px;
}
.list-header #logo .brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: var(--text-on-accent);
    font-size: 11px;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.list-header #logo .brand-name {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--text-1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* 헤더 아이콘은 로고와 어울리도록 배경 없이 가볍게 */
.header-actions .icon-checkbox {
    background: transparent;
    color: var(--text-2);
    font-size: 15px;
    padding: 7px;
    border-radius: 6px;
    line-height: 1;
}

.header-actions .icon-checkbox:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* 설정 메뉴(드롭다운) */
.settings-menu {
    position: relative;
    display: inline-flex;
}

.settings-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    background: var(--bg-1, #fff);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 1000;
}

.settings-menu.open .settings-dropdown {
    display: block;
}

.settings-menu.open > #settings-btn {
    background: var(--bg-hover);
    color: var(--text-1);
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none;
}

.settings-item:hover {
    background: var(--bg-hover);
    color: var(--text-1);
    text-decoration: none;
}

.settings-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    font-size: 14px;
    flex-shrink: 0;
}

.settings-item-label {
    flex: 1;
}

/* 스크롤바 스타일링 */
#list-items::-webkit-scrollbar {
    width: 6px;
}
#list-items::-webkit-scrollbar-track {
    background: transparent;
}
#list-items::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 3px;
}
#list-items::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}
#list-items {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

#playlist-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 10px;
    background: linear-gradient(
        180deg,
        var(--bg-2) 0%,
        var(--bg-1) 100%
    );
    border-top: 1px solid rgba(99, 102, 241, 0.3);
    width: 100%;
    box-sizing: border-box;
}

#playlist-controls .controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

#playlist-controls .index-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.playlist-volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

#playlist-controls #playlist-volume-toggle {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
}

#playlist-controls #playlist-volume-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

#playlist-volume-slider {
    width: 78px;
    height: 4px;
    margin: 0;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

#playlist-controls button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--text-2);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

#playlist-controls .controls-row #prev-btn,
#playlist-controls .controls-row #next-btn {
    width: 35px;
    height: 35px;
}

#playlist-controls button span {
    font-size: 9px;
    margin-top: 1px;
    font-weight: bold;
}

#playlist-controls button:hover {
    background: rgba(99, 102, 241, 0.6);
    border-color: rgba(99, 102, 241, 0.8);
    color: var(--text-on-accent);
    transform: scale(1.1);
}

#playlist-controls button:disabled {
    color: var(--text-3);
    cursor: not-allowed;
    background: var(--bg-hover);
    border-color: var(--border);
}

#playlist-controls button:disabled:hover {
    transform: none;
    background: var(--bg-hover);
    border-color: var(--border);
}

#playlist-controls .play-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.3) 0%,
        rgba(99, 102, 241, 0.1) 100%
    );
    border: 2px solid rgba(99, 102, 241, 0.5);
}

#playlist-controls .play-btn i {
    font-size: 22px;
    color: var(--accent);
}

#playlist-controls .play-btn:hover {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.8) 0%,
        rgba(99, 102, 241, 0.6) 100%
    );
    border-color: rgba(99, 102, 241, 1);
}

#playlist-controls .play-btn:hover i {
    color: var(--text-on-accent);
}

#playlist-controls .index-row button {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.index-display {
    display: flex;
    align-items: center;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
}

#current-index-input {
    width: 35px;
    background: var(--bg-hover);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-on-accent);
    text-align: center;
    border-radius: 6px;
    margin: 0 8px;
    padding: 5px;
    font-size: 14px;
}

#current-index-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.button-group {
    /* 버튼 그룹을 감싸는 div 추가 */
    position: absolute;
    right: 5px; /* 삭제 버튼 위치와 동일하게 배치 */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column; /* 세로로 배치 */
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}
.list-item:hover .button-group {
    opacity: 1;
}
.list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin: 4px 8px;
    border-radius: var(--r-md);
    background: var(--bg-hover);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
        transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}
.list-item.active {
    background: linear-gradient(
        135deg,
        var(--accent-soft) 0%,
        rgba(99, 102, 241, 0.05) 100%
    );
    border: 1px solid var(--accent-border);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}
/* 현재 재생 항목: 좌측 액센트 바 */
.list-item.active::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: var(--r-full);
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}
.list-item:hover {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}
.list-item.active:hover {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.2) 0%,
        rgba(99, 102, 241, 0.1) 100%
    );
}
.list-item img {
    width: 80px;
    height: 45px;
    object-fit: cover;
    margin-right: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.list-item span {
    flex: 1;
    margin-right: 8px;
    font-size: 12px;
    color: var(--text-1);
    line-height: 1.4;
}

.add-video-form {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(
        180deg,
        var(--bg-2) 0%,
        var(--bg-1) 100%
    );
    display: flex;
    align-items: center;
}

.add-video-form form {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.add-video-form input {
    width: 100%;
    min-width: 145px;
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-1);
    font-size: 13px;
    transition: all 0.2s;
}

.add-video-form input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    background: var(--bg-hover);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.add-video-form input::placeholder {
    color: var(--text-3);
}

.add-video-form .add-button {
    padding: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    border: none;
    border-radius: 8px;
    color: var(--text-on-accent);
    cursor: pointer;
    width: 80px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.add-video-form .add-button:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.add-video-form .add-button i {
    font-size: 15px;
}

.refresh-button {
    padding: 8px;
    background: var(--bg-2);
    border: none;
    border-radius: 4px;
    color: var(--text-1);
    cursor: pointer;
    width: 32px;
    height: 32px !important; /* 높이 강제 지정 */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.refresh-button:hover {
    background: var(--bg-2);
}

.refresh-icon {
    width: 16px;
    height: 16px;
}

.list-item span {
    flex: 1;
    margin-right: 8px;
    font-size: 10px;
    color: var(--text-1);
    /* 텍스트 슬라이딩 기본 설정 */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    position: relative;
}

.list-item span.title-text:hover {
    animation: scrollText 10s linear infinite;
    font-size: 13px;
}

@keyframes scrollText {
    0% {
        margin-left: 0;
    }
    100% {
        /* span 요소의 실제 너비만큼 이동 */
        margin-left: calc(-100%);
    }
}

/* 위/아래 버튼 스타일 추가 */
/* 컨트롤 버튼 컨테이너 */
.ctrl-buttons {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    gap: 4px;
    opacity: 0;
    transition: all 0.2s ease;
}

.list-item.active .ctrl-buttons {
    opacity: 1;
}

.list-item:hover .ctrl-buttons {
    opacity: 1;
}

/* 삭제 버튼 스타일 */
.list-item .ctrl-button {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.list-item .ctrl-button:hover {
    background: rgba(99, 102, 241, 0.8);
    border-color: rgba(99, 102, 241, 0.8);
    transform: scale(1.1);
}

.list-item .ctrl-button svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
    transition: fill 0.2s ease;
}

.list-item .ctrl-button:hover svg {
    fill: white;
}

/* 더보기 버튼 스타일 — 은은한 글래스 뉴트럴, 호버 시 인디고 강조 */
.list-item .ctrl-button.more-button {
    background: var(--bg-hover-strong);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.list-item .ctrl-button.more-button:hover {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 3px 12px var(--accent-glow);
}

.list-item .ctrl-button.more-button svg {
    fill: var(--text-2);
}

.list-item .ctrl-button.more-button:hover svg {
    fill: var(--text-on-accent, #fff);
}

/* 재생 중인 영상은 삭제 버튼 비활성화 (메뉴 버튼은 유지) */
/* 일시정지/정지 상태에서는 삭제 버튼 활성화 (body.is-playing 일 때만 비활성화) */
body.is-playing .list-item.active .ctrl-button:not(.more-button) {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* 다운로드 버튼을 위한 새로운 스타일 */
.download-button {
    width: 32px;
    height: 32px;
    background: rgba(62, 166, 255, 0.15);
    border: 1px solid rgba(62, 166, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.download-button:hover {
    background: rgba(62, 166, 255, 0.8);
    border-color: rgba(62, 166, 255, 0.8);
    transform: scale(1.1);
}

.download-button svg {
    width: 16px;
    height: 16px;
    fill: var(--link);
    transition: fill 0.2s ease;
}

.download-button:hover svg {
    fill: white;
}

/* Drag and drop styles */
.list-item.dragging {
    opacity: 0.5;
    background: var(--bg-2);
    border: 2px dashed var(--border);
}

.list-item.drag-over {
    border-top: 2px solid var(--accent);
}

.list-container.drag-over-end {
    border-bottom: 2px solid var(--accent);
}

/* Add a visual cue that items are draggable */
.list-item {
    cursor: grab;
}

.list-item:active {
    cursor: grabbing;
}

/* Make sure buttons and clickable elements still work */
.list-item button,
.list-item img,
.list-item span {
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.3s var(--ease);
}

.modal-content {
    background-color: var(--surface-glass);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    margin: 15% auto;
    padding: var(--sp-6);
    border-radius: var(--r-lg);
    width: 80%;
    max-width: 400px;
    box-shadow: var(--shadow-glass);
    animation: slideIn 0.3s var(--ease);
    border: 1px solid var(--border);
    position: relative;
}

.close-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--text-2);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-icon:hover {
    color: var(--text-1);
}

.video-info-refresh {
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
    transition: color 0.2s;
}

.video-info-refresh:hover {
    color: var(--link);
}

.video-info-refresh.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.modal h3 {
    margin: 0 0 15px 0;
    color: var(--text-1);
    font-size: 1.2em;
}

.modal p {
    margin: 0 0 20px 0;
    color: var(--text-2);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.modal-btn.primary {
    background-color: var(--link);
    color: var(--bg-app);
}

.modal-btn:not(.primary) {
    background-color: var(--bg-2);
    color: var(--text-1);
    border: 1px solid var(--border-strong);
}

.modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.modal-btn.primary:hover {
    background-color: var(--link);
}

.modal-btn:not(.primary):hover {
    background-color: var(--bg-2);
}
.modal-btn.cancel {
    background-color: var(--bg-2);
    color: var(--text-1);
    border: 1px solid var(--border-strong);
}

.modal-btn.cancel:hover {
    background-color: var(--bg-2);
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#progress-markers {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#iframe-container:hover #progress-markers {
    opacity: 1;
}

.progress-marker {
    position: absolute;
    width: 0px;
    height: 16px;
    bottom: 30px;
    transform: translateX(-50%);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    background: linear-gradient(to top, rgba(218, 255, 68, 0.8), #ffef44);
    border-radius: 4px;
}

.progress-marker::before {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    background: #fff344;
    border-radius: 2px;
    left: -4px;
    top: -2px;
    transform: rotate(45deg) scale(0.8);
    transition: all 0.2s ease;
    box-shadow: 0 0 6px rgba(255, 230, 68, 0.4);
}

.progress-marker:hover {
    height: 20px;
    background: linear-gradient(to top, #e3ff44, #faff66);
}

.progress-marker:hover::before {
    transform: rotate(45deg) scale(1);
    box-shadow: 0 0 12px rgba(236, 255, 68, 0.6);
    animation: markerPulse 1.5s infinite;
}

@keyframes markerPulse {
    0% {
        transform: rotate(45deg) scale(1);
    }
    50% {
        transform: rotate(45deg) scale(1.2);
    }
    100% {
        transform: rotate(45deg) scale(1);
    }
}

.progress-marker::after {
    content: attr(data-percentage);
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    color: var(--text-on-accent);
    font-size: 11px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 3px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.progress-marker:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    bottom: 30px;
}

#progress-markers.active {
    opacity: 1;
}

.progress-marker {
    cursor: pointer;
    /*
    width: 0;
    height: 0;
    position: absolute;
    bottom: 32px;
    transform: translateX(-50%);
    pointer-events: auto;
    transition: all 0.2s ease;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid rgba(99, 102, 241, 0.8);
    padding: 6px;
    background: transparent; */
}

.countdown-timer {
    text-align: center;
    color: #ff8c00;
    font-weight: bold;
    margin: 10px 0 15px 0;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.countdown-timer:hover {
    text-decoration: underline;
}

.clipboard-button {
    padding: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-1);
    cursor: pointer;
    width: 80px;
    height: 36px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transition: all 0.2s ease;
}

.clipboard-button:hover {
    background: rgba(62, 166, 255, 0.3);
    border-color: rgba(62, 166, 255, 0.5);
    transform: scale(1.05);
}

.clipboard-button i {
    font-size: 15px;
    color: var(--text-1);
    transition: color 0.2s ease;
}

.clipboard-button:hover i {
    color: var(--text-1);
}

/* 비활성화된 컨트롤 버튼 */
.ctrl-button.disabled,
.download-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--border-strong);
    border-color: var(--border-strong);
}

.ctrl-button.disabled svg,
.download-button.disabled svg {
    fill: var(--text-3);
}

/* Mobile clock button */
.mobile-clock-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: linear-gradient(145deg, #00c6ff, #0072ff);
    border: none;
    color: var(--text-on-accent);
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-clock-btn:hover {
    transform: scale(1.1);
}
/* Fullscreen clock mode */
.fullscreen-clock-mode {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, var(--bg-1), var(--bg-2));
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.clock-mode-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.orientation-controls {
    display: flex;
    gap: 10px;
}

.orientation-btn {
    background: var(--bg-hover);
    border: none;
    color: var(--text-on-accent);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.orientation-btn.active {
    background: rgba(0, 198, 255, 0.3);
    color: #00c6ff;
}

.close-clock-btn {
    background: var(--bg-hover);
    border: none;
    color: var(--text-on-accent);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-clock-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    color: var(--accent);
}

.fullscreen-digital-clock {
    font-family: "Orbitron", sans-serif;
    font-size: 7rem;
    font-weight: 700;
    color: #00c6ff;
    text-shadow: 0 0 20px rgba(0, 198, 255, 0.5);
    transition: all 0.3s ease;
}

.fullscreen-clock-mode.landscape .fullscreen-digital-clock {
    font-size: 14rem;
    min-width: 650px;
}

/* Icon Checkbox Styles */
.playback-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 10px 8px;
    background: linear-gradient(
        180deg,
        var(--bg-1) 0%,
        var(--bg-1) 100%
    );
    border-bottom: 1px solid var(--border);
}

/* 하단 컨트롤 아이콘을 한 줄에 맞도록 컴팩트하게 */
.playback-controls .icon-checkbox {
    padding: 6px;
    font-size: 15px;
}

.icon-checkbox {
    position: relative;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-3);
    transition: all 0.2s;
    padding: 8px;
    border-radius: 8px;
    background: var(--bg-hover);
}

.icon-checkbox:hover {
    background: var(--bg-hover);
    color: var(--text-2);
}

.icon-checkbox input[type="checkbox"] {
    display: none; /* 실제 체크박스 숨기기 */
}

.icon-checkbox:hover {
    color: var(--text-2); /* 마우스 오버 시 색상 */
}

.icon-checkbox input[type="checkbox"]:checked + i {
    color: var(--accent); /* 활성 상태 아이콘 색상 */
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.7);
}

/* 순서 변경 모달 스타일 */
.order-change-content {
    display: flex;
    flex-direction: column;
    max-width: 700px;
    margin: 0;
    max-height: min(76vh, 680px);
    overflow: hidden;
    will-change: transform;
}

#order-change-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.order-change-drag-handle {
    padding-right: 32px;
    cursor: move;
    user-select: none;
    touch-action: none;
}

.order-change-content.dragging-modal,
.order-change-content.dragging-modal .order-change-drag-handle {
    cursor: grabbing;
}

.order-list-filter-wrap {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    flex: 1;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin-bottom: 0;
    padding: 0 10px !important;
    box-sizing: border-box !important;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg-2);
    color: var(--text-3);
}

#order-list-filter {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    color: var(--text-1);
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
}

#order-list-filter-result {
    font-size: 11px;
    white-space: nowrap;
}

.order-change-item.order-filter-hidden {
    display: none;
}

.order-top-controls {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

#order-change-list {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background-color: var(--bg-2);
}

.order-group-manager {
    flex: 0 0 auto;
    min-height: 40px;
    border: 0;
    background: transparent;
}

.order-group-manager summary {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 13px;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.order-group-manager:not([open]) {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
}

.order-group-manager summary::-webkit-details-marker {
    display: none;
}

.order-group-manager[open] summary {
    border-radius: 7px 7px 0 0;
}

#order-group-count {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-2);
    font-size: 10px;
    text-align: center;
}

.order-group-manager-body {
    width: 330px;
    max-height: 230px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 7px 7px;
}

.order-group-add-row,
.order-group-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-group-add-row input,
.order-group-name,
.order-group-select {
    min-width: 0;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--bg-app);
    color: var(--text-1);
    padding: 6px 8px;
    font: inherit;
    font-size: 12px;
}

.order-group-add-row input {
    flex: 1;
}

#order-group-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.order-group-name {
    flex: 1;
}

.order-group-color {
    width: 28px;
    height: 28px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: transparent;
}

.order-group-action {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: var(--bg-hover);
    color: var(--text-2);
    cursor: pointer;
}

.order-group-action:hover {
    color: var(--text-1);
}

.order-group-action.delete:hover {
    color: #ff6b6b;
}

.order-group-select {
    width: 125px;
    margin-right: 6px;
}

.order-change-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    background-color: var(--bg-2);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.order-change-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
}

.order-change-item .info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.order-change-item .info .title {
    font-size: 14px;
    color: var(--text-1);
    margin-bottom: 5px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px; /* Adjust as needed */
}

.order-change-item .info .current-order {
    font-size: 12px;
    color: var(--text-2);
}

.order-change-item .controls {
    display: flex;
    align-items: center;
}

/* 메인 재생목록 그룹 */
.playlist-group {
    margin-bottom: 4px;
}

.playlist-group.filter-hidden {
    display: none;
}

.playlist-group-header {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 100%;
    display: grid;
    grid-template-columns: 14px 8px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-1);
    text-align: left;
    cursor: pointer;
}

.playlist-group-header:hover {
    background: var(--bg-hover);
}

.playlist-group.group-playing > .playlist-group-header {
    color: var(--accent);
}

.playlist-group-chevron {
    color: var(--text-3);
    font-size: 10px;
    transition: transform 0.15s ease;
}

.playlist-group.collapsed .playlist-group-chevron {
    transform: rotate(-90deg);
}

.playlist-group-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.playlist-group-name {
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-group-count {
    color: var(--text-3);
    font-size: 11px;
}

.playlist-group.collapsed .playlist-group-body {
    display: none;
}

@media screen and (max-width: 600px) {
    #order-change-modal {
        padding: 12px;
    }

    .order-change-content {
        width: calc(100% - 24px);
        max-width: none;
        max-height: 84vh;
        max-height: 84dvh;
        padding: 16px;
        border-radius: 12px;
    }

    .order-change-drag-handle {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .order-top-controls {
        flex-direction: column;
        gap: 7px;
    }

    .order-group-manager,
    .order-list-filter-wrap {
        width: 100%;
    }

    .order-group-manager-body {
        width: auto;
        max-height: min(28dvh, 200px);
    }

    #order-change-list {
        min-height: 96px;
        padding: 7px;
    }

    .order-change-item {
        flex-wrap: wrap;
    }

    .order-change-item .info {
        min-width: 120px;
        max-width: calc(100% - 105px);
    }

    .order-change-item img {
        width: 64px;
        height: 44px;
        margin-right: 8px;
    }

    .order-change-item .drag-handle {
        margin-right: 8px !important;
    }

    .order-change-item .info .title {
        max-width: 100%;
    }

    .order-change-item .controls {
        width: 100%;
        justify-content: flex-end;
        margin-top: 7px;
    }

    .order-group-select {
        flex: 1;
        width: auto;
    }

    .order-change-content > .modal-buttons {
        flex: 0 0 auto;
        margin-top: 10px !important;
    }
}

@media screen and (max-width: 380px) {
    .order-change-content {
        width: calc(100% - 12px);
        max-height: 88vh;
        max-height: 88dvh;
        padding: 12px;
    }

    .order-group-add-row {
        flex-wrap: wrap;
    }

    .order-group-add-row .modal-btn {
        width: 100%;
    }

    .order-group-row {
        gap: 4px;
    }

    .order-group-action {
        width: 26px;
        height: 26px;
    }
}

@media screen and (max-height: 500px) {
    .order-change-content {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .order-change-drag-handle {
        margin-bottom: 7px;
    }

    .order-group-manager-body {
        max-height: 110px;
    }

    #order-change-list {
        min-height: 70px;
    }
}

.order-change-item .controls .new-order-input {
    width: 50px;
    padding: 6px;
    text-align: center;
    background-color: var(--bg-2);
    border: 1px solid var(--border-strong);
    color: var(--text-1);
    border-radius: 4px;
    margin-right: 10px;
}

.order-change-item .controls .apply-btn {
    padding: 6px 12px;
    background-color: var(--link);
    color: var(--bg-app);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.order-change-item .controls .apply-btn:hover {
    background-color: var(--link);
}

/* Custom Context Menu */
.context-menu {
    display: none;
    position: fixed;
    z-index: 1001;
    background-color: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    padding: var(--sp-1) 0;
    min-width: 150px;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu ul li {
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-1);
    font-size: 14px;
}

.context-menu ul li:hover {
    background-color: var(--bg-2);
}

/* Clipboard Modal */
#clipboard-textarea {
    width: calc(100% - 20px);
    height: 120px;
    margin: 10px 0;
    padding: 10px;
    background-color: var(--bg-app);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-family: monospace;
    resize: vertical;
    border-radius: 6px;
}

/* 영상 정보 모달 */
.video-info-content {
    max-width: 500px;
}

.video-info-thumbnail {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
}

.video-info-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-1);
    margin-bottom: 12px;
    line-height: 1.4;
}

.video-info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.video-info-label {
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}

.video-info-value {
    color: var(--text-1);
    font-size: 13px;
    word-break: break-all;
}

.video-info-desc {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.video-info-desc-title {
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 6px;
}

.video-info-desc-text {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.video-info-desc-text::-webkit-scrollbar {
    width: 4px;
}

.video-info-desc-text::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 2px;
}

/* Order Change Modal Dragging Styles */
.order-change-item .drag-handle {
    cursor: grab;
    margin-right: 15px;
    color: var(--text-2);
    font-size: 1.2em;
}

.order-change-item.now-playing {
    border: 1px solid var(--accent);
    background-color: var(--bg-2);
}

.order-change-item .now-playing-label {
    color: var(--accent);
    font-weight: bold;
}

.order-change-item.dragging {
    opacity: 0.6;
    background: var(--bg-2);
    border: 1px dashed var(--border);
}

/* Video Controls Overlay */
#video-click-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    z-index: 6;
    cursor: pointer;
    display: none;
}

#video-click-layer.hidden {
    pointer-events: none;
}

#video-controls-overlay {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    z-index: 7;
    align-items: center;
    justify-content: center;
    gap: 25px;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#video-controls-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#video-controls-overlay .control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--text-on-accent);
    cursor: pointer;
    transition: all 0.2s;
}

#video-controls-overlay .control-btn:hover {
    background: rgba(99, 102, 241, 0.8);
    border-color: rgba(99, 102, 241, 0.8);
    transform: scale(1.1);
}

#video-controls-overlay .control-btn i {
    font-size: 20px;
}

#video-controls-overlay .control-btn span {
    font-size: 11px;
    margin-top: 2px;
}

#video-controls-overlay .play-pause-btn {
    width: 90px;
    height: 90px;
}

#video-controls-overlay .play-pause-btn i {
    font-size: 32px;
}

#video-controls-overlay .rewind-btn i,
#video-controls-overlay .forward-btn i {
    position: relative;
}

#video-controls-overlay .rewind-btn span,
#video-controls-overlay .forward-btn span {
    font-size: 10px;
    font-weight: bold;
}

#video-controls-overlay .prev-video-btn,
#video-controls-overlay .next-video-btn {
    width: 55px;
    height: 55px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border);
}

#video-controls-overlay .prev-video-btn i,
#video-controls-overlay .next-video-btn i {
    font-size: 18px;
}

#video-controls-overlay .prev-video-btn:hover,
#video-controls-overlay .next-video-btn:hover {
    background: rgba(99, 102, 241, 0.6);
    border-color: rgba(99, 102, 241, 0.6);
}

#video-controls-overlay .control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--border);
}

#video-controls-overlay .control-btn:disabled:hover {
    transform: none;
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--border);
}

a.yt-simple-endpoint {
    margin-top: 6px;
    margin-bottom: -12px;
}

/* ==================== 태블릿 반응형 스타일 ==================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* 사이드바 - 태블릿에서는 absolute 오버레이 방식 */
    #list-container {
        position: absolute;
        top: 0;
        width: 350px;
        right: -350px;
        transition: right 0.3s ease;
    }

    #list-container.active {
        width: 350px;
        right: 0;
    }

    /* 토글 버튼 - 사이드바 350px 왼쪽에 위치 */
    #menu-toggle.active {
        right: 362px;
    }

    /* 리스트 아이템 */
    .list-item {
        padding: 10px 12px;
        margin: 5px 10px;
    }

    .list-item img {
        width: 100px;
        height: 56px;
    }

    .list-item span {
        font-size: 13px;
    }

    /* 입력 폼 */
    .add-video-form input {
        font-size: 14px;
    }

    /* 재생 컨트롤 */
    .playback-controls {
        gap: 6px;
        flex-wrap: wrap;
    }

    #playlist-controls .index-row {
        display: flex;
    }
}

/* ==================== 모바일 반응형 스타일 ==================== */
@media screen and (max-width: 768px) {
    /* 메인 컨테이너 - 세로 레이아웃 */
    #main-container {
        flex-direction: column;
        overflow-y: auto;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    #main-container::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    /* 영상 영역 - 16:9 비율 유지 */
    #iframe-container {
        flex-grow: 0;
        width: 100%;
        height: 0;
        padding-bottom: 56.25%;
        position: relative;
        flex-shrink: 0;
    }

    #iframe-container iframe,
    #iframe-container #youtube-player {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* 사이드바 → 하단 패널 (항상 표시) */
    #list-container {
        position: relative !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        border-left: none;
        box-shadow: none;
    }

    /* 메뉴 토글 버튼 숨김 (모바일에서는 항상 목록 표시) */
    #menu-toggle {
        display: none;
    }

    /* 비디오 컨트롤 오버레이 - 모바일에서도 표시 */
    #video-controls-overlay {
        display: flex;
        height: calc(100% - 0px);
        gap: 15px;
    }

    #video-controls-overlay .control-btn {
        width: 50px;
        height: 50px;
    }

    #video-controls-overlay .play-pause-btn {
        width: 65px;
        height: 65px;
    }

    #video-controls-overlay .prev-video-btn,
    #video-controls-overlay .next-video-btn {
        width: 45px;
        height: 45px;
    }

    #video-controls-overlay .control-btn i {
        font-size: 16px;
    }

    #video-controls-overlay .play-pause-btn i {
        font-size: 24px;
    }

    #video-controls-overlay .prev-video-btn i,
    #video-controls-overlay .next-video-btn i {
        font-size: 14px;
    }

    /* 유튜브 로고 숨김 (공간 절약) */
    #list-container a.yt-simple-endpoint {
        display: none;
    }

    /* 재생 컨트롤 컴팩트하게 */
    #playlist-controls {
        padding: 10px;
        position: sticky;
        bottom: 0;
        z-index: 5;
    }

    #playlist-controls .index-row {
        display: flex;
        gap: 8px;
    }

    #playlist-volume-slider {
        width: min(25vw, 78px);
    }

    /* play-index 위치 조정 */
    #play-index {
        position: relative;
    }

    /* 리스트 아이템 - 모바일 최적화 */
    .list-item {
        padding: 12px;
        margin: 6px 10px;
    }

    .list-item img {
        width: 100px;
        height: 56px;
    }

    .list-item span {
        font-size: 13px;
    }

    /* 입력+컨트롤 래퍼 가로 배치 */
    .top-controls-wrapper {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        border-bottom: 1px solid var(--border);
    }

    /* 입력 폼 */
    .add-video-form {
        width: 50%;
        flex: none;
        padding: 8px;
        border-bottom: none;
        min-width: 0;
        box-sizing: border-box;
    }

    .add-video-form input {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 0;
    }

    .add-video-form .add-button,
    .add-video-form .clipboard-button {
        width: 36px;
        height: 36px !important;
        flex-shrink: 0;
    }

    /* 재생 컨트롤 */
    .playback-controls {
        width: 50%;
        flex: none;
        padding: 8px;
        gap: 0;
        flex-wrap: nowrap;
        border-bottom: none;
        border-left: 1px solid var(--border);
        box-sizing: border-box;
        justify-content: stretch;
    }

    .icon-checkbox {
        flex: 1;
        font-size: 14px;
        padding: 6px 0;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 25px;
        margin-left: 4px;
    }

    /* 스크롤바 숨김 (모바일) */
    #list-items::-webkit-scrollbar {
        width: 4px;
    }
}

/* 더 작은 화면 (스마트폰) */
@media screen and (max-width: 480px) {
    .list-item {
        padding: 10px;
        margin: 5px 8px;
    }

    .list-item img {
        width: 80px;
        height: 45px;
    }

    .list-item span {
        font-size: 12px;
    }

    .playback-controls {
        gap: 4px;
    }

    .icon-checkbox {
        font-size: 15px;
        padding: 8px;
    }

    #video-controls-overlay {
        gap: 10px;
    }

    #video-controls-overlay .control-btn {
        width: 40px;
        height: 40px;
    }

    #video-controls-overlay .play-pause-btn {
        width: 55px;
        height: 55px;
    }

    #video-controls-overlay .prev-video-btn,
    #video-controls-overlay .next-video-btn {
        width: 38px;
        height: 38px;
    }

    #video-controls-overlay .control-btn i {
        font-size: 14px;
    }

    #video-controls-overlay .play-pause-btn i {
        font-size: 20px;
    }

    #video-controls-overlay .prev-video-btn i,
    #video-controls-overlay .next-video-btn i {
        font-size: 12px;
    }

    #video-controls-overlay .control-btn span {
        font-size: 8px;
    }
}

/* LIVE Badge */
.live-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background-color: #ff0000;
    color: var(--text-on-accent);
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 1;
}

/* Video Duration */
.video-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--text-on-accent);
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
    z-index: 1;
}

/* Container for thumbnail with badges */
.thumbnail-container {
    position: relative;
    width: 80px;
    height: 45px;
    margin-right: 12px;
    flex-shrink: 0;
    cursor: pointer;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    margin-right: 0;
    display: block;
    object-fit: cover;
}

.thumbnail-container img.thumbnail-fallback {
    object-fit: contain;
    background: #18181b;
}

/* ===== 메모/태그 ===== */

/* 메모/태그 보유 표시 배지 (absolute 배치로 레이아웃 영향 없음) */
.list-item .note-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(62, 166, 255, 0.9);
    color: var(--bg-app);
    border-radius: 50%;
    font-size: 8px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* 태그/키워드 필터로 숨겨진 아이템 */
.list-item.tag-hidden,
.list-item.keyword-hidden {
    display: none !important;
}

/* 태그 필터 버튼 활성 상태 */
.icon-checkbox.filter-active {
    color: var(--accent);
}
.icon-checkbox.filter-active i {
    color: var(--accent);
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.7);
}

/* 통합 필터 선택 메뉴 */
.filter-selector-popup {
    display: none;
    position: fixed;
    z-index: 1003;
    min-width: 170px;
    padding: 6px;
    background-color: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
}

.filter-selector-popup.open {
    display: block;
}

.filter-selector-item {
    width: 100%;
    display: grid;
    grid-template-columns: 20px 1fr 16px;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-1);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.filter-selector-item:hover {
    background: var(--bg-hover);
}

.filter-selector-item > i:first-child {
    color: var(--text-2);
    text-align: center;
}

.filter-selector-check {
    visibility: hidden;
    color: var(--accent);
    font-size: 11px;
}

.filter-selector-item.active .filter-selector-check {
    visibility: visible;
}

/* 메모/태그 모달 */
.memo-tag-content {
    max-width: 460px;
}

.memo-tag-title {
    color: var(--link);
    font-size: 13px;
    margin-bottom: 14px;
    word-break: break-all;
}

.memo-tag-field {
    margin-bottom: 16px;
}

.memo-tag-field label {
    display: block;
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 6px;
}

.memo-tag-field textarea,
.memo-tag-field input {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--bg-2);
    border: 1px solid var(--border-strong);
    color: var(--text-1);
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.memo-tag-field textarea:focus,
.memo-tag-field input:focus {
    outline: none;
    border-color: var(--link);
}

.memo-tag-hint {
    color: var(--text-2);
    font-size: 11px;
    margin-top: 6px;
}

/* 태그 입력 자동완성 */
.tags-input-wrap {
    position: relative;
}

.tags-suggest {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 10;
    box-sizing: border-box;
    background-color: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-2);
    max-height: 160px;
    overflow-y: auto;
    padding: 4px;
}

.tags-suggest.open {
    display: block;
}

.tags-suggest-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-1);
    font-size: 13px;
    font-family: inherit;
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.tags-suggest-item:hover,
.tags-suggest-item.active {
    background-color: var(--bg-2);
    color: var(--link);
}

/* 키보드 단축키 치트시트 */
.shortcut-help-content {
    max-width: 380px;
}

/* 이용 가이드 팝업(iframe) */
.guide-modal-content {
    width: 92%;
    max-width: 920px;
    height: 86vh;
    margin: 6vh auto;
    padding: 0;
    overflow: hidden;
    display: flex;
}
#guide-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--r-lg);
    background: var(--bg);
}
.guide-modal-content .close-icon {
    z-index: 2;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-glass);
    border-radius: 50%;
    box-shadow: var(--shadow-glass);
}
@media (max-width: 600px) {
    .guide-modal-content {
        width: 100%;
        max-width: none;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }
    .guide-modal-content #guide-iframe { border-radius: 0; }
}
.shortcut-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--sp-3);
}
.shortcut-table td {
    padding: 7px 4px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    color: var(--text-1);
}
.shortcut-table td:first-child {
    white-space: nowrap;
    width: 40%;
}
.shortcut-table td:last-child {
    color: var(--text-2);
    text-align: right;
}
kbd {
    display: inline-block;
    min-width: 16px;
    padding: 2px 7px;
    margin: 0 1px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    color: var(--text-1);
    background: var(--bg-2);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-sm);
}
/* 단축키 버튼은 터치 환경(모바일)에서 숨김 */
@media screen and (max-width: 768px) {
    #shortcut-help-btn {
        display: none;
    }
}

/* 태그 필터 팝업 */
.tag-filter-popup {
    display: none;
    position: fixed;
    z-index: 1002;
    box-sizing: border-box;
    width: 280px;
    background-color: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    padding: var(--sp-3);
}

.tag-filter-popup.open {
    display: block;
}

.tag-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-1);
    font-size: 13px;
    font-weight: bold;
}

.tag-filter-search {
    box-sizing: border-box;
    width: 100%;
    background-color: var(--bg-2);
    border: 1px solid var(--border-strong);
    color: var(--text-1);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    margin-bottom: 10px;
}

.tag-filter-search:focus {
    outline: none;
    border-color: var(--link);
}

.tag-filter-clear {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter-clear:hover {
    color: var(--text-1);
    border-color: var(--text-3);
}

.tag-filter-header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-filter-close {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 14px;
    padding: 2px 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.tag-filter-close:hover {
    color: var(--text-1);
}

.tag-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.tag-chip {
    background-color: var(--bg-2);
    border: 1px solid var(--border-strong);
    color: var(--text-1);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.tag-chip:hover {
    border-color: var(--link);
}

.tag-chip.selected {
    background-color: var(--link);
    border-color: var(--link);
    color: var(--bg-app);
    font-weight: bold;
}

/* 태그가 없는 영상만 보는 특수 칩 */
.tag-chip.untagged {
    border-style: dashed;
    color: var(--text-2);
}

.tag-chip.untagged.selected {
    border-style: solid;
    color: var(--bg-app);
}

.tag-filter-empty {
    color: var(--text-2);
    font-size: 12px;
    padding: 8px 0;
}

.keyword-filter-hint {
    color: var(--text-3);
    font-size: 11px;
    line-height: 1.5;
}

.keyword-filter-result {
    color: var(--text-2);
    font-size: 12px;
    margin-top: 8px;
}
