:root {
    --page-max-width: 800px;
    --page-padding: 20px;
    --text: #111827;
    /* dark gray */
    --muted: #6b7280;
    --brand: #2e7d32;
    /* accessible green */
    --brand-strong: #256029;
    --info-text: #01579b;
    --info-bg: #e3f6ff;
    --error-text: #b00020;
    --error-bg: #ffebee;
    --success-text: #1b5e20;
    --success-bg: #e8f5e9;
    --surface: #ffffff;
}

body {
    font-family: Inter, Arial, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: var(--text);
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: var(--page-padding);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

/* Topbar / language group */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
}

.lang-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-btn {
    padding: 8px 10px;
    border-radius: 7px;
    background: #f0f0f0;
    color: #0f1724;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    transition: all .15s;
}

.lang-btn.active,
.lang-btn[aria-pressed="true"] {
    background: var(--brand);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.06);
}

.lang-btn:focus-visible {
    outline: 3px solid rgba(37, 96, 41, 0.18);
    outline-offset: 2px;
}

/* Main controls container to manage spacing */
.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.controls select,
.controls button {
    min-width: 140px;
}

textarea {
    box-sizing: border-box;
    /* include padding/border in width calculations */
    width: 100%;
    /* never grow wider than 360px on small devices */
    height: 150px;
    margin-bottom: 10px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    resize: vertical;
    background: #fff;
    color: var(--text);
}

textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 6px 18px rgba(37, 125, 50, 0.08);
}

select {
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: box-shadow .18s, border-color .18s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1.1em;
    padding-right: 38px;
}

select:focus {
    border-color: var(--brand);
    box-shadow: 0 8px 20px rgba(37, 125, 50, 0.06);
    outline: none;
}

button {
    padding: 10px 15px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
}

button:hover {
    background: var(--brand-strong);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.08);
}

button:active {
    transform: translateY(1px);
}

button:focus-visible {
    outline: 3px solid rgba(37, 96, 41, 0.14);
    outline-offset: 2px;
}

#status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
}

.sample-section {
    margin: 20px 0;
}

.sample-category {
    font-weight: 700;
    margin: 8px 0 6px;
}

.sample-text {
    margin: 6px 0;
    padding: 10px;
    background: #f7f7f8;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s ease, transform .08s ease;
}

.sample-text:hover {
    background: #efefef;
    transform: translateY(-1px);
}

.error {
    color: var(--error-text);
    background-color: var(--error-bg);
}

.success {
    color: var(--success-text);
    background-color: var(--success-bg);
}

.info {
    color: var(--info-text);
    background-color: var(--info-bg);
}

.examples {
    margin-top: 20px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
}

.example-item {
    margin: 8px 0;
}

.example-input {
    font-weight: 700;
}

#footer a {
    color: var(--brand);
    text-decoration: none;
    transition: color .18s ease;
}

#footer a:hover {
    color: var(--brand-strong);
    text-decoration: underline;
}

/* Responsive adjustments for mobile */
@media (max-width:600px) {
    body {
        padding: 14px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 1.05rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .controls select,
    .controls button {
        width: 100%;
        min-width: unset;
    }

    textarea {
        height: 120px;
        font-size: 15px;
        box-sizing: border-box;
        /* ensure fits common small screens */
        width: calc(100vw - 28px);
        /* account for body padding on small screens */
    }

    .sample-text {
        padding: 12px;
    }

    #status {
        font-size: 14px;
    }
}
