/* 뷰어의 ASK AI 채팅 패널. 모양은 ASK 앱 채팅(말풍선·인용 칩·입력창)을 웹 색(tokens.css)으로 옮겼다.
   넓은 화면은 오른쪽 패널, 좁은 화면(759px 이하)은 논문 아래에 붙는 시트다. */

.pdf-viewer.chat-open .viewer-body {
    display: flex;
}

.pdf-viewer.chat-open .viewer-scroller {
    flex: 1;
    min-width: 0;
}

/* 오른쪽 레일: 질문·요약·메모·캡처. 왼쪽 레일(viewer-sidebar.css)과 같은 바탕·경계에, 기능이 있는 줄 알게 이름을 아이콘 밑에 늘 둔다.
   패널은 레일 왼쪽에서 펼쳐진다. 휴대폰은 레일 대신 아래 단추(.viewer-chat-fab)로 연다. */
.pdf-viewer {
    --vr-w: 52px;
}

.vr-rail {
    /* translate.css의 공용 nav 규칙(fixed·z-index 1000·흐림·transition)을 받지 않게 */
    position: relative;
    z-index: auto;
    margin: 0;
    backdrop-filter: none;
    transition: none;
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: var(--vr-w);
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    border-left: 1px solid var(--app-edge);
    background: var(--app-elevated);
}

.vr-rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 44px;
    padding: 6px 0 5px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--app-fg-3);
    font: inherit;
    font-size: 11px;
    line-height: 14px;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.vr-rail-btn > svg {
    width: 16px;
    height: 16px;
}

.vr-rail-btn:hover {
    background: var(--app-hover);
    color: var(--app-fg);
}

.vr-rail-btn[aria-pressed="true"] {
    background: var(--app-overlay);
    color: var(--app-fg);
}

.pdf-viewer .vr-rail-btn:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: 1px;
}

/* 패널 머리의 탭 이름. 넓은 화면은 탭 줄 대신 이것만 둔다(탭은 레일이 맡는다) */
.chat-title {
    display: none;
    color: var(--app-fg);
    font-size: 12.5px;
    font-weight: 500;
}

@media (min-width: 760px) {
    .chat-head > .chat-modes {
        display: none;
    }

    .chat-head > .chat-title {
        display: block;
    }
}

.viewer-chat {
    position: relative;
    display: flex;
    flex-direction: column;
    width: var(--chat-w, 380px);
    max-width: calc(100% - 360px);
    flex: none;
    min-height: 0;
    border-left: 1px solid var(--line);
    /* 색은 ASK 앱 채팅 패널과 같게: 바탕 ground, 답변 말풍선 inset */
    --chat-ground: #fbfbf8;
    --chat-inset: #f1f0eb;
    --chat-font: 16px;
    background: var(--chat-ground);
    font-size: 14px;
}

.viewer-chat[hidden] {
    display: none !important;
}

/* 패널 왼쪽 끝을 끌어 폭을 바꾼다(넓은 화면만). */
.chat-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    z-index: 2;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}

.chat-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 2px;
    background: transparent;
    transition: background 0.15s;
}

.chat-resizer:hover::after,
.chat-resizer:focus-visible::after,
.pdf-viewer.chat-resizing .chat-resizer::after {
    background: var(--accent);
}

.chat-resizer:focus-visible {
    outline: none;
}

.pdf-viewer.chat-resizing {
    cursor: col-resize;
    user-select: none;
}

.chat-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

/* '질문 | 요약' 탭(ASK 앱 오른쪽 패널 머리와 같은 모양): 고른 탭만 바탕을 깐다. */
.chat-modes {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-mode {
    /* ASK 앱 패널 탭과 같게: 12.5px, 모서리 6px, 안 고른 탭 fg-3, 고른 탭은 overlay 바탕에 fg(굵게 하지 않음) */
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6e6d66;
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.chat-mode:hover {
    background: rgba(39, 38, 30, 0.05);
    color: #27261e;
}

.chat-mode[aria-selected="true"] {
    background: #e9e8e3;
    color: #27261e;
}


.chat-close {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
}

.chat-close:hover {
    background: var(--card);
}

.chat-close svg {
    width: 14px;
    height: 14px;
}

.chat-settings-btn {
    margin-left: auto;
}

.chat-settings-btn svg {
    width: 15px;
    height: 15px;
}

.chat-settings-btn[aria-expanded="true"] {
    background: var(--card);
    color: var(--ink);
}

.chat-settings {
    position: absolute;
    top: calc(100% - 4px);
    right: 12px;
    z-index: 3;
    width: 230px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--chat-ground);
    box-shadow: 0 8px 24px rgba(30, 28, 18, 0.14);
    font-size: 13px;
}

.chat-settings[hidden] {
    display: none;
}

.chat-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.chat-settings input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--ink);
    cursor: pointer;
}

