/* inlined: ./table-core.css */
/* 테이블 페이지 전용 스타일 - UserOutput 테마 기반 */

/* 공통 말풍선 꼬리 스타일 */
.row-delete-btn::after,
.row-undo-btn::after,
.tree-inline-actions::after,
.floating-toolbar-arrow,
.show-answer-tooltip::after,
.reset-answer-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid currentColor;
}

.table-main {
    background: var(--bg-app);
    padding: 0 16px;
    min-height: 100vh;
}

.table-container {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    min-height: 0;
}

/* 사이드바 - sticky로 스크롤 시 고정 */
.sidebar {
    width: 260px;
    min-width: 260px;
    min-height: 100vh;
    background: var(--bg-paper);
    display: flex;
    flex-direction: column;
    position: relative;
    top: auto;
    max-height: none;
    overflow-y: auto;
    z-index: 100;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border: 1px solid var(--border-color);
    border-right: none;
}

.tree-container {
    flex: 1;
    overflow: visible;
    padding: 12px 0;
}

.tree-shared-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 12px 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 600;
}

.tree-shared-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0.8;
}

.tree-shared-label {
    letter-spacing: -0.01em;
    font-weight: 700;
    color: #000;
    font-size: 13px;
}

.tree-shared-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 12px 6px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 600;
}

.tree-shared-empty {
    margin: 2px 16px 10px;
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1.4;
}
.tree-shared-empty-link {
    color: #3b82f6;
    text-decoration: none;
}
.tree-shared-empty-link:hover {
    text-decoration: underline;
}

.tree-invite-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}


body.shared-readonly #editTab {
    position: relative;
}

body.shared-readonly #editTab::after {
    display: none;
}

body.shared-readonly #editTab .table-wrapper {
    pointer-events: auto;
}

body.shared-readonly #editTab .table-wrapper * {
    pointer-events: none;
}

.table-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--background);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* 메인 콘텐츠 */
.main-content {
    display: flex;
    flex-direction: column;
    background: var(--background);
    min-width: 0;
    min-height: 0;
    flex: 1;
}

.sidebar-header {
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-paper);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 트리 구조 */
.tree-item {
    margin-bottom: 1px;
}

.tree-node {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    color: var(--text-primary);
}

.tree-node:hover {
    background: var(--primary-light);
}

.tree-node.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
    font-size: 12px;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.tree-icon svg {
    width: 16px;
    height: 16px;
}

.tree-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.tree-actions {
    display: flex;
    gap: 2px;
    margin-left: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.tree-node:hover .tree-actions {
    opacity: 1;
    visibility: visible;
}

.tree-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.tree-action-btn:hover {
    background: var(--background);
}

/* 수정 버튼 (첫번째 액션) */
.tree-rename-btn:hover {
    color: var(--primary-color);
}

/* 삭제 버튼 (마지막 액션) */
.tree-action-btn:last-child:hover {
    color: var(--danger-color);
}

/* 인라인 이름 수정 입력 필드 */
.tree-rename-input {
    flex: 1;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--background);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring);
    min-width: 80px;
    max-width: 150px;
}

.tree-rename-input:focus {
    border-color: var(--primary-hover);
}

/* 편집 중인 노드 상태 */
.tree-node.editing {
    background: var(--primary-light);
}

.tree-node.editing .tree-actions {
    opacity: 1;
    visibility: visible;
}

.tree-children {
    margin-left: 20px;
    display: none;
}

.tree-children.expanded {
    display: block;
}

/* 사이드바 항목 추가 버튼 공통 스타일 */
.tree-add-item-btn,
.tree-add-folder-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: calc(100% - 24px);
    margin: 4px 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tree-add-item-btn:hover,
.tree-add-folder-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.tree-add-item-btn svg,
.tree-add-folder-btn svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.tree-add-item-btn:hover svg,
.tree-add-folder-btn:hover svg {
    opacity: 1;
}

