/* ==========================================================================
   Visitor Viewer
   lbot_v7 코치 페이지와 동일한 UI/UX
   ========================================================================== */

/* lbot_v7 동일: body 스크롤 제거, 내부 영역에서만 스크롤 */
html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    background: hsl(var(--st-bg)) !important;
}

/* ===== Coach Navbar (lbot_v7 동일) ===== */
.coach-navbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--st-navbar-height);
    background: hsl(var(--st-bg));
    border-bottom: 1px solid hsl(var(--st-line));
}

.coach-navbar__inner {
    height: 100%;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 46px;
}

.coach-navbar__brand {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* 로고 라이트/다크 전환 */
.logo-light {
    display: inline-block;
}

.logo-dark {
    display: none;
}

.dark .logo-light {
    display: none;
}

.dark .logo-dark {
    display: inline-block;
}

.coach-navbar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
}

.coach-navbar__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: hsl(var(--st-fg));
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.coach-navbar__action:hover {
    background: hsl(var(--st-muted));
    color: hsl(var(--st-brand));
}

/* ===== 설정 드롭다운 (lbot_v7 동일) ===== */
.coach-navbar__dropdown {
    position: relative;
}

.coach-navbar__dropdown .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: hsl(var(--st-fg));
    cursor: pointer;
    transition: color 0.2s ease;
}

.coach-navbar__dropdown .dropdown-toggle:hover {
    color: hsl(var(--st-brand));
}

.coach-navbar__dropdown .gear-icon {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
    transform-origin: center;
}

.coach-navbar__dropdown .gear-icon i {
    font-size: 1.0rem;
}

.coach-navbar__dropdown .dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 170px;
    width: auto;
    background: hsl(var(--st-card));
    border: 1px solid hsl(var(--st-line));
    border-radius: 14px;
    box-shadow: var(--st-shadow-card);
    overflow: hidden;
    z-index: 120;
}

.dropdown-menu__body {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.dropdown-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    color: hsl(var(--st-fg));
    font-size: 14px;
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-menu__item i {
    font-size: 1rem;
    color: hsl(var(--st-fg) / 0.7);
}

.dropdown-menu__item:hover {
    background: hsl(var(--st-muted));
    color: hsl(var(--st-brand));
}

.dropdown-menu__divider {
    height: 1px;
    background: linear-gradient(to right, transparent, hsl(var(--st-line)), transparent);
    margin: 6px 0;
}

/* ===== 페이지 타이틀 ===== */
.viewer-page-title {
    padding: 16px 16px 8px;
    width: 100%;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.viewer-page-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--st-fg));
    margin-top: 10px;
    margin-bottom: 5px;
    line-height: 1.4;
    text-align: left;
}

/* ===== 랜딩 페이지 타이틀 ===== */
.landing-page-title {
    padding: 2px 5px 40px 5px;
    width: 100%;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
}

.landing-page-title__name {
    font-size: 1.35rem;
    font-weight: 700;
    color: hsl(var(--st-fg));
    margin: 0;
    line-height: 1.4;
    text-align: left;
}

/* ===== 랜딩 공지사항 ===== */
.landing-notice {
    margin-top: 12px;
    padding: 4px 0 4px 14px;
    border-left: 1px solid hsl(var(--st-fg) / 0.4);
    font-size: 0.85rem;
    line-height: 1.4 !important;
    color: hsl(var(--st-fg) / 0.6);
}

.landing-notice p {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.4 !important;
}

/* ===== 랜딩 CTA 버튼 ===== */
.landing-cta-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.landing-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--st-line));
    background: hsl(var(--st-card));
    color: hsl(var(--st-fg));
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.landing-cta-btn:hover {
    background: hsl(var(--st-brand) / 0.1);
    border-color: hsl(var(--st-brand) / 0.4);
    color: hsl(var(--st-brand));
}

.landing-cta-btn i {
    font-size: 0.85rem;
}

/* ===== 공지사항 필 버튼 ===== */
.notice-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 8px 12px;
    border: none;
    border-radius: 9999px;
    background: hsl(var(--st-brand));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.notice-pill-btn:hover {
    opacity: 0.85;
}

.notice-pill-btn i {
    font-size: 0.7rem;
}

/* ===== 공지사항 모달 ===== */
.notice-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.notice-modal-overlay.active {
    display: flex;
}

.notice-modal {
    background: hsl(var(--st-bg));
    border: 1px solid hsl(var(--st-line));
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: noticeModalIn 0.2s ease-out;
}

@keyframes noticeModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notice-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--st-line));
    flex-shrink: 0;
}

.notice-modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: hsl(var(--st-fg));
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice-modal-header h2 i {
    color: hsl(var(--st-brand));
}

.notice-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: hsl(var(--st-muted-fg));
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.notice-modal-close:hover {
    background: hsl(var(--st-muted));
    color: hsl(var(--st-fg));
}

.notice-modal-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    color: hsl(var(--st-fg));
}

/* ===== 파일 탭 ===== */
.file-tabs-wrap {
    position: relative;
    border-bottom: 1px solid hsl(var(--st-line));
}

.file-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    background: hsl(var(--st-bg));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

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

.file-tabs-arrow {
    position: absolute;
    top: 0;
    bottom: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    border: none;
    background: hsl(var(--st-bg));
    color: hsl(var(--st-fg) / 0.5);
    cursor: pointer;
    z-index: 2;
    transition: color 0.15s;
}

.file-tabs-arrow:hover {
    color: hsl(var(--st-fg));
}

.file-tabs-arrow--left {
    left: 0;
    box-shadow: 4px 0 8px -2px hsl(var(--st-fg) / 0.08);
}

.file-tabs-arrow--right {
    right: 0;
    box-shadow: -4px 0 8px -2px hsl(var(--st-fg) / 0.08);
}

