:root {
    --base-font-size: 1rem;
    --scale-factor: 1;
    --content-width: min(800px, 90vw);
    --line-height: 1.7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    font-size: calc(var(--base-font-size) * var(--scale-factor));
}

/* 사용자 컨트롤 스타일 */
.user-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1001;
    /* 테마 토글보다 위에 */
}

.user-profile {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 15px 5px 5px;
    cursor: pointer;
    border-radius: 30px;
    transition: background-color 0.2s;
}

.profile-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: #666;
}

.profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    display: none;
    overflow: hidden;
    z-index: 1002;
}

.profile-menu.show {
    display: block;
}

.menu-item {
    padding: 10px 15px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f8f9fa;
}

.menu-item.danger {
    color: #dc3545;
}

.menu-item.danger:hover {
    background-color: #fff5f5;
}

.menu-item.disabled {
    color: #999;
    cursor: default;
}

.menu-item.disabled:hover {
    background-color: white;
}

.menu-divider {
    height: 1px;
    background-color: #eee;
    margin: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

#userName {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .user-controls {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: flex;
    gap: 20px;
    flex-grow: 1;
}

.sidebar {
    width: 280px;
    display: none;
    flex-direction: column;
    gap: 15px;
}

.sidebar.show {
    display: flex;
}

.upload-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: all 0.3s ease;
}

.upload-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
}

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

.file-button {
    display: inline-block;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
}

.file-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.drop-zone {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 25px 15px;
    margin: 15px 0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.drop-zone.dragover {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.drop-zone p {
    font-size: 0.9rem;
    margin: 5px 0;
}

.drop-zone p:first-child {
    font-weight: 600;
}

.drop-zone p:last-child {
    color: #666;
    font-size: 0.8rem;
}

.file-history {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    flex-grow: 1;
}

.file-history h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-list {
    max-height: 350px;
    overflow-y: auto;
}

.history-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(3px);
}

.history-item.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.history-item-icon {
    width: 28px;
    height: 28px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: #667eea;
    flex-shrink: 0;
}

.history-item.active .history-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.history-item-name {
    flex-grow: 1;
    font-size: 0.85rem;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.3;
}

.history-item-remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.1);
    color: #dc3545;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.history-item:hover .history-item-remove {
    opacity: 1;
}

.history-item-remove:hover {
    background: #dc3545;
    color: white;
}

.history-item.active .history-item-remove {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    opacity: 1;
}

.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.content-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    flex-grow: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
}

.welcome-message {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 60px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
}

.welcome-message p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.file-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.markdown-content {
    line-height: var(--line-height);
    font-size: calc(var(--base-font-size) * var(--scale-factor));
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.markdown-content::-webkit-scrollbar {
    width: 8px;
}

.markdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.markdown-content::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
}

.markdown-content p:first-of-type {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff8f0 100%);
    border-left: 4px solid #667eea;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 15px 0;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.markdown-content p:first-of-type strong {
    color: #667eea;
    font-weight: 600;
    margin-right: 4px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: #333;
    margin: 20px 0 10px 0;
}

.markdown-content h1 {
    font-size: calc(2rem * var(--scale-factor));
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    line-height: 1.3;
}

.markdown-content h2 {
    font-size: calc(1.5rem * var(--scale-factor));
    border-bottom: 2px solid #764ba2;
    padding-bottom: 8px;
    line-height: 1.4;
}

.markdown-content h3 {
    font-size: calc(1.2rem * var(--scale-factor));
    color: #667eea;
    line-height: 1.4;
}

.markdown-content p {
    margin: 15px 0;
}

.markdown-content code,
code {
    background: #fee9bb;
    color: #d84315;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: 1em;
    border-radius: 5px;
    padding: 2px 7px;
}

.markdown-content pre,
pre {
    background: #282c34;
    color: #e3eaf2;
    border-radius: 10px;
    padding: 18px 16px 18px 18px;
    margin: 24px 0;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: 1rem;
    line-height: 1.5;
    overflow-x: auto;
    box-shadow: 0 2px 20px rgba(30, 40, 60, 0.10);
    border-left: 5px solid #5468ff;
}

.markdown-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 20px;
    margin: 20px 0;
    color: #666;
    font-style: normal;
    /* 이탤릭체 제거 */
    background: rgba(102, 126, 234, 0.05);
    padding: 15px 20px;
    border-radius: 0 10px 10px 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.markdown-content li {
    margin: 8px 0;
}

.markdown-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.markdown-content a:hover {
    text-decoration: underline;
}