/* 폴더 내부 파일 추가 버튼/인라인 필드 - 더 들여쓰기 */
.tree-add-item-btn,
.tree-inline-file {
    margin-left: 36px;
    width: calc(100% - 48px);
}

/* 최상위 폴더 추가 버튼 */
.tree-add-folder-btn {
    margin-top: 8px;
    border-style: dashed;
}

/* 인라인 입력 필드 (폴더/파일 추가) */
.tree-inline-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 12px;
    padding: 8px 10px;
    background: var(--background);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 3px var(--focus-ring);
    overflow: visible;
}

.tree-inline-input-wrapper svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

.tree-inline-input {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    background: var(--background);
    color: var(--text-primary);
}

.tree-inline-input:focus {
    border-color: var(--primary-color);
}

.tree-inline-input::placeholder {
    color: var(--text-tertiary);
}

/* 저장/취소 버튼 - 말풍선 오버레이 */
.tree-inline-actions {
    position: absolute;
    top: -28px;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 5px 8px;
    background: var(--text-primary);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.tree-inline-actions::after {
    border-top-color: var(--text-primary);
    right: 16px;
}

.tree-inline-save-btn,
.tree-inline-cancel-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tree-inline-save-btn {
    background: var(--primary-color);
    color: white;
}

.tree-inline-save-btn:hover {
    background: var(--primary-hover);
}

.tree-inline-cancel-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-inline-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 빈 상태 메시지 */
.tree-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary);
}

.tree-empty svg {
    margin-bottom: 10px;
    opacity: 0.3;
}

.tree-empty p {
    font-size: 13px;
    line-height: 1.5;
}

/* 온보딩 빈 상태 (폴더 없을 때) */
.tree-onboarding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.tree-onboarding-icon {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-onboarding-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    border-radius: 50%;
    opacity: 0.1;
    animation: onboardingPulse 2s ease-in-out infinite;
}

.tree-onboarding-icon svg {
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    color: var(--primary-color);
    opacity: 1;
}

@keyframes onboardingPulse {

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

    50% {
        transform: scale(1.1);
        opacity: 0.2;
    }
}

.tree-onboarding-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tree-onboarding-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    max-width: 200px;
}

/* 시작하기 CTA 버튼 */
.tree-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), #ca8a04);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(202, 138, 4, 0.35);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tree-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.15));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tree-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(202, 138, 4, 0.45);
}

.tree-cta-btn:hover::before {
    opacity: 1;
}

.tree-cta-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(202, 138, 4, 0.3);
}

.tree-cta-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* 보조 힌트 텍스트 */
.tree-onboarding-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.tree-onboarding-hint svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* 온보딩 상태의 인라인 입력 필드 */
.tree-inline-onboarding {
    margin: 40px 20px;
    animation: onboardingInputSlide 0.3s ease-out;
}

@keyframes onboardingInputSlide {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

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

/* 툴바 - 사이드바 헤더와 높이 통일 */
.toolbar {
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-paper);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 0 var(--radius-lg) 0 0;
}

.toolbar-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.toolbar-profile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #000;
    background: var(--bg-paper);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    color: var(--text-primary);
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toolbar-profile__initial {
    display: inline-block;
    line-height: inherit;
}

.toolbar-profile:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.toolbar-profile:active {
    transform: translateY(1px);
}

.toolbar-profile:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.toolbar-profile.is-empty {
    color: var(--text-tertiary);
}

.collab-profile-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.collab-profile-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    position: relative;
    text-transform: uppercase;
}

.collab-profile-initial {
    line-height: 1;
}

.collab-profile-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--bg-paper);
    background: var(--border-color);
}

.collab-profile-item.is-online {
    border-color: var(--success-color);
}

.collab-profile-item.is-online .collab-profile-dot {
    background: var(--success-color);
}

.collab-profile-item.is-editing {
    border-color: var(--primary-color);
}