.file-tabs-arrow[hidden] {
    display: none !important;
}

.file-tabs-inner {
    display: flex;
    gap: 0;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.file-tab {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: none;
    border: none;
    font-size: 13px;
    color: hsl(var(--st-fg) / 0.6);
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.file-tab:hover {
    color: hsl(var(--st-fg));
}

.file-tab.active {
    color: hsl(var(--st-brand));
    font-weight: 600;
}

.file-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: hsl(var(--st-brand));
    border-radius: 2px 2px 0 0;
}

.file-tab i {
    font-size: 13px;
}

/* ===== 토글 버튼 (lbot_v7 toggle-buttons 스타일) ===== */
.toggle-buttons.content-block {
    padding: 0;
}

.toggle-buttons {
    background: hsl(var(--st-bg));
}

.toggle-buttons-inner {
    display: flex;
    justify-content: center;
    gap: 4px;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
    padding: 8px 16px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid hsl(var(--st-line));
    background: transparent;
    color: hsl(var(--st-fg) / 0.7);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn:hover {
    background: hsl(var(--st-fg) / 0.05);
}

.toggle-btn.active {
    background: hsl(var(--st-brand));
    color: white;
    border-color: transparent;
}

.toggle-btn i {
    font-size: 12px;
}

/* ===== 콘텐츠 영역 ===== */
.viewer-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: hsl(var(--st-bg));
}

.content-block {
    display: none;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.content-block.active {
    display: block;
}

/* prose max-width 해제 (전체 폭 사용) */
.viewer-content .prose {
    max-width: none;
}

/* ===== 챗봇 플로팅 버튼 (lbot_v7 동일: position fixed) ===== */
.chatbot-floating-btn {
    position: fixed;
    bottom: 24px;
    right: max(24px, calc((100vw - var(--st-container-max-width)) / 2 + 24px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: hsl(var(--st-brand));
    color: white;
    border: none;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.chatbot-floating-btn.active {
    background: hsl(var(--st-fg));
    color: hsl(var(--st-bg));
}

.chatbot-floating-btn.hidden {
    display: none;
}

/* 플로팅 버튼 어텐션 효과 (JS에서 .nudge 클래스로 제어) */
@keyframes chatbot-nudge {

    0%,
    100% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.12);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.08);
    }

    60% {
        transform: scale(1);
    }
}

.chatbot-floating-btn.nudge {
    animation: chatbot-nudge 1.2s ease-in-out;
}

/* 드래그/클릭 힌트 말풍선 */
.chatbot-hint-bubble {
    position: fixed;
    bottom: 32px;
    right: max(90px, calc((100vw - var(--st-container-max-width)) / 2 + 90px));
    background: hsl(var(--st-bg));
    color: hsl(var(--st-fg));
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 999;
    pointer-events: none;
}

.chatbot-hint-bubble.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ===== 챗봇 패널 - PC (플로팅) ===== */
.chatbot-panel {
    display: none;
    flex-direction: column;
    z-index: 99;
}

.chatbot-panel.open {
    display: flex;
}

/* ===== 챗봇 탭 바 ===== */
.chatbot-tabs {
    display: flex;
    border-bottom: 1px solid hsl(var(--st-line));
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chatbot-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 8px;
    font-size: 13px;
    text-align: center;
    border: none;
    background: none;
    color: hsl(var(--st-fg) / 0.5);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}

.chatbot-tab-btn:hover {
    color: hsl(var(--st-fg) / 0.8);
}

.chatbot-tab-btn.active {
    color: hsl(var(--st-brand));
    border-bottom-color: hsl(var(--st-brand));
    font-weight: 600;
}

.chatbot-tab-btn i {
    font-size: 14px;
}

/* ===== 탭 콘텐츠 ===== */
.chatbot-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.chatbot-tab-content.active {
    display: flex;
}

/* ===== 상담 폼 공통 ===== */
.consult-form-wrapper {
    padding: 20px 16px;
    overflow-y: auto;
    flex: 1;
}

.consult-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 0 24px;
}

.consult-profile__avatar {
    max-width: 100%;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.consult-profile__name {
    font-size: 15px;
    font-weight: 600;
    color: hsl(var(--st-fg));
}

.consult-form-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: hsl(var(--st-fg));
}

.consult-form-header i {
    font-size: 20px;
    color: hsl(var(--st-brand));
}

.consult-form-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.consult-form-desc {
    font-size: 13px;
    color: hsl(var(--st-fg) / 0.6);
    margin-bottom: 20px;
    line-height: 1.5;
}

.consult-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.consult-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.consult-field label {
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--st-fg) / 0.8);
}

.consult-field .required {
    color: hsl(var(--st-brand));
}

.consult-field input,
.consult-field textarea {
    padding: 10px 12px;
    border: 1px solid hsl(var(--st-line));
    border-radius: 8px;
    background: hsl(var(--st-bg));
    color: hsl(var(--st-fg));
    font-size: 14px;
    transition: border-color 0.2s;
    resize: none;
}

.consult-field input:focus,
.consult-field textarea:focus {
    outline: none;
    border-color: hsl(var(--st-brand));
    box-shadow: 0 0 0 2px hsl(var(--st-brand) / 0.15);
}

.consult-submit-btn {
    margin-top: 4px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: hsl(var(--st-brand));
    color: hsl(var(--st-brand-fg));
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.consult-submit-btn:hover {
    opacity: 0.9;
}

.consult-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.consult-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.consult-success.hidden {
    display: none;
}

.consult-success i {
    font-size: 48px;
    color: #22c55e;
}

.consult-success p {
    font-size: 15px;
    color: hsl(var(--st-fg));
    font-weight: 500;
}

/* ===== SNS 리스트 ===== */
.sns-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sns-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid hsl(var(--st-line));
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    color: hsl(var(--st-fg));
}

