:root {
    --color-bg-page: #f8fafc;
    --color-text-primary: #0f172a;
    --color-text-muted: #334155;

    --color-surface: #ffffff;
    --color-surface-muted: #f1f5f9;
    --color-border: #cbd5e1;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;

    --color-toggle-bg: #e2e8f0;
}

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

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--color-bg-page);
    color: var(--color-text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-muted);
}

.toggle {
    display: flex;
    background: var(--color-toggle-bg);
    border-radius: 8px;
    overflow: hidden;
}

.toggle input {
    display: none;
}

.toggle label {
    flex: 1;
    padding: 0.6rem 0;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: 0.2s;
}

#mode-encrypt:checked + label,
#mode-decrypt:checked + label {
    background: var(--color-primary);
    color: white;
}

.algorithm-fieldset {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.radio-option input {
    accent-color: var(--color-primary);
}

textarea {
    width: 100%;
    min-height: 140px;
    resize: none;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    font-size: 0.95rem;
    font-family: inherit;
}

textarea:focus {
    border-color: var(--color-primary);
}

button {
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    background: var(--color-primary-hover);
}

output {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    border: 2px dashed var(--color-border);
    background: var(--color-surface-muted);
    min-height: 80px;
    word-break: break-word;
    text-align: center;
}