.collab-profile-item.is-editing .collab-profile-dot {
    background: var(--primary-color);
}

.collab-profile-item.is-more {
    border-style: dashed;
    color: var(--text-tertiary);
    background: var(--background);
    font-size: 0.7rem;
}

.toolbar-member-invite {
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toolbar-member-invite:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.toolbar-member-invite:active {
    transform: translateY(1px);
}

.toolbar-member-invite:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}


/* 테이블 래퍼 */
.table-wrapper {
    flex: 1;
    overflow: auto;
    min-height: 100vh;
    padding: 0;
    background: var(--background);
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* 테이블 스켈레톤 로딩 */
.table-skeleton {
    background: var(--background);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.skeleton-header {
    display: flex;
    background: var(--bg-paper);
    border-bottom: 1px solid var(--border-color);
}

.skeleton-header .skeleton-cell {
    height: 42px;
}

.skeleton-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-row:last-child {
    border-bottom: none;
}

.skeleton-cell {
    flex: 1;
    height: 48px;
    background: linear-gradient(90deg,
            var(--bg-paper) 0%,
            #f0f0ed 50%,
            var(--bg-paper) 100%);
    background-size: 200% 100%;
    border-right: 1px solid var(--border-color);
}

.skeleton-cell:last-child {
    border-right: none;
}

.skeleton-animate {
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

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

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

/* 테이블 섹션 (다중 테이블) */
.table-section {
    margin-bottom: 32px;
}

.table-section:last-child {
    margin-bottom: 0;
}

/* 편집 가능한 테이블 */
.editable-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.editable-table th {
    background: var(--bg-paper);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

/* 정답 헤더 - 삭제 버튼 포함 */
.th-answer {
    position: relative;
}

.table-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--danger-color);
    background: var(--error-bg);
    border: 1px solid var(--danger-color);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.editable-table thead tr:hover .table-delete-btn {
    opacity: 1;
    visibility: visible;
}

.table-delete-btn:hover {
    background: var(--danger-color);
    color: white;
}

.table-delete-btn svg {
    flex-shrink: 0;
}

.editable-table td {
    padding: 0;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
    vertical-align: top;
    height: 1px;
    /* 행 높이 동기화를 위한 트릭 */
}

.cell-content {
    min-height: 38px;
    height: 100%;
    padding: 10px 14px;
    outline: none;
    cursor: text;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
    color: var(--text-primary);
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.cell-content img {
    max-width: 100%;
    height: auto;
    display: inline-block;
}

.cell-content u,
.cell-content span[style*="text-decoration"] {
    line-height: inherit;
    vertical-align: baseline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.12em;
    text-decoration-skip-ink: auto;
}

.cell-content:hover {
    background: var(--primary-light);
}

.cell-content:focus {
    background: #fef9e7;
    border-color: var(--primary-color);
}

.cell-content.focused {
    background: #fef9e7;
    border-color: var(--primary-color);
}

.cell-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
}

/* 정답 셀 - 삭제 버튼 오버레이용 */
.question-cell {
    position: relative;
}

.answer-cell {
    position: relative;
}

.cell-collab-presence {
    position: absolute;
    top: 6px;
    left: 6px;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    pointer-events: none;
    z-index: 9;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.cell-collab-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.cell-collab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-content.is-locked {
    background: #f3f4f6;
    border-color: var(--collab-lock-color, var(--border-color));
    cursor: not-allowed;
}

.cell-content.is-locked:hover,
.cell-content.is-locked:focus,
.cell-content.is-locked.focused {
    background: #f3f4f6;
    border-color: var(--collab-lock-color, var(--border-color));
}

.row-swap-btn {
    position: absolute;
    top: 50%;
    left: -14px;
    transform: translate(-50%, -50%) scale(0.95);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
    z-index: 12;
}

.editable-table tbody tr {
    position: relative;
}

.editable-table tbody tr:focus-within .row-swap-btn,
.editable-table tbody tr:hover .row-swap-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.row-swap-btn:hover {
    color: var(--primary-color);
}

/* 행 삭제 버튼 - 말풍선 스타일 */
.row-delete-btn {
    position: absolute;
    top: -28px;
    right: 8px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: var(--danger-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    white-space: nowrap;
}

.row-delete-btn::after {
    border-top-color: var(--danger-color);
}

.row-delete-btn:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.row-delete-btn:hover::after {
    border-top-color: #dc2626;
}

/* 행 hover 또는 셀 focus 시 삭제 버튼 표시 */
.editable-table tbody tr:hover .row-delete-btn,
.editable-table tbody tr:focus-within .row-delete-btn {
    opacity: 1;
    visibility: visible;
}

/* 되돌리기 버튼 - 말풍선 스타일 */
.row-undo-btn {
    position: absolute;
    top: -32px;
    right: 8px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: undoBtnPop 0.3s ease-out;
}

@keyframes undoBtnPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(4px);
    }

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

.row-undo-btn::after {
    border-top-color: #2563eb;
}

.row-undo-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.row-undo-btn:hover::after {
    border-top-color: #1d4ed8;
}

/* 카운트다운 타이머 */
.undo-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

/* 삭제 대기 상태의 행 */
.editable-table tbody tr.pending-delete {
    background: #fef2f2;
}

.editable-table tbody tr.pending-delete .row-undo-btn {
    opacity: 1;
    visibility: visible;
}

/* 콘텐츠 숨김 상태 (규격 유지) */
.cell-content.content-hidden {
    min-height: 38px;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 8px,
            rgba(239, 68, 68, 0.05) 8px,
            rgba(239, 68, 68, 0.05) 16px);
    cursor: default;
}

/* 행 추가 버튼 */
.add-row-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-row-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

.add-row-btn span {
    font-size: 16px;
    font-weight: 600;
}

/* 플로팅 툴바 */
.floating-toolbar {
    position: absolute;
    display: none;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    padding: 6px 10px;
    background: var(--text-primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.floating-toolbar.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.floating-toolbar-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--text-primary);
}

.ftool-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    transition: background 0.15s ease;
}

.ftool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ftool-btn--wide {
    width: auto;
    padding: 0 10px;
    white-space: nowrap;
}

.ftool-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

.ftool-color-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.ftool-color-label:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ftool-color-icon {
    font-size: 14px;
    font-weight: 700;
    color: #ff0000;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

.ftool-color-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.ftool-size {
    min-width: 20px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    user-select: none;
}


.score-display {
    padding: 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border-color);
}

.score-card {
    text-align: center;
}

.score-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.score-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--primary-color);
}