.sns-item:hover {
    background: hsl(var(--st-fg) / 0.03);
    border-color: hsl(var(--st-brand) / 0.4);
}

.sns-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: hsl(var(--st-brand) / 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sns-item-icon i {
    font-size: 18px;
    color: hsl(var(--st-brand));
}

.sns-item-name {
    font-size: 14px;
    font-weight: 500;
}

.sns-item-arrow {
    margin-left: auto;
    color: hsl(var(--st-fg) / 0.3);
    font-size: 14px;
}

@media (min-width: 769px) {
    .chatbot-panel-header {
        display: none;
    }

    .chatbot-panel {
        position: fixed;
        bottom: 90px;
        right: max(24px, calc((100vw - var(--st-container-max-width)) / 2 + 24px));
        width: 460px;
        height: 700px;
        max-height: calc(100dvh - 90px - 24px);
        border-radius: 12px;
        background: hsl(var(--st-bg));
        border: 1px solid hsl(var(--st-line));
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    .chatbot-panel .messages-container {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .chatbot-panel .input-wrapper {
        flex-shrink: 0;
    }

    .dark .chatbot-panel {
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 24px rgba(255, 255, 255, 0.08), 0 8px 48px rgba(255, 255, 255, 0.05);
    }
}

/* ===== 챗봇 패널 - 모바일 (전체화면) ===== */
@media (max-width: 768px) {
    .chatbot-panel {
        position: fixed;
        inset: 0;
        background: hsl(var(--st-bg));
        z-index: 200;
    }

    .chatbot-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        border-bottom: 1px solid hsl(var(--st-line));
        flex-shrink: 0;
    }

    .chatbot-header-title {
        font-size: 15px;
        font-weight: 600;
        color: hsl(var(--st-fg));
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .chatbot-header-title i {
        font-size: 16px;
    }

    .chatbot-close-btn {
        background: none;
        border: 1px solid hsl(var(--st-fg) / 0.2);
        color: hsl(var(--st-fg) / 0.6);
        font-size: 13px;
        cursor: pointer;
        padding: 4px 12px;
        border-radius: 6px;
        transition: background 0.15s ease, border-color 0.15s ease;
    }

    .chatbot-close-btn:hover {
        background: hsl(var(--st-fg) / 0.05);
        border-color: hsl(var(--st-fg) / 0.3);
    }
}

/* 텍스트 콘텐츠 패널 (요약/자막/전문) */
.panel-text-content {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
    color: hsl(var(--st-fg));
    font-size: 0.95rem;
    line-height: 1.75;
}

.transcript-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.8;
    color: hsl(var(--st-fg) / 0.85);
    margin: 0;
    background: transparent;
}

/* 콘텐츠 패널 내부 스크롤 */
.panel-content-scroll {
    overflow-y: auto;
    height: 100%;
}

/* ===== Main Content (전체 너비) ===== */
.viewer-main {
    width: 100%;
    overflow-y: auto;
    background: hsl(var(--st-bg));
}

/* ===== Content Sections ===== */
.content-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.content-document {
    overflow: hidden;
}

/* ===== 커스텀 오디오 플레이어 ===== */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 9999px;
    background: hsl(var(--st-brand) / 0.08);
    border: 1px solid hsl(var(--st-brand) / 0.15);
}

.dark .custom-audio-player {
    background: hsl(var(--st-brand) / 0.12);
    border-color: hsl(var(--st-brand) / 0.2);
}

.cap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: hsl(var(--st-brand));
    color: white;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.cap-btn:hover {
    opacity: 0.85;
}

.cap-mute {
    background: transparent;
    color: hsl(var(--st-brand));
    font-size: 18px;
}

.cap-mute:hover {
    opacity: 0.7;
}

.cap-time {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: hsl(var(--st-fg) / 0.6);
    flex-shrink: 0;
    min-width: 34px;
    text-align: center;
}

.cap-progress {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
}

.cap-progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: hsl(var(--st-brand) / 0.15);
    position: relative;
    overflow: hidden;
}

.dark .cap-progress-bar {
    background: hsl(var(--st-brand) / 0.25);
}

.cap-progress-filled {
    height: 100%;
    width: 0%;
    background: hsl(var(--st-brand));
    border-radius: 2px;
    transition: width 0.1s linear;
}

.content-video .video-wrapper {
    background: #000;
    position: relative;
}

.content-video .video-wrapper video {
    max-height: 60vh;
    margin: 0 auto;
    display: block;
    width: 100%;
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.2s;
}

.video-play-overlay svg {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s;
}

.video-play-overlay:hover svg {
    transform: scale(1.1);
}

.video-play-overlay.hidden {
    display: none;
}

.content-text-content {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

/* ==========================================================================
   PDF Viewer (lbot_v7 media.css 동일)
   ========================================================================== */
.pdf-container {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    background: transparent !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-gutter: stable both-edges;
}

.pdf-container canvas {
    background: transparent !important;
}

.pdf-container .page {
    background: transparent !important;
}

.pdf-text-layer {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    pointer-events: auto !important;
}

.pdf-text-layer span {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    pointer-events: auto !important;
    cursor: text !important;
}

.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    user-select: none !important;
    pointer-events: none !important;
    z-index: 2;
    cursor: text !important;
    font-family: inherit;
}

.textLayer span {
    transform: scale(var(--scale-factor, 1));
    transform-origin: 0 0;
    user-select: none !important;
    pointer-events: none !important;
    cursor: text !important;
    color: transparent !important;
    position: absolute !important;
    white-space: pre !important;
    font-family: inherit !important;
}

/* PDF annotation layer (링크 클릭 지원) */
.annotationLayer {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    pointer-events: none;
}

