/* ==================== MARKDOWN TO PDF ==================== */

body {
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #0f1419 100%) !important;
    color: var(--text-primary);
}

.md2pdf-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    color: var(--text-primary);
    box-sizing: border-box;
    overflow-x: hidden;
}

.header-section {
    text-align: center;
    margin-bottom: 40px;
}

.header-section h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 800;
}

.header-section h1 i {
    color: #f79112;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 0;
}

/* Editor section */
.editor-section {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

.file-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--primary-light);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    -webkit-tap-highlight-color: rgba(247, 145, 18, 0.2);
    touch-action: manipulation;
}

.btn-secondary:hover {
    background-color: var(--primary-light);
    border-color: #f79112;
    transform: translateY(-2px);
}

.md2pdf-container .btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    -webkit-tap-highlight-color: rgba(247, 145, 18, 0.2);
    touch-action: manipulation;
}

.md2pdf-container .btn-primary:hover {
    transform: translateY(-3px);
    background: #f79112;
    box-shadow: 0 6px 20px rgba(247, 145, 18, 0.6);
}

.md2pdf-container .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Settings panel */
.settings-panel {
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
}

.settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.settings-toggle:hover {
    background: rgba(247, 145, 18, 0.1);
}

.settings-toggle i:first-child {
    color: #f79112;
}

.settings-chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-panel.open .settings-chevron {
    transform: rotate(180deg);
}

.settings-body {
    padding: 20px;
    border-top: 2px solid var(--primary-light);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.setting-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.setting-item select {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--primary-light);
    background-color: #1a2332;
    color: #e8eaed;
    font-size: 0.95rem;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e8eaed' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setting-item select:focus {
    outline: none;
    border-color: #f79112;
    box-shadow: 0 0 0 3px rgba(247, 145, 18, 0.2);
}

.setting-item select option {
    background-color: #1a2332;
    color: #e8eaed;
    padding: 8px 12px;
}

.setting-item select option:checked,
.setting-item select option:hover {
    background-color: #2a3a4f;
    color: #ffffff;
}

.setting-item-full {
    grid-column: 1 / -1;
}

.setting-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--primary-light);
    background-color: #1a2332;
    color: #e8eaed;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setting-input:focus {
    outline: none;
    border-color: #f79112;
    box-shadow: 0 0 0 3px rgba(247, 145, 18, 0.2);
}

.setting-hint {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

.setting-hint code {
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 4px;
}

.setting-item-toggle {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--primary-light);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(247, 145, 18, 0.3);
    border-color: #f79112;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: #f79112;
}

/* Mobile tabs */
.mobile-tabs {
    display: none;
    gap: 0;
    margin-bottom: 12px;
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    overflow: hidden;
}

.mobile-tab {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.mobile-tab.active {
    background: rgba(247, 145, 18, 0.2);
    color: var(--text-primary);
    border-bottom: 2px solid #f79112;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    margin-bottom: 12px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: rgba(247, 145, 18, 0.2);
    touch-action: manipulation;
}

.toolbar-btn:hover {
    border-color: #f79112;
    background: rgba(247, 145, 18, 0.15);
    color: #f79112;
}

/* Split pane — 40% editor, 60% preview */
.split-pane {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 16px;
    min-height: 480px;
    width: 100%;
}

.pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.pane-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.md-editor {
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 440px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #e6edf3;
    background: #0d1117;
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    resize: vertical;
    tab-size: 4;
    box-sizing: border-box;
    white-space: pre-wrap;
    overflow-wrap: normal;
    word-break: normal;
}

.md-editor:focus {
    outline: none;
    border-color: #f79112;
    box-shadow: 0 0 0 3px rgba(247, 145, 18, 0.2);
}

#md2pdf-preview,
.md-preview {
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 440px;
    padding: 24px 32px;
    background: #ffffff;
    color: #24292f;
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 14px;
    user-select: text;
    -webkit-user-select: text;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#md2pdf-preview a {
    color: #0969da;
    text-decoration: none;
    pointer-events: auto;
    cursor: pointer;
    overflow-wrap: anywhere;
    word-break: break-all;
}

#md2pdf-preview a:hover {
    text-decoration: underline;
}

/* Preview typography */
.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4,
.md-preview h5,
.md-preview h6 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    line-height: 1.25;
    color: #1f2328;
}