.chat-settings-clear {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 7px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    color: #b3412f;
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}

.chat-settings-clear:disabled {
    color: var(--ink-faint);
    cursor: default;
}

.chat-settings-row span {
    width: 36px;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* 대화 탭 줄. 앱처럼 고른 탭만 바탕색으로 이어 붙이고, 닫기 단추는 고른 탭과 마우스를 올린 탭에만 보인다. */
.chat-tabs {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 6px 8px 0;
    /* 아래 선은 바탕에 그려 고른 탭 바탕이 덮게 한다(탭 줄은 옆으로 밀려 테두리를 넘겨 그릴 수 없다). */
    background: color-mix(in srgb, var(--chat-ground), var(--ink) 4%);
    box-shadow: inset 0 -1px 0 var(--line);
}

.chat-tabs[hidden] {
    display: none;
}

.chat-tab-list {
    display: flex;
    flex: 1;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-tab-list::-webkit-scrollbar {
    display: none;
}

.chat-tab {
    position: relative;
    display: flex;
    flex: 0 1 160px;
    align-items: center;
    min-width: 84px;
    height: 32px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    color: var(--ink-soft);
}

.chat-tab + .chat-tab::before {
    content: "";
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: -2px;
    width: 1px;
    background: var(--line);
}

.chat-tab.active::before,
.chat-tab.active + .chat-tab::before {
    display: none;
}

.chat-tab.active {
    border-color: var(--line);
    background: var(--chat-ground);
    color: var(--ink);
}

.chat-tab:not(.active):hover {
    background: color-mix(in srgb, var(--chat-ground), var(--ink) 3%);
    box-shadow: inset 0 -1px 0 var(--line);
}

.chat-tab-title {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 4px 0 11px;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.chat-tab-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-right: 5px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    visibility: hidden;
}

.chat-tab.active .chat-tab-close,
.chat-tab:hover .chat-tab-close,
.chat-tab-close:focus-visible {
    visibility: visible;
}

.chat-tab-close:hover {
    background: var(--card);
    color: var(--ink);
}

.chat-tab-close svg {
    width: 11px;
    height: 11px;
}

.chat-tab-new {
    display: grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0 0 3px 2px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}

.chat-tab-new:hover {
    background: var(--card);
    color: var(--ink);
}

.chat-tab-new:disabled {
    opacity: 0.4;
    cursor: default;
}

.chat-tab-new svg {
    width: 14px;
    height: 14px;
}

.chat-body {
    position: relative;
    flex: 1;
    min-height: 0;
}

.chat-log {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 14px;
}

.chat-user {
    align-self: flex-end;
    font-size: var(--chat-font);
    max-width: min(85%, 42em);
    padding: 8px 14px;
    border-radius: 14px 14px 4px 14px;
    background: #cc7d5e;
    color: #fff;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 패널을 넓혀도 한 줄이 너무 길어지지 않게 앱처럼 42em(한글 약 40자)까지만 늘어난다. */
/* 내 질문 위에 붙는 고른 문장(앱과 같은 모양) */
.chat-user-selection {
    align-self: flex-end;
    max-width: min(85%, 42em);
    margin-bottom: -6px;
    padding: 7px 11px;
    border-radius: 10px;
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-size: calc(var(--chat-font) * 0.85);
    line-height: 1.55;
}

.chat-user-selection span {
    display: block;
    margin-bottom: 2px;
    font-size: 0.9em;
    opacity: 0.8;
}

.chat-user-selection p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    word-break: break-word;
}

.chat-ai {
    align-self: flex-start;
    font-size: var(--chat-font);
    max-width: min(92%, 42em);
    padding: 10px 14px;
    border-radius: 14px 14px 14px 4px;
    background: var(--chat-inset);
    line-height: 1.7;
    word-break: break-word;
}

.chat-ai.error {
    color: var(--ink-soft);
}

.chat-ai p,
.chat-ai ul,
.chat-ai ol,
.summary-text p,
.summary-text ul,
.summary-text ol {
    margin: 0 0 8px;
}

.chat-ai > :last-child,
.summary-text > :last-child {
    margin-bottom: 0;
}

.chat-ai ul,
.chat-ai ol,
.summary-text ul,
.summary-text ol {
    padding-left: 1.3em;
}

.chat-ai h1,
.chat-ai h2,
.chat-ai h3,
.summary-text h1,
.summary-text h2,
.summary-text h3 {
    margin: 10px 0 6px;
    font-size: 1em;
}

.chat-ai code,
.summary-text code {
    padding: 0 4px;
    border-radius: 4px;
    background: var(--pill);
    font-size: 0.9em;
}

.chat-ai .katex-display,
.summary-text .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
}

.chat-thinking {
    color: var(--ink-faint);
}

.chat-chip {
    display: inline;
    margin: 0 1px;
    padding: 0 6px;
    border: 0;
    border-radius: 4px;
    background: var(--accent-tint);
    color: var(--accent-ink);
    font: inherit;
    font-size: 0.85em;
    white-space: nowrap;
    cursor: pointer;
}

button.chat-chip:hover {
    background: color-mix(in srgb, var(--accent-tint), var(--accent) 22%);
}

.chat-more {
    align-self: center;
    padding: 5px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.chat-more:hover {
    color: var(--ink);
}

.chat-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    height: 24px;
    margin-top: -8px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-faint);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.chat-copy:hover {
    background: var(--pill);
    color: var(--ink);
}

.chat-copy svg {
    width: 12px;
    height: 12px;
}

.chat-foot {
    padding: 0 12px 12px;
}

.chat-notice {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 9px 12px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--bg), var(--ink) 8%);
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.6;
}

