/* ============================================================
   BSplus Shorts — 숏츠 스타일 게시판 스킨
   ============================================================ */

/* ── 전역 리셋 ─────────────────────────────────────────────── */
.bsshorts-wrap * { box-sizing: border-box; }
.bsshorts-wrap { margin: 0; padding: 0; }

/* ── 피드 컨테이너 ─────────────────────────────────────────── */
.bsshorts-feed {
    position: relative;
    height: calc(100dvh - var(--bss-hh, 60px));
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    background: #000;
}
.bsshorts-feed::-webkit-scrollbar { display: none; }

/* PC: 가운데 정렬 세로 패널 */
@media (min-width: 600px) {
    .bsshorts-feed {
        max-width: var(--bss-mw, 400px);
        margin: 0 auto;
        height: calc(100dvh - var(--bss-hh, 60px));
        box-shadow: 0 0 40px rgba(0,0,0,.5);
    }
    .bsshorts-feed-bg {
        background: #111;
        min-height: calc(100dvh - var(--bss-hh, 60px));
    }
}

/* ── 개별 카드 ─────────────────────────────────────────────── */
.bsshorts-item {
    position: relative;
    width: 100%;
    height: calc(100dvh - var(--bss-hh, 60px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
}

/* ── 미디어 레이어 ─────────────────────────────────────────── */
.bsshorts-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* 비디오/iframe이 주입되는 컨테이너 — 반드시 부모를 꽉 채워야 함 */
.bsshorts-player {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.bsshorts-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.bsshorts-media iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* 탭으로 재생/정지 */
}

.bsshorts-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    transition: opacity .3s;
}
.bsshorts-thumb.hidden { opacity: 0; pointer-events: none; }

/* 재생 버튼 오버레이 */
.bsshorts-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}
.bsshorts-play-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: opacity .2s, transform .2s;
}
.bsshorts-play-icon svg { width: 28px; height: 28px; fill: #fff; }
.bsshorts-play-icon.playing { opacity: 0; transform: scale(1.3); }

/* ── 그라디언트 ────────────────────────────────────────────── */
.bsshorts-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(0,0,0,.65) 100%
    );
    pointer-events: none;
    z-index: 3;
}

/* ── 오른쪽 액션 버튼 ──────────────────────────────────────── */
.bsshorts-actions {
    position: absolute;
    right: 12px;
    bottom: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 10;
}
.bsshorts-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.bsshorts-btn button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.bsshorts-btn button:active { transform: scale(.92); }
.bsshorts-btn button svg { width: 22px; height: 22px; fill: #fff; }

/* 좋아요 활성 */
.bsshorts-btn button.liked { background: rgba(255, 48, 64, .3); }
.bsshorts-btn button.liked svg { fill: #ff3040; }

/* 수정 링크 버튼 */
.bsshorts-edit-link {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.bsshorts-edit-link:active { transform: scale(.92); }
.bsshorts-edit-link svg { width: 22px; height: 22px; fill: #fff; }

/* ── 하단 정보 영역 ────────────────────────────────────────── */
.bsshorts-info {
    position: absolute;
    bottom: 20px;
    left: 14px;
    right: 76px;
    z-index: 10;
    color: #fff;
}
.bsshorts-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.bsshorts-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    background: #555;
}
.bsshorts-nick {
    font-size: 15px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.bsshorts-title {
    font-size: 14px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0,0,0,.7);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}
.bsshorts-title.expanded { -webkit-line-clamp: unset; }
.bsshorts-more-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.75);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
}

/* ── 댓글 슬라이드업 패널 ──────────────────────────────────── */
.bsshorts-comment-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: #1a1a1a;
    border-radius: 16px 16px 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}
.bsshorts-comment-panel.open { transform: translateY(0); }

.bsshorts-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}
.bsshorts-panel-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.bsshorts-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #333;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bsshorts-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
.bsshorts-panel-body::-webkit-scrollbar { width: 4px; }
.bsshorts-panel-body::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

