:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
    color: #102a43;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

header {
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 8px;
    font-size: 2.2rem;
}

p {
    margin: 0;
    line-height: 1.6;
    color: #475569;
}

.panel {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 16px 40px rgba(16, 42, 67, 0.08);
}

.split-grid {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

.pane {
    flex: 1;
    min-width: 320px;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.field-row .field-group {
    flex: 1;
    min-width: 140px;
}

.pane-right {
    max-width: 640px;
    display: flex;
    flex-direction: column;
}

.pane-right .output-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#outputText {
    min-height: 260px;
    white-space: pre-wrap;
    overflow: auto;
    resize: vertical;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pane-right .preview-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.output-actions {
    margin-top: auto;
    align-self: flex-start;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
}

label {
    font-weight: 700;
    font-size: 0.95rem;
}

select,
textarea,
input[type="file"] {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f8fbff;
    font: 1rem inherit;
    color: #102a43;
}

textarea {
    min-height: 220px;
    resize: vertical;
}

.pane-left #inputTextGroup {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pane-left #inputTextGroup textarea {
    min-height: 260px;
    resize: vertical;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

button {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

#convertButton {
    background: #0f63ff;
    color: #ffffff;
}

#copyButton {
    background: #3b82f6;
    color: #ffffff;
}

#clearButton {
    background: #e2e8f0;
    color: #102a43;
}

.preview-panel {
    border-top: 1px solid #e2e8f0;
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.preview-header span {
    font-weight: 700;
}

#downloadLink {
    text-decoration: none;
    color: #ffffff;
    background: #0f63ff;
    padding: 10px 14px;
    border-radius: 10px;
}

#pdfPreview {
    width: 100%;
    min-height: 480px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
}

.notes {
    margin-top: 22px;
    color: #334e68;
}

.notes h2 {
    margin-bottom: 10px;
}

.notes ul {
    padding-left: 20px;
}

.notes li {
    margin-bottom: 8px;
}

.hidden,
.preview-panel[hidden] {
    display: none !important;
}

@media (max-width: 880px) {
    .split-grid {
        flex-direction: column;
    }

    .pane-right {
        max-width: none;
    }
}

@media (max-width: 640px) {
    .actions,
    .output-actions {
        flex-direction: column;
    }
}