.score-detail {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 문제풀이 테이블 */
.solve-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.solve-table th {
    background: var(--bg-paper);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.solve-table td {
    padding: 0;
    border: 1px solid var(--border-color);
    vertical-align: top;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.solve-table td:first-child {
    padding: 10px 14px;
}

.solve-input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 0;
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
    resize: none;
    overflow: hidden;
    min-height: 40px;
    line-height: 1.5;
    font-family: inherit;
    display: block;
    box-sizing: border-box;
    color: var(--text-primary);
    background: transparent;
}

.solve-input:focus {
    background: #fef9e7;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

.solve-input.correct {
    background: var(--success-bg);
}

.solve-input.incorrect {
    background: var(--error-bg);
}

/* 정답보기 말풍선 버튼 컨테이너 */
.solve-answer-wrapper {
    position: relative;
}

.solve-answer-actions {
    position: absolute;
    top: -38px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.show-answer-tooltip,
.reset-answer-tooltip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.show-answer-tooltip::after,
.reset-answer-tooltip::after {
    border-top-color: #334155;
    right: 16px;
}

/* 호버 효과 */
.show-answer-tooltip:hover,
.reset-answer-tooltip:hover {
    background: linear-gradient(135deg, #334155, #475569);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* 포커스 시 표시 */
.solve-answer-wrapper:focus-within .show-answer-tooltip,
.solve-answer-wrapper:focus-within .reset-answer-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 아이콘 */
.show-answer-tooltip svg,
.reset-answer-tooltip svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 활성화 상태 (정답이 표시된 상태) */
.show-answer-tooltip.active {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.show-answer-tooltip.active::after {
    border-top-color: #22c55e;
}


/* 실시간 유사도 표시 */
.similarity-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.similarity-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.similarity-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.similarity-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.similarity-fill.low {
    background: #ef4444;
}

.similarity-fill.medium {
    background: #f59e0b;
}

.similarity-fill.high {
    background: #22c55e;
}

.similarity-percent {
    font-size: 12px;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
    transition: color 0.3s ease;
}

.similarity-percent.low {
    color: #ef4444;
}

.similarity-percent.medium {
    color: #f59e0b;
}

.similarity-percent.high {
    color: #22c55e;
}

.answer-feedback {
    display: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
}

.answer-feedback.show {
    display: block;
}

.answer-feedback.correct {
    color: var(--success-color);
    background: var(--success-bg);
}

.answer-feedback.incorrect {
    color: var(--danger-color);
    background: var(--error-bg);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(68, 64, 60, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2147483648;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.25s ease-out;
    border: 1px solid var(--border-color);
}

.modal-content.modal-sm {
    max-width: 360px;
    min-width: 50vw;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px) scale(0.98);
        opacity: 0;
    }

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

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-tertiary);
    line-height: 1;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--danger-color);
    background: var(--error-bg);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    background: var(--background);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 공동편집 멤버 모달 */
.collab-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.collab-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.collab-section-count {
    color: var(--text-tertiary);
    font-weight: 600;
}

.collab-section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

.collab-member-loading {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 10px;
}

.collab-member-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow: auto;
}

.collab-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-paper);
}

.collab-member-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--background);
    flex-shrink: 0;
}