.annotationLayer a {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 0;
    transition: opacity 0.15s;
}

.annotationLayer a:hover {
    opacity: 0.1;
    background-color: hsl(var(--st-brand, 210 100% 50%));
}

.page-wrapper {
    position: relative;
    background: transparent !important;
    cursor: text;
}

.page-wrapper canvas {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    background: transparent !important;
    cursor: text;
}

.pdf-container .page-container {
    max-width: 100%;
    box-sizing: border-box;
}

.pdf-container .page-container .page-wrapper {
    max-width: 100%;
    box-sizing: border-box;
}

/* PDF Figure */
.pdf-figure {
    margin: 0;
    padding: 0 calc(var(--st-pdf-padding-horizontal-desktop) + var(--st-pdf-scroll-gap)) 0 var(--st-pdf-padding-horizontal-desktop);
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent !important;
    height: 100%;
    max-height: 100%;
}

@media (max-width: 768px) {
    .pdf-figure {
        padding: 0 calc(var(--st-pdf-padding-horizontal-mobile) + var(--st-pdf-scroll-gap)) 0 var(--st-pdf-padding-horizontal-mobile);
        height: 100%;
        max-height: 100%;
    }
}

/* PDF 스크롤바 */
.pdf-figure::-webkit-scrollbar {
    width: var(--st-scrollbar-width);
}

.pdf-figure::-webkit-scrollbar-track {
    background: transparent;
}

.pdf-figure::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.66);
    border-radius: var(--st-scrollbar-thumb-radius);
}

.pdf-figure::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.dark .pdf-figure::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.186);
}

.dark .pdf-figure::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* PDF 줌 컨트롤 */
.pdf-zoom-controls {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 2px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    transition: opacity 0.2s;
    opacity: 0.7;
}

.pdf-zoom-controls:hover {
    opacity: 1;
}

.pdf-zoom-btn,
.pdf-zoom-level {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    color: #555;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
}

.pdf-zoom-btn {
    width: 32px;
    height: 32px;
    padding: 0;
}

.pdf-zoom-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
    color: #222;
}

.pdf-zoom-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.pdf-zoom-level {
    font-size: 12px;
    font-weight: 500;
    min-width: 44px;
    height: 32px;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}

.pdf-zoom-level:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #222;
}

/* 다크모드 */
.dark .pdf-zoom-controls {
    background: rgba(30, 30, 30, 0.92);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .pdf-zoom-btn,
.dark .pdf-zoom-level {
    color: #aaa;
}

.dark .pdf-zoom-btn:hover:not(:disabled),
.dark .pdf-zoom-level:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ddd;
}

/* 모바일 */
@media (max-width: 768px) {
    .pdf-zoom-controls {
        bottom: 80px;
        left: 16px;
    }

    .pdf-zoom-btn {
        width: 36px;
        height: 36px;
    }

    .pdf-zoom-level {
        height: 36px;
        font-size: 13px;
    }
}

/* --------------------------------------------------------------------------
   PDF 로딩 스피너 (lbot_v7 동일)
   -------------------------------------------------------------------------- */
.pdf-inline-spinner {
    background: transparent !important;
    backdrop-filter: none !important;
    z-index: 1000 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    inset: unset !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0;
    animation: pdf-spinner-fade-in 0.18s ease-out forwards;
    animation-delay: 60ms;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.pdf-inline-spinner>div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

@keyframes pdf-loading-dot {
    0% {
        transform: translateX(-12px);
        opacity: 0.4;
    }

    40% {
        transform: translateX(0);
        opacity: 1;
    }

    80% {
        transform: translateX(12px);
        opacity: 0.4;
    }

    100% {
        transform: translateX(12px);
        opacity: 0.4;
    }
}

.pdf-inline-spinner .loading-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    background-color: hsl(var(--st-brand)) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    animation: pdf-loading-dot 1.2s ease-in-out infinite !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
}

.pdf-inline-spinner .loading-dot:nth-child(1) {
    animation-delay: 0s !important;
}

.pdf-inline-spinner .loading-dot:nth-child(2) {
    animation-delay: 0.15s !important;
}

.pdf-inline-spinner .loading-dot:nth-child(3) {
    animation-delay: 0.3s !important;
}

@keyframes pdf-spinner-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pdf-inline-spinner {
        animation: none;
        opacity: 1;
    }
}

.dark .pdf-inline-spinner .loading-dot {
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2) !important;
}

/* 챗봇은 플로팅 방식으로 동작 (PC: 플로팅 패널, 모바일: 전체화면) */

/* ==========================================================================
   Messages (lbot_v7 chat.css 동일)
   ========================================================================== */
.messages-container {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--st-message-gap);
    animation: fadeIn 0.4s ease-in;
}

/* 채팅 메시지 래퍼 */
.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/*
 * [주의] assistant 메시지는 display: block을 사용한다 (flex 아님).
 * .chat-message의 기본값은 display: flex이지만, assistant bubble 안의
 * <ol> + <li><p>...<ul>...</ul></li> 같은 복잡한 리스트 구조가 flex item
 * 내부에 있을 때 Chrome이 높이를 잘못 계산해서 뒤따르는 .message-sources
 * (근거자료)가 본문과 겹쳐 보이는 렌더링 버그가 있다. (2026-03-13)
 */