.chat-notice[hidden] {
    display: none;
}

/* 탭을 닫은 뒤 잠깐 뜨는 되돌리기 띠 */
.chat-undo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--bg);
    font-size: 12.5px;
}

.chat-undo[hidden] {
    display: none;
}

.chat-undo button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.chat-upgrade {
    padding: 8px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--ink);
    color: var(--bg);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.chat-upgrade.small {
    flex: none;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 12px;
}

.chat-upgrade[hidden] {
    display: none;
}

/* 입력창 위: 뷰어에서 골라 '질문하기'를 누른 문장 */
.chat-selection {
    margin-bottom: 8px;
    padding: 8px 10px 9px 12px;
    border-radius: 10px;
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-size: 12.5px;
    line-height: 1.55;
}

.chat-selection[hidden] {
    display: none;
}

.chat-selection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 11.5px;
    opacity: 0.85;
}

.chat-selection-clear {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.chat-selection-clear:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.chat-selection-clear svg {
    width: 11px;
    height: 11px;
}

.chat-selection p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    word-break: break-word;
}

.chat-input {
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 10px 12px 8px;
    background: var(--surface);
}

.chat-input textarea {
    display: block;
    width: 100%;
    min-height: 40px;
    max-height: 160px;
    resize: none;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--chat-font);
    line-height: 1.5;
}

.chat-input textarea::placeholder {
    color: var(--ink-faint);
}

.chat-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: 12.5px;
}

.chat-send {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    cursor: pointer;
}

.chat-send svg {
    width: 15px;
    height: 15px;
}

.chat-send:disabled {
    background: var(--pill);
    color: var(--ink-faint);
    cursor: default;
}

/* 요약 탭: 대화 탭 줄·대화·고른 문장·입력창을 숨기고, 입력창 자리에는 사용량 줄만 남긴다. */
.viewer-chat[data-mode="summary"] .chat-tabs,
.viewer-chat[data-mode="summary"] .chat-log,
.viewer-chat[data-mode="summary"] .chat-undo,
.viewer-chat[data-mode="summary"] .chat-selection,
.viewer-chat[data-mode="summary"] .chat-input textarea,
.viewer-chat[data-mode="summary"] .chat-send {
    display: none !important;
}

.viewer-chat[data-mode="summary"] .chat-input {
    padding: 0 2px;
    border: 0;
    background: transparent;
}

.chat-summary {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.summary-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 16px 12px;
}