.md-preview h1 { font-size: 2em; border-bottom: 1px solid #d8dee4; padding-bottom: 0.3em; }
.md-preview h2 { font-size: 1.5em; border-bottom: 1px solid #d8dee4; padding-bottom: 0.3em; }
.md-preview h3 { font-size: 1.25em; }

.md-preview p { margin: 0 0 1em; }
.md-preview ul, .md-preview ol { margin: 0 0 1em; padding-left: 2em; }
.md-preview li { margin-bottom: 0.25em; }

.md-preview blockquote {
    margin: 0 0 1em;
    padding: 0 1em;
    color: #656d76;
    border-left: 4px solid #d0d7de;
}

.md-preview code {
    padding: 0.2em 0.4em;
    font-size: 85%;
    background: #f6f8fa;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.md-preview pre {
    margin: 0 0 1em;
    padding: 16px;
    overflow-x: auto;
    max-width: 100%;
    background: #f6f8fa;
    border-radius: 6px;
    border: 1px solid #d0d7de;
    white-space: pre-wrap;
    word-break: break-word;
}

.md-preview pre code {
    padding: 0;
    background: transparent;
    font-size: 85%;
}

.md-preview table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1em;
    table-layout: fixed;
}

.md-preview th,
.md-preview td {
    border: 1px solid #d0d7de;
    padding: 8px 12px;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.md-preview th {
    background: #f6f8fa;
    font-weight: 600;
}

.md-preview a {
    color: #0969da;
    text-decoration: none;
}

.md-preview a:hover {
    text-decoration: underline;
}

.md-preview hr {
    border: none;
    border-top: 2px solid #d0d7de;
    margin: 1.5em 0;
}

.md-preview img {
    max-width: 100%;
    height: auto;
}

/* Twemoji SVG emojis — inline with text, GitHub-style */
.md-preview img.md-emoji {
    height: 1.15em;
    width: 1.15em;
    max-width: none;
    margin: 0 0.06em;
    vertical-align: -0.15em;
    display: inline;
    border: none;
    box-shadow: none;
}

/* KaTeX math — inline and display */
.md-preview .md-math-inline {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}

.md-preview .md-math-block {
    text-align: center;
    margin: 12px 0;
    overflow-x: auto;
}

.md-preview .katex {
    font-size: 1.05em;
}

.md-preview .md-math-block .katex-display {
    margin: 0;
}

/* Stats */
.stats-row {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-sep {
    opacity: 0.5;
}

/* Instructions */
.instructions-section {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    content-visibility: auto;
}

.instructions-section h2 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 800;
}

.instructions-section h2 i {
    color: #f79112;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.step-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(247, 145, 18, 0.3);
    border-color: #f79112;
    background: rgba(255, 255, 255, 0.05);
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f79112 0%, #ff6b35 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(247, 145, 18, 0.4);
}

.step-content h3 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.step-content p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Features guide (blog-style) */
.features-guide-section {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    content-visibility: auto;
}

.features-guide-section h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 800;
    flex-wrap: wrap;
}

.features-guide-section h2 i {
    color: #f79112;
}

.features-lead {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.65;
    margin-bottom: 28px;
    text-align: center;
}

.on-device-highlight {
    background: linear-gradient(135deg, rgba(247, 145, 18, 0.18) 0%, rgba(34, 197, 94, 0.12) 100%);
    border: 2px solid rgba(247, 145, 18, 0.55);
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 32px;
    text-align: center;
}

.on-device-highlight h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.on-device-highlight h3 i {
    color: #22c55e;
}

.on-device-highlight p {
    color: var(--text-secondary);
    font-size: 1.02rem;
    line-height: 1.7;
    margin: 0 0 10px;
}

.on-device-highlight p:last-child {
    margin-bottom: 0;
}

.on-device-highlight strong {
    color: #f79112;
}

.feature-block {
    margin-bottom: 28px;
}

.feature-block h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.feature-block h3 i {
    color: #f79112;
    flex-shrink: 0;
    margin-top: 3px;
}

.feature-block p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 12px;
}

.feature-block p:last-child {
    margin-bottom: 0;
}

.feature-block ul {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 12px;
    padding-left: 1.4rem;
}

.feature-block li {
    margin-bottom: 6px;
}

