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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.hamburger-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border-radius: 6px;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: #7f8c8d;
    border-radius: 1px;
    transition: all 0.2s;
}

.new-tab-btn,
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    color: #7f8c8d;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover:not(:disabled),
.new-tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2c3e50;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn.active {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.header-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.drop-zone.hidden {
    display: none;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

header p {
    color: #7f8c8d;
}

.drop-zone {
    border: 3px dashed #3498db;
    border-radius: 12px;
    background: #fff;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #2980b9;
    background: #ecf0f1;
    transform: translateY(-2px);
}

.drop-zone.dragover {
    border-style: solid;
    background: #d6eaf8;
}

.drop-content svg {
    color: #3498db;
    margin-bottom: 1rem;
}

.drop-content p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.hint {
    font-size: 0.9rem;
    color: #95a5a6;
}

.tabs-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tabs {
    display: flex;
    background: #ecf0f1;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.25rem;
    min-height: 48px;
}

.tab {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    max-width: 200px;
    position: relative;
}

.tab.active {
    font-weight: 600;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    border-bottom-width: 2px;
}

.tab.dragging {
    opacity: 0.5;
}

.tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #e74c3c;
    color: #fff;
}

.content {
    padding: 0;
    min-height: 400px;
    max-height: calc(100vh - 280px);
    overflow: hidden;
    display: flex;
}

.content.single {
    padding: 2rem;
    overflow-y: auto;
    display: block;
}

.pane {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    min-width: 0;
}

.pane-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    padding: 0.6rem 1rem;
    margin: -1.5rem -2rem 1rem -2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pane-body {
    /* content styles already apply via .content descendants */
}

.divider {
    width: 6px;
    background: #ecf0f1;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
}

.divider:hover,
.divider.dragging {
    background: #3498db;
}

.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background: #bdc3c7;
    border-radius: 1px;
}

.content h1, .content h2, .content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.content p {
    margin-bottom: 1rem;
}

.content pre {
    background: #f6f8fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid #e1e4e8;
}

.content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.content code {
    background: #f1f2f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.content ul, .content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content blockquote {
    border-left: 4px solid #3498db;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #555;
}

.empty-state {
    text-align: center;
    color: #95a5a6;
    padding: 3rem;
    font-style: italic;
}

.unrendered-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin: 0.25rem 0;
    vertical-align: middle;
}

.unrendered-notice:hover {
    background: #ffeaa7;
}

.unrendered-notice svg {
    width: 14px;
    height: 14px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 80vw;
    max-height: 80vh;
    width: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #95a5a6;
    line-height: 1;
    padding: 0 0.25rem;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 1.25rem;
    margin: 0;
    overflow: auto;
    background: #f8f9fa;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem 0.5rem;
    }
    header h1 {
        font-size: 2rem;
    }
    .tab {
        max-width: 140px;
        padding: 0.4rem 0.6rem;
    }
}