/* 패널 내 댓글 */
.bsshorts-comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-start;
}
.bsshorts-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #444;
    flex-shrink: 0;
    object-fit: cover;
}
.bsshorts-comment-body { flex: 1; }
.bsshorts-comment-nick {
    font-size: 13px;
    font-weight: 700;
    color: #ccc;
    margin-bottom: 3px;
}
.bsshorts-comment-text {
    font-size: 14px;
    color: #eee;
    line-height: 1.5;
    word-break: break-all;
}
.bsshorts-comment-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    flex-wrap: wrap;
}
.bsshorts-comment-date {
    font-size: 11px;
    color: #666;
    flex: 1;
    min-width: 0;
}
.bsshorts-c-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* 추천/비추천 버튼 */
.bsshorts-c-vote {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.bsshorts-c-vote svg { width: 12px; height: 12px; fill: currentColor; }
.bsshorts-c-vote:hover { background: rgba(255,255,255,.08); color: #ccc; }
.bsshorts-c-vote.up.voted  { color: #fe2c55; }
.bsshorts-c-vote.down.voted { color: #5599ff; }

/* 수정/삭제 버튼 */
.bsshorts-c-edit,
.bsshorts-c-del,
.bsshorts-c-confirm,
.bsshorts-c-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    transition: color .15s, background .15s;
}
.bsshorts-c-edit svg,
.bsshorts-c-del svg,
.bsshorts-c-confirm svg,
.bsshorts-c-cancel svg { width: 13px; height: 13px; fill: currentColor; }
.bsshorts-c-edit:hover  { color: #aaa; background: rgba(255,255,255,.08); }
.bsshorts-c-del:hover   { color: #fe2c55; background: rgba(254,44,85,.12); }
.bsshorts-c-confirm:hover { color: #4caf50; background: rgba(76,175,80,.12); }
.bsshorts-c-cancel:hover  { color: #aaa; background: rgba(255,255,255,.08); }

/* 인라인 수정 입력 */
.bsshorts-comment-edit-input {
    width: 100%;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 14px;
    color: #fff;
    outline: none;
    margin: 2px 0;
}
.bsshorts-comment-edit-input:focus { border-color: #fe2c55; }

.bsshorts-no-comment {
    text-align: center;
    color: #666;
    padding: 40px 0;
    font-size: 14px;
}

.bsshorts-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid #2a2a2a;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    background: #1a1a1a;
}
.bsshorts-comment-input {
    flex: 1;
    background: #2a2a2a;
    border: none;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    color: #fff;
    outline: none;
}
.bsshorts-comment-input::placeholder { color: #666; }
.bsshorts-comment-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #fe2c55;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.bsshorts-comment-send:hover { background: #e0253c; }
.bsshorts-comment-send svg { width: 18px; height: 18px; fill: #fff; }

/* 댓글 패널 dim */
.bsshorts-panel-dim {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 19;
    display: none;
}
.bsshorts-panel-dim.show { display: block; }

/* ── 로딩 스피너 ───────────────────────────────────────────── */
.bsshorts-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}
.bsshorts-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bsshorts-spin .7s linear infinite;
}
@keyframes bsshorts-spin { to { transform: rotate(360deg); } }

/* ── 무한 스크롤 센티넬 ────────────────────────────────────── */
.bsshorts-sentinel {
    height: 1px;
    scroll-snap-align: none;
}

/* ── 목록 없음 ─────────────────────────────────────────────── */
.bsshorts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    gap: 12px;
}
.bsshorts-empty svg { width: 48px; height: 48px; fill: #444; }
.bsshorts-empty p { font-size: 16px; }

/* ── 상단 툴바 ──────────────────────────────────────────────── */
.bsshorts-topbar {
    width: 100%;
    background: #111;
    border-top: 1px solid #2a2a2a;
    display: flex;
    justify-content: center;
}
.bsshorts-topbar-title {
    display: none;
}
.bsshorts-topbar-actions {
    width: 100%;
    max-width: var(--bss-mw, 400px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
}
.bsshorts-setting-btn {
    position: static;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s, background .15s;
    padding: 0;
}
.bsshorts-setting-btn:hover,
.bsshorts-setting-btn.open { transform: rotate(90deg); background: rgba(60,60,60,.9); }
.bsshorts-setting-btn svg { width: 18px; height: 18px; fill: #ccc; }
.bsshorts-write-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fe2c55;
    color: #fff;
    border-radius: 20px;
    padding: 7px 14px 7px 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s, transform .15s;
    white-space: nowrap;
}
.bsshorts-write-btn:hover { background: #e0253c; transform: scale(1.04); color: #fff; }
.bsshorts-write-btn svg { width: 16px; height: 16px; fill: #fff; flex-shrink: 0; }
.bsshorts-doc-del-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,48,64,.12);
    color: #ff5060;
    border: 1px solid rgba(255,48,64,.3);
    border-radius: 20px;
    padding: 7px 14px 7px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.bsshorts-doc-del-btn:hover { background: rgba(255,48,64,.25); }
.bsshorts-doc-del-btn svg { width: 16px; height: 16px; fill: #ff5060; flex-shrink: 0; }

/* ── 설정 패널 오버레이 ──────────────────────────────────────── */
.bsshorts-cfg-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 200;
}
.bsshorts-cfg-overlay.open { display: block; }

/* ── 설정 패널 바텀 시트 ─────────────────────────────────────── */
.bsshorts-cfg-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: var(--bss-mw, 400px);
    background: #1c1c1c;
    border-radius: 16px 16px 0 0;
    padding: 8px 20px 28px;
    z-index: 201;
    transition: transform .28s cubic-bezier(.32,0,.67,0);
    box-shadow: 0 -4px 24px rgba(0,0,0,.5);
}
.bsshorts-cfg-sheet.open {
    transform: translateX(-50%) translateY(0);
    transition-timing-function: cubic-bezier(.33,1,.68,1);
}

/* 드래그 핸들 */
.bsshorts-cfg-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #444;
    margin: 0 auto 12px;
}

/* 헤더 */
.bsshorts-cfg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.bsshorts-cfg-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}
.bsshorts-cfg-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.bsshorts-cfg-close svg { width: 18px; height: 18px; fill: #aaa; }
.bsshorts-cfg-close:hover { background: rgba(255,255,255,.2); }

/* 행 */
.bsshorts-cfg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
}
.bsshorts-cfg-row-select { cursor: default; }
.bsshorts-cfg-label {
    font-size: 15px;
    color: #ddd;
    user-select: none;
}

/* 토글 스위치 */
.bsshorts-cfg-sw-wrap { position: relative; display: inline-flex; align-items: center; }
.bsshorts-cfg-chk {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.bsshorts-cfg-sw {
    display: inline-block;
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background: #444;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
    pointer-events: none;
}
.bsshorts-cfg-sw::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.bsshorts-cfg-chk:checked + .bsshorts-cfg-sw { background: #25d06e; }
.bsshorts-cfg-chk:checked + .bsshorts-cfg-sw::after { transform: translateX(20px); }

/* 셀렉트 */
.bsshorts-cfg-select {
    background: #2a2a2a;
    color: #ddd;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}
.bsshorts-cfg-select:focus { border-color: #555; }

/* 정렬 새로고침 버튼 */
.bsshorts-cfg-reload {
    display: none;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: #25d06e;
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.bsshorts-cfg-reload:hover { opacity: .85; }

/* ── 공유 토스트 ───────────────────────────────────────────── */
.bsshorts-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30,30,30,.95);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
}
.bsshorts-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── 전체화면 버튼 (가로 영상 전용) ────────────────────────── */
.bsshorts-fs-btn {
    display: none;
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0,0,0,.45);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background .15s;
    padding: 0;
}
.bsshorts-item--landscape .bsshorts-fs-btn { display: flex; }
.bsshorts-fs-btn:hover { background: rgba(0,0,0,.65); }
.bsshorts-fs-btn svg { width: 18px; height: 18px; fill: #fff; }

/* 전체화면 상태에서 video 크기 보정 */
video:fullscreen,
video:-webkit-full-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* ── 음소거 표시 ───────────────────────────────────────────── */
.bsshorts-mute-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    background: rgba(0,0,0,.45);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.bsshorts-mute-badge svg { width: 18px; height: 18px; fill: #fff; }

/* ── 글쓰기 폼 ─────────────────────────────────────────────── */
.bsshorts-write-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
    color: #222;
}
.bsshorts-write-wrap h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}
.bsshorts-form-group {
    margin-bottom: 16px;
}
.bsshorts-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.bsshorts-form-group input[type=text],
.bsshorts-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}
.bsshorts-form-group input:focus,
.bsshorts-form-group textarea:focus { border-color: #fe2c55; }

.bsshorts-upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafafa;
}
.bsshorts-upload-area:hover { border-color: #fe2c55; background: #fff5f5; }
.bsshorts-upload-area.drag-over { border-color: #fe2c55; background: #fff0f2; border-style: solid; }
.bsshorts-upload-area.drag-over svg { fill: #fe2c55; }
.bsshorts-upload-area svg { width: 40px; height: 40px; fill: #ccc; margin-bottom: 8px; transition: fill .2s; }
.bsshorts-upload-area p { color: #888; font-size: 14px; margin: 0; }
.bsshorts-upload-area input[type=file] { display: none; }

.bsshorts-yt-divider {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    margin: 12px 0;
    position: relative;
}
.bsshorts-yt-divider::before,
.bsshorts-yt-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e5e5e5;
}
.bsshorts-yt-divider::before { left: 0; }
.bsshorts-yt-divider::after { right: 0; }

.bsshorts-submit-btn {
    width: 100%;
    padding: 14px;
    background: #fe2c55;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background .15s;
}
.bsshorts-submit-btn:hover { background: #e0253c; }