/* 이탤릭체 강제 제거 */
.markdown-content em,
.markdown-content i {
    font-style: normal !important;
    font-weight: normal;
}

/* NYT 테마에서도 이탤릭체 제거 */
body.nyt-theme .markdown-content em,
body.nyt-theme .markdown-content i {
    font-style: normal !important;
    font-weight: normal;
}

/* 테이블 컨테이너 */
.table-container {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
}

.markdown-content th,
.markdown-content td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.markdown-content th {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.markdown-content tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* 반응형 테이블을 위한 추가 스타일 */
@media (max-width: 768px) {
    .table-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .table-container::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari */
    }

    .markdown-content th,
    .markdown-content td {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

.error-message {
    background: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #c53030;
    margin: 20px 0;
}

.clear-history {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.clear-history:hover {
    background: #c82333;
    transform: translateY(-1px);
}

body.dragging::before {
    content: "📎 파일을 여기에 드롭하세요!";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: none;
}

/* 모바일 최적화 스타일 */
body.mobile-optimized {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body.reading-mode .content-section {
    padding: 20px;
}

body.reading-mode .markdown-content {
    max-width: var(--content-width);
    margin: 0 auto;
}

/* 터치 최적화 */
@media (hover: none) and (pointer: coarse) {
    .history-item {
        min-height: 44px;
        /* 최소 터치 타겟 크기 */
        padding: 12px 15px;
    }

    .btn,
    .file-button,
    .clear-history {
        min-height: 44px;
        padding: 12px 20px;
    }

    .drop-zone {
        padding: 30px 20px;
        min-height: 120px;
    }
}

/* 햅틱 피드백을 위한 스타일 */
@media (hover: none) and (pointer: coarse) {
    .history-item:active {
        background: rgba(102, 126, 234, 0.2);
        transform: scale(0.98);
    }

    .btn:active,
    .file-button:active {
        transform: scale(0.95);
    }
}

/* 반응형 폰트 크기 조절 */
@media (min-width: 1400px) {
    :root {
        --scale-factor: 1.1;
        --base-font-size: 1.1rem;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    :root {
        --scale-factor: 1.05;
        --base-font-size: 1.05rem;
    }
}

@media (min-width: 1000px) and (max-width: 1199px) {
    :root {
        --scale-factor: 1;
        --base-font-size: 1rem;
    }
}

@media (min-width: 800px) and (max-width: 999px) {
    :root {
        --scale-factor: 0.95;
        --base-font-size: 0.95rem;
    }
}

@media (min-width: 600px) and (max-width: 799px) {
    :root {
        --scale-factor: 0.9;
        --base-font-size: 0.9rem;
        --content-width: 95vw;
    }
}

@media (max-width: 599px) {
    :root {
        --scale-factor: 0.85;
        --base-font-size: 0.85rem;
        --content-width: 98vw;
        --line-height: 1.6;
    }
}

/* ===== 뉴욕 타임즈 테마 ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    border-radius: 25px;
    padding: 8px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
}

.theme-toggle button {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f0f0f0;
    color: #666;
    font-weight: 500;
    min-height: 32px;
    /* 최소 터치 타겟 크기 */
    white-space: nowrap;
}

.theme-toggle button.active {
    background: #333;
    color: white;
}

.theme-toggle button:hover:not(.active) {
    background: #e0e0e0;
}

/* 모바일 반응형 테마 토글 */
@media (max-width: 768px) {
    .theme-toggle {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 0.8rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }

    .theme-toggle button {
        padding: 8px 14px;
        font-size: 0.75rem;
        min-height: 36px;
        /* 모바일에서 더 큰 터치 타겟 */
        min-width: 60px;
        /* 최소 너비 보장 */
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 0.75rem;
        flex-direction: column;
        /* 아주 작은 화면에서는 세로 정렬 */
        gap: 6px;
        border-radius: 12px;
    }

    .theme-toggle button {
        padding: 6px 10px;
        font-size: 0.7rem;
        min-height: 32px;
        min-width: 50px;
        border-radius: 8px;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .theme-toggle button {
        /* 터치 시 피드백 */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        user-select: none;
        -webkit-user-select: none;
    }

    .theme-toggle button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

body.nyt-theme {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    background: #ffffff;
    color: #121212;
}

body.nyt-theme .container {
    max-width: 1200px;
    padding: 80px 20px 20px 20px;
}

body.nyt-theme .header {
    text-align: left;
    margin-bottom: 40px;
    color: #121212;
    border-bottom: 1px solid #e2e2e2;
    padding-bottom: 20px;
}

body.nyt-theme .header h1 {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: none;
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

body.nyt-theme .header p {
    font-size: 1.1rem;
    color: #666;
    opacity: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
}

body.nyt-theme .main-content {
    gap: 40px;
}

body.nyt-theme .sidebar {
    width: 320px;
}

body.nyt-theme .upload-section,
body.nyt-theme .file-history {
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    padding: 24px;
    box-shadow: none;
}

body.nyt-theme .upload-section:hover {
    transform: none;
    box-shadow: none;
}

body.nyt-theme .file-button {
    background: #121212;
    color: white;
    padding: 14px 24px;
    border-radius: 0;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.01em;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

body.nyt-theme .file-button:hover {
    background: #333;
    transform: none;
    box-shadow: none;
}

body.nyt-theme .drop-zone {
    border: 1px solid #ccc;
    background: #f8f8f8;
    border-radius: 0;
    padding: 32px 24px;
    transition: background-color 0.2s ease;
}

body.nyt-theme .drop-zone.dragover {
    border-color: #121212;
    background-color: #f0f0f0;
    transform: none;
    box-shadow: none;
}

body.nyt-theme .drop-zone p:first-child {
    font-weight: 600;
    color: #121212;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.nyt-theme .drop-zone p:last-child {
    color: #666;
    font-size: 0.9rem;
}

body.nyt-theme .file-history h3 {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #121212;
    border-bottom: 2px solid #121212;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

body.nyt-theme .history-item {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    margin-bottom: 8px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    transform: none;
}

body.nyt-theme .history-item:hover {
    border-color: #121212;
    background-color: #f8f8f8;
    transform: none;
}

body.nyt-theme .history-item.active {
    background: #f7f7f7;
    border-color: #121212;
    color: #121212;
    border-left: 4px solid #121212;
}

body.nyt-theme .history-item-icon {
    background: #121212;
    color: white;
    border-radius: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.nyt-theme .history-item.active .history-item-icon {
    background: #121212;
    color: white;
}

body.nyt-theme .history-item-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
}

body.nyt-theme .content-section {
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    padding: 40px;
    box-shadow: none;
}

body.nyt-theme .welcome-message {
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    padding: 80px 40px;
    box-shadow: none;
}

body.nyt-theme .welcome-message h2 {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: #121212;
    margin-bottom: 16px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

body.nyt-theme .welcome-message p {
    font-size: 1.1rem;
    color: #666;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

body.nyt-theme .content-header {
    border-bottom: 1px solid #e2e2e2;
    margin-bottom: 32px;
    padding-bottom: 16px;
}

body.nyt-theme .file-name {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #121212;
    line-height: 1.2;
}

body.nyt-theme .file-icon {
    background: #121212;
    color: white;
    border-radius: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
}

body.nyt-theme .btn-secondary {
    background: #ffffff;
    color: #121212;
    border: 1px solid #121212;
    border-radius: 0;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

body.nyt-theme .btn-secondary:hover {
    background: #f7f7f7;
    border-color: #121212;
}

body.nyt-theme .markdown-content {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    line-height: 1.6;
    color: #121212;
    max-width: none;
    padding-right: 0;
}

body.nyt-theme .markdown-content::-webkit-scrollbar {
    width: 12px;
}

body.nyt-theme .markdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body.nyt-theme .markdown-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 0;
}

body.nyt-theme .markdown-content h1,
body.nyt-theme .markdown-content h2,
body.nyt-theme .markdown-content h3 {
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif KR', serif;
    font-weight: 700;
    color: #121212;
    line-height: 1.2;
}

body.nyt-theme .markdown-content h1 {
    font-size: 2.25rem;
    border-bottom: 2px solid #121212;
    padding-bottom: 12px;
    letter-spacing: -0.02em;
}

body.nyt-theme .markdown-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e2e2e2;
    padding-bottom: 8px;
    margin: 32px 0 20px 0;
}

body.nyt-theme .markdown-content h3 {
    font-size: 1.25rem;
    color: #333;
    margin: 28px 0 16px 0;
}

body.nyt-theme .markdown-content p {
    font-size: 1.05rem;
    margin: 20px 0;
    line-height: 1.6;
}

/* ===== 모드 토글 스타일 ===== */
.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.mode-btn {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-height: 44px;
    /* 터치 타겟 */
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.mode-btn:not(.active) {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #ddd;
    box-shadow: none;
}

.mode-btn:not(.active):hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* ===== 에디터 모드 스타일 ===== */
.editor-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    flex-grow: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-type {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

.editor-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.editor-container {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    min-height: 500px;
}

.editor-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-column h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-textarea {
    flex-grow: 1;
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: #ffffff;
}

.editor-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.editor-status {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    color: #333;
    text-align: center;
    font-weight: 500;
}

/* 에디터 상태 표시기 스타일 */
.status-success {
    color: #28a745;
    font-weight: 600;
}

.status-error {
    color: #dc3545;
    font-weight: 600;
}

.status-info {
    color: #17a2b8;
    font-weight: 500;
}

/* SRT 편집기 특수 스타일 */
#srtEditor {
    background: #f8f9fa;
}

#srtEditor:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

/* 반응형 에디터 */
@media (max-width: 768px) {
    .mode-toggle {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    .mode-btn {
        width: 100%;
        padding: 12px 16px;
        min-height: 48px;
    }

    .editor-container {
        flex-direction: column;
        gap: 15px;
    }

    .editor-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .editor-buttons {
        justify-content: center;
    }

    .btn {
        flex: 1;
        min-height: 44px;
        padding: 12px 16px;
    }
}

body.nyt-theme .markdown-content p:first-of-type {
    background: none;
    border-left: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    line-height: 1.6;
    box-shadow: none;
    font-weight: 400;
    color: #121212;
}

body.nyt-theme .markdown-content p:first-of-type strong {
    color: inherit;
    font-weight: 700;
    margin-right: 0;
}

body.nyt-theme .markdown-content code {
    background: #f8f8f8;
    border: 1px solid #e2e2e2;
    padding: 2px 6px;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    color: #d73502;
}

body.nyt-theme .markdown-content pre {
    background: #f8f8f8;
    border: 1px solid #e2e2e2;
    border-left: 4px solid #121212;
    padding: 20px 0px;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

body.nyt-theme .markdown-content blockquote {
    border-left: 3px solid #121212;
    padding: 0 0 0 20px;
    margin: 32px 0;
    color: #666;
    font-style: normal;
    /* 이탤릭체 제거 */
    background: none;
    border-radius: 0;
}

body.nyt-theme .markdown-content a {
    color: #004276;
    text-decoration: underline;
    font-weight: 500;
}

body.nyt-theme .markdown-content a:hover {
    color: #005a9e;
    text-decoration: underline;
}

body.nyt-theme .table-container {
    border: 1px solid #e2e2e2;
    border-radius: 0;
    box-shadow: none;
    margin: 32px 0;
}

body.nyt-theme .markdown-content table {
    border-collapse: collapse;
}

body.nyt-theme .markdown-content th,
body.nyt-theme .markdown-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e2e2;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.nyt-theme .markdown-content th {
    background: #f8f8f8;
    color: #121212;
    font-weight: 600;
    border-bottom: 2px solid #121212;
}

body.nyt-theme .markdown-content tr:hover {
    background-color: #f8f8f8;
}

/* ===== Mermaid 다이어그램 스타일 ===== */
.mermaid-container {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mermaid-error {
    background: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #c53030;
    font-family: monospace;
    font-size: 0.9rem;
}

.mermaid-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* NYT 테마에서의 Mermaid 스타일 */
body.nyt-theme .mermaid-container {
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    padding: 24px;
    margin: 32px 0;
    box-shadow: none;
}

body.nyt-theme .mermaid-error {
    background: #fff8f8;
    border-left: 4px solid #d73502;
    color: #d73502;
    border-radius: 0;
    font-family: 'Courier New', monospace;
}

/* 반응형 Mermaid 다이어그램 */
@media (max-width: 768px) {
    .mermaid-container {
        padding: 15px;
        margin: 15px 0;
        border-radius: 8px;
    }

    body.nyt-theme .mermaid-container {
        padding: 16px;
        margin: 20px 0;
        border-radius: 0;
    }

    .mermaid-container svg {
        font-size: 0.85em;
    }
}

body.nyt-theme .clear-history {
    background: #121212;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    margin-top: 16px;
    transition: background-color 0.2s ease;
}

body.nyt-theme .clear-history:hover {
    background: #333;
    transform: none;
}

body.nyt-theme .error-message {
    background: #fff8f8;
    border-left: 4px solid #d73502;
    color: #d73502;
    border-radius: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    .content-area {
        order: 1;
    }

    .upload-section,
    .content-section,
    .file-history {
        padding: 15px;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .buttons {
        align-self: stretch;
    }

    .markdown-content {
        padding: 10px;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    body.nyt-theme .header h1 {
        font-size: 2.2rem;
    }

    body.nyt-theme .welcome-message h2 {
        font-size: 1.8rem;
    }

    body.nyt-theme .content-section {
        padding: 24px;
    }

    body.nyt-theme .file-name {
        font-size: 1.4rem;
    }

    body.nyt-theme .markdown-content h1 {
        font-size: 1.8rem;
    }

    body.nyt-theme .markdown-content p {
        font-size: 1rem;
    }
}

/* NYT 테마 수정: 읽기 모드 버튼 색상 변경 */
body.nyt-theme .mode-btn {
    background: #f8f8f8;
    color: #333;
    border: 1px solid #ccc;
    box-shadow: none;
}

body.nyt-theme .mode-btn.active {
    background: #121212;
    color: white;
    border-color: #121212;
}

body.nyt-theme .mode-btn:hover {
    transform: none;
    background: #e0e0e0;
}

body.nyt-theme .mode-btn.active:hover {
    background: #333;
}

/* ===== 리더(Reader) 테마 ===== */
body.reader-theme {
    font-family: 'Merriweather', 'Georgia', serif;
    background: #f9f7f1;
    /* 세피아 톤 배경 */
    color: #333;
}

body.reader-theme .container {
    max-width: 900px;
    /* 읽기 편한 너비 */
}

body.reader-theme .header {
    text-align: center;
    margin-bottom: 40px;
    color: #5b4636;
    border-bottom: none;
}

body.reader-theme .header h1 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    color: #5b4636;
    text-shadow: none;
}

body.reader-theme .header p {
    color: #8b7355;
}

/* 리더 테마 - 사이드바 및 업로드 섹션 */
body.reader-theme .upload-section,
body.reader-theme .file-history,
body.reader-theme .content-section,
body.reader-theme .welcome-message,
body.reader-theme .editor-section {
    background: #ffffff;
    border: 1px solid #e8e4d9;
    box-shadow: 0 4px 12px rgba(91, 70, 54, 0.05);
    border-radius: 8px;
}

body.reader-theme .file-button {
    background: #8b4513;
    /* SaddleBrown */
    color: #fff;
    box-shadow: none;
    border-radius: 4px;
}

body.reader-theme .file-button:hover {
    background: #6d360f;
    transform: translateY(-1px);
}

body.reader-theme .drop-zone {
    border: 2px dashed #d2c6b4;
    background: #fdfbf7;
    border-radius: 8px;
}

body.reader-theme .drop-zone.dragover {
    border-color: #8b4513;
    background: #f4efe6;
}

/* 리더 테마 - 버튼 */
body.reader-theme .btn-primary,
body.reader-theme .mode-btn.active {
    background: #8b4513;
    color: white;
    box-shadow: none;
    border: none;
    border-radius: 4px;
}

body.reader-theme .btn-primary:hover,
body.reader-theme .mode-btn.active:hover {
    background: #6d360f;
    transform: translateY(-1px);
}

body.reader-theme .mode-btn {
    border-radius: 4px;
    color: #5b4636;
}

body.reader-theme .btn-secondary {
    background: #f4efe6;
    color: #5b4636;
    border: 1px solid #d2c6b4;
    border-radius: 4px;
}

body.reader-theme .btn-secondary:hover {
    background: #e8e4d9;
}

/* 리더 테마 - 에디터 헤더 */
body.reader-theme .editor-header {
    border-bottom: 1px solid #e8e4d9;
}

body.reader-theme .file-type {
    background: #8b4513;
    color: #fff;
    border-radius: 4px;
}

body.reader-theme #editorFileName {
    color: #5b4636;
    font-family: 'Merriweather', serif;
}

/* 리더 테마 - 에디터 버튼 */
body.reader-theme .btn-success {
    background: #8b4513;
    color: #fff;
    border-radius: 4px;
    border: none;
    box-shadow: none;
}

body.reader-theme .btn-success:hover {
    background: #6d360f;
}

/* 리더 테마 - 콘텐츠 */
body.reader-theme .markdown-content {
    font-family: 'Merriweather', 'Georgia', serif;
    line-height: 1.8;
    color: #2c2c2c;
}

body.reader-theme .markdown-content h1,
body.reader-theme .markdown-content h2,
body.reader-theme .markdown-content h3 {
    color: #5b4636;
    font-family: 'Merriweather', serif;
}

body.reader-theme .markdown-content h1 {
    border-bottom: 2px solid #d2c6b4;
    padding-bottom: 15px;
}

body.reader-theme .markdown-content h2 {
    border-bottom: 1px solid #e8e4d9;
}

body.reader-theme .markdown-content a {
    color: #8b4513;
    text-decoration: underline;
    text-decoration-color: #d2c6b4;
}

body.reader-theme .markdown-content a:hover {
    color: #6d360f;
    text-decoration-color: #8b4513;
}

body.reader-theme .markdown-content code {
    background: #f4efe6;
    color: #8b4513;
    border: 1px solid #e8e4d9;
}

body.reader-theme .markdown-content pre {
    background: #2c2c2c;
    /* 코드는 어둡게 유지하되 약간 따뜻하게? 아니면 그냥 다크 */
    border-left: 4px solid #8b4513;
    border-radius: 8px;
}

body.reader-theme .markdown-content blockquote {
    border-left: 4px solid #d2c6b4;
    background: #f9f7f1;
    color: #666;
    font-style: italic;
}

body.reader-theme .history-item.active {
    background: #8b4513;
    color: white;
    border-left: none;
}

body.reader-theme .history-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

body.reader-theme .file-name {
    color: #5b4636;
}

body.reader-theme .file-icon {
    background: #8b4513;
    border-radius: 4px;
}

/* 리더 테마 - 테이블 */
body.reader-theme .markdown-content th {
    background: #8b4513;
    color: white;
}

body.reader-theme .markdown-content tr:hover {
    background-color: #f4efe6;
}

/* 리더 테마 - 토글 버튼 */
body.reader-theme .theme-toggle {
    background: #f9f7f1;
    border-color: #d2c6b4;
}

body.reader-theme .theme-toggle button.active {
    background: #8b4513;
}

/* NYT 테마 - 에디터 헤더 및 버튼 */
body.nyt-theme .editor-section {
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-radius: 0;
    padding: 40px;
    box-shadow: none;
}

body.nyt-theme .editor-header {
    border-bottom: 1px solid #e2e2e2;
    margin-bottom: 24px;
    padding-bottom: 16px;
}

body.nyt-theme .file-type {
    background: #121212;
    color: #ffffff;
    border-radius: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.nyt-theme #editorFileName {
    color: #333333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.nyt-theme .btn-primary {
    background: #121212;
    color: #ffffff;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid #121212;
}

body.nyt-theme .btn-primary:hover {
    background: #333333;
}

body.nyt-theme .btn-success {
    background: #ffffff;
    color: #121212;
    border-radius: 0;
    border: 1px solid #121212;
    box-shadow: none;
}

body.nyt-theme .btn-success:hover {
    background: #f7f7f7;
}

/* --- Payment & Upgrade UI --- */

/* Upgrade Button */
.btn-upgrade {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-right: 10px;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-upgrade i {
    font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.btn-close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: #333;
}

/* Pricing Modal */
.pricing-modal .modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.crown-icon {
    font-size: 3rem;
    color: #FFD700;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.pricing-content {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.plan-card {
    flex: 1;
    min-width: 280px;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    position: relative;
    transition: transform 0.3s;
}

.plan-card.free {
    background: #f8f9fa;
}

.plan-card.pro {
    background: #fff;
    border: 2px solid #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
    transform: scale(1.05);
}

.popular-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.plan-card h3 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.plan-card .price {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.plan-card .price .period {
    font-size: 1rem;
    color: #999;
    font-weight: normal;
}

.plan-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
    text-align: left;
}

.plan-card ul li {
    margin-bottom: 12px;
    color: #555;
}

.plan-card ul li i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.plan-card ul li i.fa-check {
    color: #2ecc71;
}

.plan-card ul li i.fa-times {
    color: #e74c3c;
}

/* Payment Buttons */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-pay {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.2s;
}

.btn-pay span {
    font-weight: bold;
    font-size: 1rem;
}

.btn-pay small {
    font-size: 0.8rem;
    opacity: 0.8;
}

.btn-pay.toss {
    background: #3182f6;
    color: white;
}

.btn-pay.toss:hover {
    background: #1c6cdc;
}

.btn-pay.stripe {
    background: #635bff;
    color: white;
}

.btn-pay.stripe:hover {
    background: #4b45c6;
}

/* Limit Modal */
.limit-modal {
    max-width: 400px;
    text-align: center;
}

.modal-icon.warning {
    font-size: 3rem;
    color: #f39c12;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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