.collab-member-info {
    flex: 1;
    min-width: 0;
}

.collab-member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-member-role {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-member-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.collab-member-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
}

.collab-member-status.is-online {
    color: var(--text-secondary);
}

.collab-member-status.is-online .collab-member-status-dot {
    background: var(--text-secondary);
}

.collab-member-status.is-editing {
    color: var(--primary-color);
}

.collab-member-status.is-editing .collab-member-status-dot {
    background: var(--primary-color);
}

.collab-member-status.is-pending {
    color: var(--text-tertiary);
}

.collab-member-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 10px 0;
}

.collab-invite-loading {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 10px;
}

.collab-invite-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow: auto;
}

.collab-invite-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-paper);
}

.collab-invite-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--background);
    flex-shrink: 0;
}

.collab-invite-info {
    flex: 1;
    min-width: 0;
}

.collab-invite-file {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-invite-owner {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-invite-actions {
    display: flex;
    gap: 6px;
}

.collab-invite-action {
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.collab-invite-action.accept {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.collab-invite-action.accept:hover {
    background: var(--primary-light);
}

.collab-invite-action.reject:hover {
    background: var(--error-bg);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.collab-invite-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 10px 0;
}

/* 공동편집 초대 선물 모달 */
.collab-invite-gift-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.collab-invite-gift-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.collab-invite-gift-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.collab-invite-gift-value {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.collab-friend-loading {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 10px;
}

.collab-friend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.collab-friend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-paper);
}

.collab-friend-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--background);
    flex-shrink: 0;
}

.collab-friend-info {
    flex: 1;
    min-width: 0;
}

.collab-friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-friend-id {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collab-friend-action {
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.collab-friend-action:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.collab-friend-action.is-added,
.collab-friend-action:disabled {
    background: var(--background);
    color: var(--text-tertiary);
    border-color: var(--border-color);
    cursor: not-allowed;
}

.collab-friend-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 14px 0;
}

/* PDF 다운로드 모달 - 확장형 레이아웃 */
.modal-content.modal-pdf {
    max-width: 860px;
    width: 95%;
    margin-top: 60px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.pdf-modal-layout {
    display: flex;
    min-height: 400px;
    flex: 1;
    min-height: 0;
}

.pdf-modal-left {
    flex: 1;
    padding: 20px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pdf-modal-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background-secondary);
    min-height: 0;
}

/* 범위 선택 섹션 */
.pdf-range-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdf-select-inline {
    display: flex;
    gap: 10px;
}

.pdf-dropdown-wrap {
    flex: 1;
}

.pdf-dropdown-wrap select {
    width: 100%;
}

/* PDF 테이블 선택 리스트 */
.pdf-table-actions {
    display: flex;
    justify-content: flex-start;
}

.pdf-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.pdf-select-all input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.pdf-table-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    overflow: auto;
    flex: 1;
}

.pdf-table-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background);
    font-size: 13px;
    color: var(--text-primary);
}