.chat-message.assistant {
    display: block;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-time {
    font-size: 11px;
    color: hsl(var(--st-fg) / 0.3);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}

/* 채팅 버블 (lbot_v7 동일) */
.chat-bubble {
    max-width: 70%;
    padding: 6px 16px;
    border-radius: 8px;
    background: hsl(var(--st-card));
    border: 1px solid hsl(var(--st-line) / 0.3);
    word-wrap: break-word;
}

.chat-bubble.assistant {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    line-height: 1.75;
}

.chat-bubble.user {
    margin: 20px 0 0 0 !important;
    background: hsl(var(--st-brand)) !important;
    color: white !important;
    border-color: hsl(var(--st-brand)) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.chat-bubble.user .text-content,
.chat-bubble.user .html-content {
    text-align: left !important;
    width: 100%;
    color: white !important;
}

/* 직접 작성 텍스트 */
.text-content {
    font-size: 1rem;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    line-height: 1.6 !important;
}

/*
 * 마크다운 렌더링 스타일.
 * 이전에는 .chat-bubble .html-content .md 셀렉터를 사용했으나,
 * .html-content, .md 래퍼 div를 제거하면서 (Chrome 높이 계산 버그 우회)
 * .chat-bubble.assistant에 직접 적용하도록 변경. (2026-03-13)
 */
.chat-bubble.assistant h1,
.chat-bubble.assistant h2,
.chat-bubble.assistant h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.chat-bubble.assistant h1 {
    font-size: 1.125rem;
}

.chat-bubble.assistant h2 {
    font-size: 1rem;
}

.chat-bubble.assistant h3 {
    font-size: 0.9375rem;
}

.chat-bubble.assistant>p {
    margin-bottom: 0.5rem;
}

.chat-bubble.assistant>ul,
.chat-bubble.assistant>ol {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}

.chat-bubble.assistant ul ul,
.chat-bubble.assistant ul ol,
.chat-bubble.assistant ol ul,
.chat-bubble.assistant ol ol {
    padding-left: 1rem;
    margin-bottom: 0;
}

.chat-bubble.assistant li {
    margin-bottom: 0.25rem;
}

.chat-bubble.assistant li p {
    margin-bottom: 0.25rem;
}

/* 마크다운 본문 내 링크만 (근거자료 .message-sources 내부 링크는 제외) */
.chat-bubble.assistant>p a,
.chat-bubble.assistant>ol a,
.chat-bubble.assistant>ul a {
    color: hsl(var(--st-brand));
    text-decoration: underline;
}

.chat-bubble.assistant hr {
    border: none;
    border-top: 1px solid hsl(var(--st-line));
    margin: 1.25rem 0;
}

.chat-bubble.assistant code {
    background: hsl(var(--st-fg) / 0.06);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
}

.dark .chat-bubble.assistant code {
    background: hsl(var(--st-fg) / 0.1);
}

.chat-bubble.assistant table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.chat-bubble.assistant table th,
.chat-bubble.assistant table td {
    border: 1px solid hsl(var(--st-line));
    padding: 0.5rem;
    text-align: left;
}

.chat-bubble.assistant table th {
    background-color: hsl(var(--st-muted));
    font-weight: bold;
}

/* Code blocks */
.chat-bubble .code-block {
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid hsl(var(--st-line));
}

.chat-bubble .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: hsl(var(--st-muted));
    font-size: 0.75rem;
    color: hsl(var(--st-fg) / 0.6);
}

.chat-bubble .code-copy-btn {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: hsl(var(--st-fg) / 0.6);
    cursor: pointer;
    background: transparent;
    border: none;
}

.chat-bubble .code-copy-btn:hover {
    background: hsl(var(--st-line));
}

.chat-bubble .code-block pre {
    margin: 0;
    padding: 0.75rem;
    overflow-x: auto;
    font-size: 0.8125rem;
    background: hsl(var(--st-bg));
}

/* ==========================================================================
   Chat Input (lbot_v7 input.css 동일)
   ========================================================================== */
.input-wrapper {
    position: sticky;
    bottom: var(--st-input-bottom-offset);
    z-index: 100;
    padding: 0 var(--st-input-padding-horizontal);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), var(--st-input-bottom-padding));
    background: transparent;
    flex-shrink: 0;
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid hsl(var(--st-line));
    border-radius: var(--st-input-border-radius);
    padding: var(--st-input-padding-internal);
    background: hsl(var(--st-bg));
    background-color: hsl(var(--st-bg));
    box-shadow: var(--st-shadow-lg);
    transition: var(--st-transition-fast);
}

.input-box:focus-within {
    border-color: hsl(var(--st-line) / 0.8);
    box-shadow: 0 0 0 2px hsl(var(--st-fg) / 0.05), var(--st-shadow-lg);
}

.input-field {
    width: calc(100% - 40px);
    min-height: var(--st-input-field-min-height);
    max-height: var(--st-input-field-max-height);
    padding: 8px 76px 8px 16px !important;
    border: 0;
    outline: 0;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    line-height: var(--st-input-field-line-height);
    background: transparent;
    color: hsl(var(--st-fg));
    vertical-align: middle;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--st-line)) transparent;
}

.input-field::-webkit-scrollbar {
    width: 2px;
}

.input-field::-webkit-scrollbar-track {
    background: transparent;
}

.input-field::-webkit-scrollbar-thumb {
    background: hsl(var(--st-line));
    border-radius: 2px;
}

.input-field::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--st-fg) / 0.3);
}

