*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent:  #c41e3a;
    --text:    #111111;
    --muted:   #787878;
    --bg:      #f3f1ed;
    --surface: #ffffff;
    --border:  #dddad4;
}

body {
    font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Thin top accent stripe */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    z-index: 999;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 28px 52px;
}

/* ── Header ── */
header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 5px;
}

.subtitle {
    font-size: 13px;
    color: var(--muted);
}

/* ── Translator layout ── */
.translator-section {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: 0 20px;
    margin-bottom: 20px;
    align-items: stretch;
}

/* ── Mode toggle (center column) ── */
.mode-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.toggle-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.2s;
    text-align: center;
}

.toggle-label.active {
    color: var(--text);
}

/* Switch */
.switch-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.switch-track {
    display: inline-block;
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.switch-input:checked + .switch-track {
    background: var(--accent);
}

.switch-input:checked + .switch-track::after {
    transform: translateX(22px);
}

/* Passive-aggressive switch uses dark tone instead of accent */
.switch-input.passive:checked + .switch-track {
    background: var(--text);
}

/* Divider between switches */
.toggle-divider {
    width: 32px;
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Active state for passive label */
.toggle-label.passive-active {
    color: var(--text);
}

.input-section,
.output-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 28px;
}

.input-section h2,
.output-section h2 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}

/* ── Textarea ── */
#originalText {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.65;
    resize: vertical;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

#originalText::placeholder {
    color: #bfbbb3;
}

#originalText:focus {
    border-color: var(--accent);
}

/* ── Convert button ── */
.translate-btn {
    width: 100%;
    padding: 14px;
    background: var(--text);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 14px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.translate-btn:hover {
    background: var(--accent);
}

.translate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Output area ── */
.output-area {
    min-height: 214px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}

.placeholder {
    color: #bfbbb3;
    font-style: normal;
}

/* ── Action buttons ── */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.action-btn:hover {
    background: var(--text);
    color: #ffffff;
    border-color: var(--text);
}

/* ── Examples ── */
.examples-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 28px;
}

.examples-section h3 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 20px;
}

.examples {
    display: grid;
    gap: 12px;
}

.example {
    padding: 16px 16px 16px 18px;
    background: var(--bg);
    border-left: 2px solid var(--accent);
    font-size: 14px;
    line-height: 1.65;
}

.example strong {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 5px;
}

/* ── Disclaimer ── */
.disclaimer {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 10px 20px;
    background: #fff8e1;
    border-bottom: 3px solid #e6a800;
    font-size: 13px;
    color: #5a4500;
    line-height: 1.5;
    text-align: center;
}

/* ── Footer ── */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: #c0bcb4;
    font-size: 11px;
    letter-spacing: 0.6px;
}

footer a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}

footer a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 36px 16px 36px;
    }

    .translator-section {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .mode-toggle {
        flex-direction: row;
        gap: 16px;
        padding: 12px 0;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* ── Spinner ── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading::after {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 10px;
    vertical-align: -2px;
}

/* ── Gen Z mode: accent shifts to deep navy, otherwise identical ── */
body.genz-mode {
    --accent: #1a3a6e;
}