.pdf-table-item input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.pdf-table-empty {
    padding: 14px 12px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: center;
}

/* 미리보기 영역 */
.pdf-preview-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-preview-orient {
    display: flex;
    gap: 4px;
}

.pdf-preview-orient-btn {
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    background: var(--background);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-preview-orient-btn:hover {
    border-color: var(--primary-color);
}

.pdf-preview-orient-btn.active {
    border-color: var(--primary-color);
    background: rgba(87, 142, 126, 0.12);
    color: var(--primary-color);
    font-weight: 600;
}

.pdf-preview-area {
    flex: 1;
    padding: 16px;
    overflow: auto;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    --pdf-preview-page-height: clamp(260px, 52vh, 360px);
}

.pdf-preview-zoom-btn {
    position: sticky;
    top: 10px;
    margin-left: auto;
    margin-right: 6px;
    margin-bottom: -32px;
    border: 1px solid var(--border-color);
    background: var(--background);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
    z-index: 2;
}

.pdf-preview-zoom-btn:hover {
    border-color: var(--primary-color);
}

.pdf-preview-zoom-btn.active {
    border-color: var(--primary-color);
    background: rgba(87, 142, 126, 0.12);
    color: var(--primary-color);
}

.pdf-preview-area.is-zoomed .pdf-preview-content {
    transform: scale(0.7);
    transform-origin: top left;
}

.pdf-preview-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
    text-align: center;
}

.pdf-preview-icon {
    font-size: 32px;
    opacity: 0.5;
}

.pdf-preview-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 11px;
    line-height: 1.5;
    flex: 1;
    align-items: flex-start;
}

.pdf-preview-page {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
    min-height: var(--pdf-preview-page-height);
    height: auto;
}

.pdf-preview-page.is-portrait {
    width: calc(var(--pdf-preview-page-height) * 210 / 297);
}

.pdf-preview-page.is-landscape {
    width: calc(var(--pdf-preview-page-height) * 297 / 210);
}

.pdf-preview-table-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.pdf-preview-page-body {
    flex: 1;
    overflow: visible;
}


.pdf-preview-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.pdf-preview-content th,
.pdf-preview-content td {
    border: 1px solid var(--border-color);
    padding: 4px 6px;
    text-align: left;
}

.pdf-preview-content th {
    background: var(--background);
    font-weight: 600;
}

/* 반응형 */
@media (max-width: 640px) {
    .modal-content.modal-pdf {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .pdf-modal-layout {
        flex-direction: column;
        min-height: auto;
    }

    .pdf-modal-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .pdf-modal-right {
        width: 100%;
        min-height: 200px;
    }
}

/* 스크롤바 스타일 (UserOutput과 동일) */
.user-table-page ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.user-table-page ::-webkit-scrollbar-track {
    background: transparent;
}

.user-table-page ::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 10px;
}

.user-table-page ::-webkit-scrollbar-thumb:hover {
    background: #a8a29e;
}
/* inlined: ./table-responsive.css */
/* ==========================================
   반응형 디자인 - 모바일
   ========================================== */