.input-field::placeholder {
    color: hsl(var(--st-fg) / 0.5);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.clear-button {
    position: absolute;
    top: 50%;
    right: var(--st-input-clear-button-right);
    transform: translateY(-50%);
    padding: 2px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: hsl(var(--st-fg) / 0.3);
    cursor: pointer;
    font-size: 24px;
    transition: opacity 0s, visibility 0s, background 0.2s ease, color 0.2s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    visibility: visible;
}

.clear-button:hover:not(:disabled) {
    background: transparent;
    color: hsl(var(--st-fg));
}

.clear-button:disabled {
    opacity: 0;
    visibility: hidden;
    cursor: not-allowed;
    pointer-events: none;
}

.send-button {
    position: absolute;
    right: var(--st-input-send-button-right);
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 24px !important;
    color: hsl(var(--st-fg) / 0.6);
    padding: 2px;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    transition: var(--st-transition-fast);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover:not(:disabled) {
    color: hsl(var(--st-brand));
    transform: translateY(-50%) scale(1.1);
}

.send-button:not(:disabled) {
    color: hsl(var(--st-brand));
    background: transparent;
    box-shadow: none;
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    box-shadow: none;
}

.input-hint {
    margin: 2px 0;
    font-size: 10px;
    color: hsl(var(--st-fg) / 0.4);
    text-align: center;
    line-height: 1.2;
}

/* ==========================================================================
   Loading Indicator (lbot_v7 동일)
   ========================================================================== */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.loading-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: hsl(var(--st-fg) / 0.4);
    animation: loading-pulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-pulse {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: scale(0.9);
    }

    30% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Streaming indicator */
.streaming-indicator {
    display: inline-block;
    width: 6px;
    height: 14px;
    background: hsl(var(--st-brand));
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
    border-radius: 1px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================================================
   Skeleton Loader (lbot_v7 동일)
   ========================================================================== */
.messages-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--st-message-gap, 1.5rem);
    padding: 1rem;
    animation: fadeIn 0.3s ease-in;
}

.messages-skeleton.hidden {
    display: none;
}

.skeleton-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-message.skeleton-user {
    flex-direction: row-reverse;
}

.skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: hsl(var(--st-muted));
    flex-shrink: 0;
}

.skeleton-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 8px;
    background: hsl(var(--st-card));
    border: 1px solid hsl(var(--st-line) / 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg,
            hsl(var(--st-muted)) 0%,
            hsl(var(--st-muted) / 0.5) 50%,
            hsl(var(--st-muted)) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ==========================================================================
   출처 정보 (lbot_v7 sources 스타일)
   ========================================================================== */
.message-sources {
    margin-top: 16px;
    padding-top: 1px;
    font-size: 0.9em;
}

/* 근거자료 바로 뒤 추천질문은 여백 줄임 */
.message-sources+.message-sources {
    margin-top: 8px;
}

.sources-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, hsl(var(--st-line)), transparent);
    margin-top: 16px;
    margin-bottom: 12px;
}

.sources-header {
    font-weight: 600;
    color: hsl(var(--st-fg) / 0.6);
    margin-top: 3px;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.source-item {
    display: flex;
    align-items: flex-start;
    gap: 4px 8px;
    flex-wrap: wrap;
    padding: 2px 0;
    color: hsl(var(--st-fg) / 0.7);
    transition: color 0.2s ease;
}

.source-item:hover {
    color: hsl(var(--st-fg));
}

.source-icon {
    color: hsl(var(--st-fg) / 0.7);
    flex-shrink: 0;
    font-size: 1em;
}

.source-name {
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.source-link {
    color: hsl(var(--st-fg) / 0.7);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s ease;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.source-link:hover {
    color: hsl(var(--st-fg) / 0.9);
    text-decoration: underline;
}

.source-link:visited {
    color: hsl(var(--st-fg) / 0.7);
}

.source-lesson-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.source-lesson-link:hover {
    color: hsl(var(--st-fg));
    text-decoration: underline;
}

.pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 9999px;
    background: hsl(var(--st-fg) / 0.08);
    color: hsl(var(--st-fg) / 0.8);
    border: 1px solid hsl(var(--st-line));
    font-size: 0.85em;
    white-space: nowrap;
}

/* ==========================================================================
   추천 질문 버튼 (lbot_v7 동일)
   ========================================================================== */
.message-sources.suggested-questions {
    margin-top: 16px;
}

.source-item.suggested {
    padding: 2px 0;
}

.message-button {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    padding: 2px 0;
    background: transparent;
    color: hsl(var(--st-fg) / 0.8);
    border: none;
    font-size: inherit;
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
}

.message-sources .message-button i {
    flex-shrink: 0;
    font-size: 0.9em;
    margin: 0 4px 0 0;
    margin-top: calc(1.4em / 2 - 0.45em);
}

.message-button:hover {
    color: hsl(var(--st-brand));
}

.dark .message-button {
    background: transparent;
}

.dark .message-button:hover {
    color: hsl(var(--st-brand));
}

/* ==========================================================================
   웹 검색 상태 (lbot_v7 동일)
   ========================================================================== */
.chat-bubble.web-search-status {
    font-size: 0.9em;
    color: hsl(var(--st-fg) / 0.7);
    font-style: italic;
    padding: 8px 16px !important;
    background: hsl(var(--st-muted) / 0.3) !important;
    border: 1px solid hsl(var(--st-line) / 0.3) !important;
    border-radius: 8px !important;
    animation: pulse 2s ease-in-out infinite;
    display: inline-block !important;
    white-space: nowrap !important;
    width: auto !important;
    max-width: none !important;
}

.web-search-emoji {
    filter: grayscale(1);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ==========================================================================
   이미지 첨부 (lbot_v7 동일)
   ========================================================================== */

/* 이미지 첨부 버튼 */
.attach-image-button {
    position: relative;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-left: 4px;
    margin-right: 0;
    padding: 4px;
    border: none;
    border-radius: 8px;
    background: hsl(var(--st-line));
    color: hsl(var(--st-fg) / 0.7);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--st-transition-fast);
}

.attach-image-button:hover {
    background: hsl(var(--st-muted));
    color: hsl(var(--st-fg));
}

.attach-image-button i {
    font-size: 16px;
}

.dark .attach-image-button {
    background: hsl(var(--st-muted));
}

/* 이미지 미리보기 영역 */
.attached-image-preview {
    display: none;
    padding: 0px var(--st-input-padding-horizontal);
    margin-bottom: 0px;
    margin-left: calc(-1 * var(--st-input-padding-horizontal));
    margin-right: calc(-1 * var(--st-input-padding-horizontal));
    background: transparent;
    text-align: center;
}

.attached-image-preview-item {
    position: relative;
    display: inline-block;
    max-width: 200px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid hsl(var(--st-line));
    background: hsl(var(--st-card));
}

.attached-image-preview-img {
    display: block;
    max-width: 200px;
    max-height: auto;
    width: auto;
    height: auto;
    object-fit: contain;
}

.attached-image-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: hsl(var(--st-bg) / 0.8);
    color: hsl(var(--st-fg));
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--st-transition-fast);
    backdrop-filter: blur(4px);
}

