:root {
    --bg: #0d0d0d;
    --surface: #141414;
    --surface-hover: #1f1f1f;
    --border: #2a2a2a;
    --text-primary: #e6e6e6;
    --text-secondary: #888;
    --accent: #3291ff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    height: 54px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--surface);
    font-family: var(--font-mono);
    flex-shrink: 0;
    z-index: 10;
}

.brand { font-weight: 600; font-size: 15px; color: #fff; letter-spacing: -0.5px; }
.brand span { color: var(--text-secondary); font-weight: 400; }
.engine-tag { 
    font-size: 11px; color: var(--text-secondary); 
    border: 1px solid var(--border); padding: 4px 8px; border-radius: 4px; 
    background: var(--bg);
}

.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 54px);
    overflow: hidden;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    user-select: none;
    height: 20px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding: 24px;
    max-width: 50%;
    background: var(--bg);
}

.textarea-wrapper {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: 0.2s;
    position: relative;
}

.textarea-wrapper:focus-within { border-color: #555; background: var(--surface-hover); }

textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    resize: none;
    outline: none;
    line-height: 1.7;
}
textarea::placeholder { color: #444; }

.action-bar {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
    flex-shrink: 0;
}

.status-container {
    flex: 1;
    margin-right: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-bar {
    height: 3px;
    background: #333;
    width: 100%;
    margin-top: 6px;
    border-radius: 2px;
    overflow: hidden;
    display: none;
}

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    width: 0%;
    transition: width 0.2s;
}

.btn-primary {
    background: #fff;
    color: #000;
    border: none;
    height: 36px;
    padding: 0 20px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.btn-primary:hover { background: #eee; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.output-section {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
    background: #111;
    display: flex;
    flex-direction: column;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #444;
    font-family: var(--font-mono);
    font-size: 13px;
}

#resultContainer {
    flex: 1;
}

.document-view {
    color: #d0d0d0;
    line-height: 1.8;
    font-size: 16px;
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.markdown-body h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-top: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    line-height: 1.3;
}

.markdown-body h2 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin-top: 40px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}
.markdown-body h2::before {
    content: "#";
    color: var(--text-secondary);
    margin-right: 8px;
    font-weight: 400;
    opacity: 0.5;
}

.markdown-body h3 {
    font-size: 17px;
    font-weight: 600;
    color: #eee;
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body p {
    margin-bottom: 20px;
    color: #ccc;
}

.markdown-body strong {
    color: #fff;
    font-weight: 600;
}

.markdown-body blockquote {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--accent);
    padding: 16px 20px;
    margin: 24px 0;
    color: #aaa;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 8px;
    color: #ccc;
}

.markdown-body code {
    background: #222;
    color: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    border: 1px solid #333;
}

.markdown-body pre {
    background: #181818;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #333;
    margin: 24px 0;
}
.markdown-body pre code {
    background: none;
    color: #ccc;
    padding: 0;
    border: none;
    font-size: 13px;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    transition: 0.2s;
}
.copy-btn:hover {
    color: #fff;
    border-color: #666;
    background: rgba(255,255,255,0.05);
}

@media (max-width: 768px) {
    .main-container { flex-direction: column; height: auto; }
    .input-section { max-width: 100%; border-right: none; border-bottom: 1px solid var(--border); min-height: 40vh; }
    .textarea-wrapper { height: 200px; }
    .output-section { padding: 20px; min-height: 50vh; }
    body { height: auto; overflow: auto; }
}