/* 태블릿 (최대 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
        min-width: 220px;
    }
    .cell-content {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* 모바일 태블릿 (최대 768px) */
@media (max-width: 768px) {
    .table-main {
        padding: 8px;
        padding-bottom: 16px;
    }
    .table-container {
        display: flex;
        flex-direction: column;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85vw;
        max-width: 320px;
        height: 100dvh;
        max-height: none;
        min-width: auto;
        z-index: 1201;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border-color);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .tree-container {
        height: calc(100% - 56px);
        max-height: none;
        overflow-y: auto;
    }
    .table-layout {
        border-radius: var(--radius-md);
    }
    .main-content {
        min-height: calc(100vh - 200px);
    }
    .toolbar {
        height: 48px;
        padding: 0 12px;
    }
    .toolbar-top {
        flex: 1;
        min-width: 0;
    }
    .toolbar h2 {
        max-width: 150px;
        font-size: 14px;
    }
    .toolbar-profile {
        width: 28px;
        height: 28px;
        font-size: 14px;
        line-height: 1.1;
    }
    .collab-profile-item {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .collab-profile-dot {
        width: 7px;
        height: 7px;
        right: -1px;
        bottom: -1px;
    }
    .toolbar-member-invite {
        height: 28px;
        padding: 0 10px;
        font-size: 14px;
        line-height: 1.1;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-paper);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        cursor: pointer;
        color: var(--text-primary);
        flex-shrink: 0;
    }
    .mobile-menu-btn:hover,
    .mobile-menu-btn:active {
        background: var(--primary-light);
        border-color: var(--primary-color);
        color: var(--primary-color);
    }
    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1200;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }
    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        border-radius: var(--radius-sm);
        cursor: pointer;
        color: var(--text-tertiary);
    }
    .sidebar-close-btn:hover {
        background: var(--error-bg);
        color: var(--danger-color);
    }
    .cell-content {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 14px;
    }
    .add-row-btn {
        padding: 14px;
        font-size: 14px;
    }
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 16px;
    }
}