.feature-block a,
.features-outro a {
    color: #f79112;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(247, 145, 18, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.feature-block a:hover,
.features-outro a:hover {
    color: #ffad4a;
    border-bottom-color: rgba(255, 173, 74, 0.8);
}

.features-outro {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-top: 24px;
    margin-bottom: 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Visual UI mockups in blog (screenshot-style figures) */
.feature-figure {
    margin: 16px 0 4px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--primary-light);
    background: rgba(0, 0, 0, 0.25);
}

.feature-figure-caption {
    display: block;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-secondary);
    opacity: 0.85;
    margin-top: 8px;
    margin-bottom: 4px;
    font-style: italic;
}

.ui-mock {
    padding: 14px;
    font-family: system-ui, sans-serif;
    font-size: 0.82rem;
}

.ui-mock-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 10px;
}

.ui-mock-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(247, 145, 18, 0.25);
    border: 1px solid rgba(247, 145, 18, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f79112;
    font-weight: 700;
    font-size: 0.7rem;
}

.ui-mock-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-height: 100px;
}

.ui-mock-pane {
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.ui-mock-pane-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #f79112;
    margin-bottom: 6px;
    font-weight: 700;
}

.ui-mock-code {
    font-family: ui-monospace, monospace;
    font-size: 0.72rem;
    color: #a8b3cf;
    line-height: 1.5;
}

.ui-mock-preview h4 {
    margin: 0 0 4px;
    font-size: 0.9rem;
    color: #e8eaed;
}

.ui-mock-preview p {
    margin: 0;
    font-size: 0.75rem;
    color: #b0b8c4;
}

.ui-mock-settings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ui-mock-setting {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px;
    font-size: 0.7rem;
    color: #b0b8c4;
}

.ui-mock-setting strong {
    display: block;
    color: #f79112;
    margin-bottom: 4px;
}

.ui-mock-badge {
    display: inline-block;
    background: #24292f;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    margin: 4px 0;
}

.ui-mock-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ui-mock-tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #b0b8c4;
    font-size: 0.75rem;
}

.ui-mock-tab.active {
    background: rgba(247, 145, 18, 0.3);
    color: #f79112;
    font-weight: 700;
}

/* FAQ */
.faq-section {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    content-visibility: auto;
}

.faq-section h2 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 800;
}