.summary-text {
    font-size: calc(var(--chat-font) * 0.875);
    line-height: 1.75;
    word-break: break-word;
}

/* 요약 없음·원문 없음·50쪽 넘음: 가운데 안내(앱과 같은 모양) */
.summary-empty {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 12px;
    text-align: center;
}

.summary-empty p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13.5px;
    line-height: 1.7;
    word-break: keep-all;
}

.summary-empty p span {
    display: block;
    color: var(--ink-faint);
}

.summary-make {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.summary-make:disabled {
    opacity: 0.4;
    cursor: default;
}

.summary-make svg {
    width: 14px;
    height: 14px;
}

.summary-wait {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 13.5px;
}

.summary-spin {
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--ink-soft);
    border-radius: 50%;
    animation: summary-spin 0.8s linear infinite;
}

@keyframes summary-spin {
    to {
        transform: rotate(360deg);
    }
}

.summary-error {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding: 9px 12px;
    border-radius: 9px;
    background: color-mix(in srgb, #c0392b 9%, var(--surface));
    color: #a1302a;
    font-size: 12.5px;
    line-height: 1.6;
}

.summary-retry {
    flex: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* 요약 아래: 마지막 생성 시각과 '다시 요약' */
/* 요약 위쪽 상태 줄(앱: px-4 pb-1 pt-2.5 text-[12px] text-fg-4, 오른쪽에 '다시 요약') */
.summary-status {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 4px;
    color: var(--ink-faint);
    font-size: 12px;
}

.summary-status[hidden],
.summary-redo[hidden] {
    display: none;
}

.summary-time {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-redo {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.summary-redo:hover:not(:disabled) {
    background: var(--card);
    color: var(--ink);
}

.summary-redo:disabled {
    opacity: 0.4;
    cursor: default;
}

.summary-redo svg {
    width: 13px;
    height: 13px;
}

/* 잠금(무료): 예시 대화를 흐리게 깔고 가운데에 안내 */
.chat-lock {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.chat-lock[hidden] {
    display: none;
}

.chat-lock-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 14px;
    filter: blur(3px);
    opacity: 0.45;
    pointer-events: none;
}

.chat-lock-card {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    transform: translateY(-50%);
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.chat-lock-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--pill);
    color: var(--ink-soft);
}

.chat-lock-card h3 {
    margin: 10px 0 6px;
    font-size: 15px;
}

.chat-lock-card p {
    margin: 0 0 14px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.6;
}

.viewer-chat-fab {
    display: none;
}

@media (max-width: 759px) {
    .vr-rail {
        display: none;
    }

    .viewer-chat-fab {
        position: absolute;
        right: 16px;
        bottom: calc(22px + env(safe-area-inset-bottom, 0px));
        z-index: 5;
        display: block;
        padding: 11px 16px;
        border: 0;
        border-radius: 999px;
        background: var(--ink);
        color: var(--bg);
        font: inherit;
        font-size: 14px;
        font-weight: 600;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
        cursor: pointer;
    }

    .viewer-chat-fab[hidden] {
        display: none;
    }

    /* 시트를 논문 위에 겹치지 않고 아래에 둔다. 겹쳐 있으면 iOS에서 논문이 관성으로 구르는 동안
       시트 안 손가락도 논문 스크롤이 잡아 채팅이 움직이지 않는다. */
    .pdf-viewer.chat-open .viewer-body {
        flex-direction: column;
        background: color-mix(in srgb, var(--bg), var(--ink) 7%);
    }

    .pdf-viewer.chat-open .viewer-scroller {
        flex: 1;
        min-height: 0;
        height: auto;
    }

    .viewer-chat {
        z-index: 6;
        width: auto;
        max-width: none;
        height: var(--chat-h, 72%);
        border-left: 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.14);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* 시트 위쪽 손잡이를 끌어 높이를 바꾼다. */
    .chat-resizer {
        top: 0;
        right: 0;
        bottom: auto;
        left: 0;
        width: auto;
        height: 22px;
        cursor: row-resize;
    }

    .chat-resizer::after {
        top: 8px;
        bottom: auto;
        left: 50%;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--line-strong);
        transform: translateX(-50%);
    }

    .pdf-viewer.chat-resizing {
        cursor: row-resize;
    }

    .chat-head {
        padding-top: 22px;
    }
}