.attached-image-remove-btn:hover {
    background: hsl(var(--st-brand) / 0.9);
    color: white;
    transform: scale(1.1);
}

/* 드래그 오버 상태 */
.input-box.drag-over {
    border-color: hsl(var(--st-brand));
    background: hsl(var(--st-brand) / 0.05);
    box-shadow: 0 0 0 2px hsl(var(--st-brand) / 0.2), var(--st-shadow-lg);
}

/* 메시지 내 이미지 미리보기 */
.attached-image-preview-in-message {
    display: block;
    margin: 0 auto 8px auto;
    padding: 10px 0 0 0;
    border-radius: 8px;
    overflow: hidden;
    border: 0;
    background: transparent;
    max-width: 100%;
}

.attached-image-in-message {
    display: block;
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .attach-image-button {
        width: 28px;
        height: 28px;
        margin-left: 4px;
    }

    .attached-image-preview {
        padding: 0px var(--st-input-padding-horizontal-mobile, 12px);
        margin-left: calc(-1 * var(--st-input-padding-horizontal-mobile, 12px));
        margin-right: calc(-1 * var(--st-input-padding-horizontal-mobile, 12px));
        margin-bottom: 0px;
        position: absolute;
        bottom: 100%;
        left: 0;
        right: 0;
        z-index: 1;
        pointer-events: none;
    }

    .attached-image-preview * {
        pointer-events: auto;
    }

    .attached-image-preview-item {
        max-width: 150px;
    }

    .attached-image-preview-img {
        max-width: 150px;
        max-height: auto;
    }
}

/* ==========================================================================
   AI 상담 버튼 (섹션 헤더)
   ========================================================================== */
.section-header-with-consult {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

.section-header-with-consult h3 {
    flex: 0 1 auto;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-consult-section-btn {
    flex-shrink: 0;
    transform: translateY(-1px);
}

.ai-consult-section-btn .message-button {
    padding: 4px 8px;
    border-radius: 6px;
    background: hsl(var(--st-brand) / 0.08);
    border: 1px solid hsl(var(--st-brand) / 0.3);
    color: hsl(var(--st-brand));
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
    height: auto;
    transition: all 0.15s ease;
}

.ai-consult-section-btn .message-button:hover {
    background: hsl(var(--st-brand) / 0.15);
    border-color: hsl(var(--st-brand) / 0.5);
}

.ai-consult-section-btn .message-button:active {
    background: hsl(var(--st-brand) / 0.2);
    transform: scale(0.98);
}

/* ==========================================================================
   요약 텍스트 클릭 (챗봇 입력)
   텍스트가 없는 빈 요소에는 커서 변경 안 함
   ========================================================================== */
.panel-text-content.prose p:not(:empty),
.panel-text-content.prose li:not(:empty),
.panel-text-content.prose h1:not(:empty),
.panel-text-content.prose h2:not(:empty),
.panel-text-content.prose h3:not(:empty),
.panel-text-content.prose h4:not(:empty),
.panel-text-content.prose h5:not(:empty),
.panel-text-content.prose h6:not(:empty) {
    cursor: pointer;
}

/* 요약/직접작성 내 링크 스타일 */
.panel-text-content.prose a[href] {
    cursor: pointer !important;
    color: hsl(var(--st-brand));
    text-decoration: underline;
}

.panel-text-content.prose a[href]:hover {
    opacity: 0.8;
}

/* 직접 작성 HTML 콘텐츠 */
.direct-write-content {
    padding: 20px 16px;
}

.direct-write-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.direct-write-content iframe,
.direct-write-content video {
    max-width: 100%;
}

/* 웹페이지 풀페이지 이미지 뷰어 */
.webpage-fullpage-viewer {
    width: 100%;
}

.webpage-fullpage-image {
    width: 100%;
    height: auto;
    display: block;
}

/* 웹페이지 크롤링 콘텐츠 (기존 HTML 방식 호환) */
.webpage-content {
    padding: 20px 16px;
}

.webpage-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.webpage-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 16px 0;
    white-space: pre;
}

.webpage-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    white-space: pre;
}

.webpage-content code:not(pre code) {
    background: hsl(var(--st-fg) / 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875em;
}

.webpage-content iframe {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}

/* ==========================================================================
   자막 세그먼트 (SRT 파싱)
   ========================================================================== */
.transcript-container {
    padding: 16px 0;
}

.transcript-segment {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.transcript-segment:hover {
    background-color: hsl(var(--st-brand) / 0.06);
}

.transcript-segment.active {
    background-color: hsl(var(--st-brand) / 0.12);
}

.transcript-indicator {
    color: hsl(var(--st-brand));
    font-size: 10px;
    margin-top: 4px;
    flex-shrink: 0;
}

.transcript-time {
    font-size: 11px;
    color: hsl(var(--st-fg) / 0.5);
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
}

.transcript-content {
    font-size: 14px;
    line-height: 1.5;
    color: hsl(var(--st-fg));
}

/* ==========================================================================
   Focus management
   ========================================================================== */
button:focus,
button:focus-visible {
    outline: none !important;
}

/* ==========================================================================
   Landing Page (홈 탭)
   ========================================================================== */

/* 랜딩 섹션 */
.landing-section {
    display: none;
    padding: 24px 16px;
    max-width: var(--st-container-max-width);
    margin: 0 auto;
}

.landing-section.active {
    display: block;
}

/* 프로필 */
.landing-profile {
    text-align: center;
    padding: 24px 0 20px;
}

.landing-profile__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    overflow: hidden;
    background: hsl(var(--st-muted));
}

.landing-profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.landing-profile__avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: hsl(var(--st-muted-fg));
}