.faq-section h2 i {
    color: #f79112;
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item-pdf {
    margin-bottom: 15px;
    border: 2px solid var(--primary-light);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
}

.faq-item-pdf:hover {
    border-color: #f79112;
}

.faq-question-pdf {
    padding: 15px 15px 15px 40px;
    background-color: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.faq-question-pdf::before {
    content: '+';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
    font-weight: normal;
    line-height: 1;
    transition: transform 0.3s ease;
    color: #f79112;
}

.faq-item-pdf.active .faq-question-pdf {
    background-color: rgba(247, 145, 18, 0.2);
    color: var(--text-primary);
    border-bottom: 2px solid #f79112;
}

.faq-item-pdf.active .faq-question-pdf::before {
    content: '-';
    transform: translateY(-50%) rotate(180deg);
}

.faq-answer-pdf {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.faq-item-pdf.active .faq-answer-pdf {
    padding: 15px;
    max-height: 1000px;
}

.faq-answer-pdf p {
    margin: 0;
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Responsive — breakpoints aligned with merge-pdf / watermark / remove-pdf-pages */
@media (max-width: 1200px) {
    .split-pane {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 12px;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 400px;
    }

    #md2pdf-preview,
    .md-preview {
        padding: 20px 24px;
    }
}

@media (max-width: 992px) {
    .md2pdf-container {
        padding: 16px;
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
    }

    .header-section {
        margin-bottom: 28px;
    }

    .header-section h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }

    .subtitle {
        font-size: 1.05rem;
        padding: 0 8px;
    }

    .editor-section {
        padding: 22px 18px;
        border-radius: 16px;
        margin-bottom: 32px;
    }

    .mobile-tabs {
        display: flex;
    }

    .split-pane {
        grid-template-columns: 1fr;
        min-height: auto;
        gap: 0;
    }

    .pane-preview {
        display: none;
    }

    .pane-preview.active {
        display: flex;
    }

    .pane-editor.active {
        display: flex;
    }

    .pane-editor:not(.active) {
        display: none;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 360px;
    }

    #md2pdf-preview,
    .md-preview {
        padding: 18px 20px;
    }

    .file-actions-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .file-actions-row .btn-primary {
        grid-column: 1 / -1;
    }

    .file-actions-row .btn-secondary,
    .file-actions-row .btn-primary {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .settings-body {
        padding: 16px;
    }

    .toolbar {
        gap: 5px;
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .toolbar-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .steps-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .instructions-section,
    .faq-section,
    .features-guide-section {
        padding: 28px 20px;
        border-radius: 16px;
        margin-bottom: 32px;
    }

    .instructions-section h2,
    .faq-section h2,
    .features-guide-section h2 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 10px;
    }

    .features-guide-section h2 {
        font-size: 1.45rem;
    }

    .on-device-highlight {
        padding: 18px 16px;
        text-align: left;
    }

    .on-device-highlight h3 {
        justify-content: flex-start;
        font-size: 1.1rem;
    }

    .feature-block h3 {
        font-size: 1.1rem;
    }

    .ui-mock-split {
        grid-template-columns: 1fr;
    }

    .ui-mock-settings {
        grid-template-columns: 1fr 1fr;
    }

    /* Performance: same as merge-pdf / watermark on tablet+mobile */
    .editor-section,
    .settings-panel,
    .instructions-section,
    .features-guide-section,
    .faq-section,
    .step-item {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .step-item:hover {
        transform: none;
        box-shadow: none;
    }

    .btn-secondary:hover,
    .md2pdf-container .btn-primary:hover,
    .toolbar-btn:hover {
        transform: none;
    }

    #md2pdf-preview,
    .md-preview {
        contain: layout style;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

@media (max-width: 768px) {
    .md2pdf-container {
        padding: 14px;
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(14px, env(safe-area-inset-right, 0px));
    }

    .header-section h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .editor-section {
        padding: 20px 16px;
    }

    .file-actions-row {
        grid-template-columns: 1fr;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 320px;
        font-size: 13px;
    }

    #md2pdf-preview,
    .md-preview {
        padding: 16px;
    }

    .md-preview pre {
        padding: 12px;
        font-size: 12px;
    }

    .md-preview table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .settings-toggle {
        padding: 14px 16px;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .stats-row {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }

    .faq-question-pdf {
        font-size: 1rem;
        padding: 14px 14px 14px 38px;
    }

    .faq-answer-pdf p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .md2pdf-container {
        padding: 10px;
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }

    .header-section {
        margin-bottom: 22px;
    }

    .header-section h1 {
        font-size: 1.5rem;
        gap: 8px;
    }

    .subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .editor-section {
        padding: 15px 12px;
        border-radius: 14px;
        margin-bottom: 24px;
    }

    .btn-secondary,
    .md2pdf-container .btn-primary {
        font-size: 0.9rem;
        padding: 12px 16px;
    }

    .mobile-tab {
        padding: 14px 10px;
        font-size: 0.9rem;
        min-height: 48px;
    }

    .toolbar-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 280px;
        padding: 12px;
        border-radius: 8px;
    }

    #md2pdf-preview,
    .md-preview {
        padding: 14px 12px;
    }

    .md-preview h1 { font-size: 1.6em; }
    .md-preview h2 { font-size: 1.35em; }
    .md-preview h3 { font-size: 1.15em; }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .setting-item select {
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 44px;
    }

    .instructions-section,
    .faq-section,
    .features-guide-section {
        padding: 20px 14px;
        margin-bottom: 24px;
    }

    .instructions-section h2,
    .faq-section h2 {
        font-size: 1.35rem;
    }

    .features-guide-section h2 {
        font-size: 1.25rem;
    }

    .features-lead,
    .features-outro {
        font-size: 0.98rem;
        text-align: left;
    }

    .feature-block p,
    .feature-block ul {
        font-size: 0.95rem;
    }

    .step-content h3 {
        font-size: 1.1rem;
    }

    .step-content p {
        font-size: 0.95rem;
    }

    .ui-mock-settings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .header-section h1 {
        font-size: 1.35rem;
    }

    .header-section h1 i {
        font-size: 1.2rem;
    }

    .toolbar-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 240px;
    }

    .faq-question-pdf {
        font-size: 0.95rem;
        padding-left: 34px;
    }

    .faq-question-pdf::before {
        left: 12px;
        font-size: 1.3em;
    }
}

/* Short landscape phones / small height */
@media (max-width: 896px) and (max-height: 500px) and (orientation: landscape) {
    .header-section {
        margin-bottom: 16px;
    }

    .header-section h1 {
        font-size: 1.4rem;
    }

    .md-editor,
    #md2pdf-preview,
    .md-preview {
        min-height: 200px;
        max-height: 50vh;
    }

    .split-pane {
        min-height: auto;
    }
}
