:root {
    --bg-top: #f7efe4;
    --bg-bottom: #efdfcc;
    --surface: rgba(255, 250, 244, 0.9);
    --text: #2e241e;
    --muted: #6d6058;
    --heading: #255a87;
    --accent: #c86431;
    --accent-dark: #a24b21;
    --border: rgba(98, 73, 49, 0.14);
    --shadow: 0 24px 60px rgba(78, 46, 20, 0.12);
    --code-bg: #201b18;
    --code-text: #f3ece5;
    --input-bg: #f5eee6;
    --input-text: #3b312c;
    --error: #b64136;
    --success: #2f7d57;
    --warning: #8f5a1b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 214, 166, 0.92), transparent 28%),
        radial-gradient(circle at right center, rgba(228, 177, 128, 0.38), transparent 24%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

.document-page {
    width: min(1000px, calc(100% - 36px));
    margin: 28px auto;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.page-header {
    margin-bottom: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.page-header h1 {
    margin: 0;
    font-size: 2.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, var(--heading), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    max-width: 700px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

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

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.doc-section h2 {
    margin: 0;
    color: var(--heading);
    font-size: 1.45rem;
    font-weight: 700;
}

.section-badge {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(37, 90, 135, 0.1);
    color: var(--heading);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-badge {
    background: rgba(47, 125, 87, 0.12);
    color: var(--success);
}

.status-badge.loading {
    background: rgba(143, 90, 27, 0.13);
    color: var(--warning);
}

.status-badge.error {
    background: rgba(182, 65, 54, 0.12);
    color: var(--error);
}

.code-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

textarea,
.output-panel pre {
    width: 100%;
    margin: 0;
    padding: 20px 18px;
    border: none;
    font-size: 0.97rem;
    line-height: 1.6;
    font-family: "Courier New", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

textarea {
    min-height: 220px;
    resize: vertical;
    outline: none;
    background: var(--input-bg);
    color: var(--input-text);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

textarea:focus {
    background: #f9f3ec;
    box-shadow: inset 0 0 0 2px rgba(200, 100, 49, 0.22);
}

.helper-text {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.5;
}

.helper-text code {
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(200, 100, 49, 0.1);
    color: var(--accent-dark);
    font-family: "Courier New", monospace;
}

.output-panel {
    min-height: 300px;
    background: var(--code-bg);
}

.output-panel pre {
    min-height: 300px;
    background: transparent;
    color: var(--code-text);
    overflow-x: auto;
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

button {
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: scale(0.98);
}

#sampleBtn {
    border: 1px solid var(--border);
    background: rgba(255, 250, 243, 0.88);
    color: var(--heading);
}

#submitBtn {
    border: none;
    background: linear-gradient(135deg, var(--accent), #de7d42);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(200, 101, 49, 0.25);
}

button:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.error {
    min-height: 22px;
    margin-top: 10px;
    color: var(--error);
    font-size: 0.93rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .document-page {
        width: min(100% - 20px, 100%);
        margin: 14px auto;
        padding: 18px;
        border-radius: 20px;
    }

    .page-header h1 {
        font-size: 1.9rem;
    }

    .brand-logo {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .page-subtitle {
        font-size: 0.95rem;
    }

    .section-heading,
    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

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

    textarea,
    .output-panel pre {
        padding: 16px 14px;
        font-size: 0.9rem;
    }

    textarea {
        min-height: 200px;
    }

    .output-panel,
    .output-panel pre {
        min-height: 240px;
    }
}