.landing-profile__name {
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--st-fg));
    margin: 0 0 4px;
}

.landing-profile__bio {
    font-size: 0.875rem;
    color: hsl(var(--st-muted-fg));
    margin: 0;
}

/* 파일 카드 그리드 */
.landing-file-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.landing-file-card-grid>.landing-file-card+.landing-file-card {
    padding-top: 32px;
    margin-top: 32px;
    position: relative;
}

.landing-file-card-grid>.landing-file-card+.landing-file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, hsl(var(--st-line)), transparent);
}

/* 파일 카드 */
.landing-file-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    transition: box-shadow 0.2s, transform 0.2s;
}

.landing-file-card__thumbnail,
.landing-file-card__header,
.landing-file-card__desc {
    cursor: pointer;
}


.landing-file-card__top {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .landing-file-card__top {
        flex-direction: row;
        align-items: flex-start;
    }

    .landing-file-card__top>.landing-file-card__thumbnail {
        width: 350px;
        flex-shrink: 0;
        overflow: hidden;
    }

    .landing-file-card__top>.landing-file-card__body {
        border-top: none;
        border-left: none;
        align-self: flex-start;
        padding-top: 0;
    }
}

.landing-file-card__thumbnail {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: hsl(var(--st-muted));
    border-radius: 10px;
    border: 1px solid hsl(var(--st-fg) / 0.15);
}

.landing-file-card__thumbnail {
    max-height: 600px;
}

.landing-file-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}


.landing-file-card__thumbnail--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-file-card__thumbnail--placeholder>i {
    font-size: 2.5rem;
    color: hsl(var(--st-muted-fg));
    opacity: 0.5;
}

.landing-file-card__thumbnail--preview {
    overflow: hidden;
    pointer-events: none;
    background: hsl(var(--st-bg));
}

.landing-file-card__preview-content {
    transform: scale(0.75);
    transform-origin: top left;
    width: 133%;
    height: 133%;
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: hsl(var(--st-fg));
}

.landing-file-card__preview-content img {
    max-width: 100%;
    height: auto;
}

.landing-file-card__play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.landing-file-card__body {
    display: flex;
    flex-direction: column;
    padding: 16px 24px 0;
}

.landing-file-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.landing-file-card__type-icon {
    font-size: 1rem;
    color: hsl(var(--st-muted-fg));
    flex-shrink: 0;
}

.landing-file-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--st-fg));
    margin: 0;
    line-height: 1.4;
}

.landing-file-card__desc {
    font-size: 0.95rem;
    color: hsl(var(--st-muted-fg));
    line-height: 1.6;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.landing-file-card__more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0px;
    font-size: 0.8rem;
    font-weight: 500;
    color: hsl(var(--st-primary));
    background: hsla(var(--st-primary), 0.08);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.landing-file-card__more:hover {
    background: hsla(var(--st-primary), 0.15);
}

.landing-file-card__questions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 12px;
    padding-left: 12px;
}

.landing-file-card__questions-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: hsl(var(--st-fg));
    margin-bottom: 4px;
}

.landing-file-card__questions-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    margin-top: calc(0.95rem * 1.4 / 2 - 2px);
}

.landing-file-card__questions .message-button {
    font-size: 0.95rem;
    color: hsl(var(--st-muted-fg));
}

.landing-file-card__questions .message-button:hover {
    color: hsl(var(--st-brand));
}

/* 텍스트 블록 */
.landing-text-block {
    padding: 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: hsl(var(--st-fg));
    overflow-x: auto;
    word-break: break-word;
}

.landing-text-block p {
    margin: 0 0 8px;
}

.landing-text-block p:last-child {
    margin-bottom: 0;
}

/* 링크 블록 */
.landing-link-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: hsl(var(--st-card));
    border: 1px solid hsl(var(--st-line));
    border-radius: 12px;
    text-decoration: none;
    color: hsl(var(--st-fg));
    font-size: 0.9rem;
    font-weight: 500;
    transition: box-shadow 0.2s, transform 0.2s;
}

.landing-link-block:hover {
    box-shadow: 0 4px 16px hsla(var(--st-fg), 0.08);
    transform: translateY(-1px);
    color: hsl(var(--st-fg));
    text-decoration: none;
}

.landing-link-block i:first-child {
    font-size: 1.2rem;
    color: hsl(var(--st-primary));
}

.landing-link-block span {
    flex: 1;
}

.landing-link-external {
    font-size: 0.75rem;
    color: hsl(var(--st-muted-fg));
}

/* 구분선 */
.landing-divider {
    border: none;
    border-top: 1px solid hsl(var(--st-line));
    margin: 16px 0;
}

/* 오너 프로필 (홈 탭 하단) */
.landing-owner-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0 16px;
    cursor: pointer;
}

.landing-owner-profile__avatar {
    height: 64px;
    object-fit: contain;
}

.landing-owner-profile__name {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--st-fg));
}

/* PC 대응 */
@media (min-width: 768px) {
    .landing-section {
        padding: 32px 24px;
    }

    .landing-profile__avatar {
        width: 96px;
        height: 96px;
    }

    .landing-file-card__body {
        padding: 24px 28px;
    }

    .landing-page-title h1 {
        font-size: 1.75rem;
    }
}