/* 모바일 (최대 640px) */
@media (max-width: 640px) {
    .table-main {
        padding: 6px;
        padding-bottom: calc(16px + var(--safe-area-bottom, 0px));
    }
    .sidebar {
        padding-top: var(--safe-area-top);
        padding-bottom: var(--safe-area-bottom);
        padding-left: var(--safe-area-left);
    }
    .sidebar-header {
        height: 48px;
        padding: 0 12px;
    }
    .sidebar-header h3 {
        font-size: 14px;
    }
    .tree-node {
        padding: 10px 12px;
    }
    .tree-label {
        font-size: 13px;
    }
    .table-layout {
        border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    }
    .toolbar {
        height: 44px;
        padding: 0 10px;
    }
    .toolbar h2 {
        font-size: 13px;
        max-width: 52vw;
    }
    .toolbar-profile {
        font-size: 13px;
        line-height: 1.1;
    }
    .collab-profile-list {
        gap: 4px;
    }
    .collab-profile-item {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    .collab-profile-dot {
        width: 6px;
        height: 6px;
    }
    .toolbar-member-invite {
        font-size: 13px;
        line-height: 1.1;
    }
    .editable-table th,
    .solve-table th {
        padding: 8px 10px;
        font-size: 12px;
        background: var(--bg-paper);
        box-shadow: 0 1px 0 var(--border-color);
    }
    .editable-table .th-answer {
        padding-right: 60px;
    }
    .table-delete-btn {
        font-size: 10px;
        padding: 3px 6px;
        right: 4px;
    }
    .cell-content {
        min-height: 48px;
        padding: 12px 10px;
        font-size: 14px;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .solve-input {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .row-delete-btn {
        top: -24px;
        right: 4px;
        padding: 4px 8px;
        font-size: 10px;
    }
    .row-undo-btn {
        top: -28px;
        right: 4px;
        padding: 5px 10px;
        font-size: 10px;
    }
    .empty-state {
        padding: 32px 16px;
    }
    .empty-state svg {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }
    .empty-state p {
        font-size: 13px;
        line-height: 1.5;
        color: var(--text-secondary);
    }
    .score-display {
        padding: 12px;
    }
    .score-value {
        font-size: 28px;
    }
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        animation: modalSlideUp 0.3s ease-out;
        padding-bottom: var(--safe-area-bottom, 0);
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-body {
        padding: 16px;
        max-height: 50vh;
        overflow-y: auto;
    }
    .modal-footer {
        padding: 12px 16px;
    }
    .modal-footer .ut-btn {
        flex: 1;
    }
    .table-wrapper {
        position: relative;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    #editTab .table-wrapper {
        padding-bottom: calc(140px + var(--safe-area-bottom, 0px));
        scroll-padding-bottom: calc(140px + var(--safe-area-bottom, 0px));
    }
    .editable-table,
    .solve-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }
    .editable-table thead,
    .solve-table thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .cell-content:focus,
    .solve-input:focus {
        scroll-margin-bottom: 200px;
    }
    .floating-toolbar {
        position: fixed !important;
        bottom: calc(16px + var(--safe-area-bottom, 0px)) !important;
        top: auto !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        justify-content: space-around;
        padding: 12px 16px;
        border-radius: 16px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    .floating-toolbar-arrow {
        display: none;
    }
    .ftool-btn {
        width: 36px;
        height: 36px;
        font-size: 15px;
        min-width: 44px;
        min-height: 44px;
    }
    .ftool-btn--wide {
        width: auto;
        min-width: auto;
        padding: 0 12px;
        white-space: nowrap;
    }
    .ftool-btn:active {
        transform: scale(0.9);
        background: rgba(255, 255, 255, 0.3);
    }
    .ftool-size {
        font-size: 13px;
        min-width: 24px;
    }
    .ftool-color-label {
        min-width: 44px;
        min-height: 44px;
    }
}

@keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* 초소형 모바일 (최대 480px) */
@media (max-width: 480px) {
    .table-main {
        padding: 4px;
        padding-bottom: calc(16px + var(--safe-area-bottom, 0px));
    }
    .tree-node {
        padding: 8px 10px;
        min-height: 44px;
    }
    .tree-icon {
        width: 14px;
        height: 14px;
    }
    .toolbar h2 {
        max-width: 100px;
    }
    .cell-content {
        padding: 10px 8px;
        font-size: 13px;
        min-height: 44px;
    }
    .tree-onboarding {
        padding: 24px 16px;
    }
    .tree-onboarding-title {
        font-size: 14px;
    }
    .tree-onboarding-desc {
        font-size: 12px;
    }
    .tree-cta-btn {
        padding: 10px 20px;
        font-size: 13px;
        min-height: 44px;
    }
}

/* 가로 모드 모바일 */
@media (max-height: 500px) and (max-width: 900px) {
    .modal-content {
        max-height: 95vh;
    }
    .modal-body {
        max-height: 40vh;
    }
}

/* 데스크톱 전용 */
@media (min-width: 769px) {
    .mobile-menu-btn,
    .sidebar-backdrop,
    .sidebar-close-btn {
        display: none !important;
    }
}

/* 터치 디바이스 */
@media (pointer: coarse) {
    .tree-node:active {
        background: var(--primary-light);
        transform: scale(0.98);
    }
    .tree-action-btn:active,
    .tree-cta-btn:active {
        transform: scale(0.92);
        opacity: 0.8;
    }
    .add-row-btn:active {
        transform: scale(0.98);
        background: var(--primary-light);
    }
    .dropdown-menu-item:active {
        background: var(--primary-light);
        transform: scale(0.98);
    }
    .ut-btn:active {
        transform: scale(0.96);
    }
}
