:root {
    color-scheme: dark;
    --accent: #b8bb26;
    --text: #ebdbb2;
    --muted: #928374;
    --border: #504945;
    --background: #1d2021;
    --surface: #282828;
    --surface-hover: #3c3836;
    --heading: #fbf1c7;
    --code: #83a598;
    --success: #8ec07c;
    --error: #fb4934;
    --warning: #fabd2f;
}

:root[data-theme="light"] {
    color-scheme: light;
    --accent: #79740e;
    --text: #3c3836;
    --muted: #7c6f64;
    --border: #d5c4a1;
    --background: #fbf1c7;
    --surface: #ebdbb2;
    --surface-hover: #d5c4a1;
    --heading: #282828;
    --code: #076678;
    --success: #427b58;
    --error: #cc241d;
    --warning: #b57614;
}

* {
    box-sizing: border-box;
}

::selection {
    background: var(--accent);
    color: var(--background);
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
    line-height: 1.6;
}

button,
textarea,
input {
    font: inherit;
}

.container {
    width: min(760px, calc(100% - 32px));
    margin: 64px auto;
}

header {
    margin-bottom: 40px;
}

.header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

h1 {
    margin: 0;
    font-size: 2.2rem;
    color: var(--heading);
}

h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--heading);
}

p {
    margin: 8px 0;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.875rem;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 10px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--heading);
    border-bottom-color: var(--accent);
}

.panel {
    margin-bottom: 48px;
}

label {
    display: block;
    margin-top: 22px;
    margin-bottom: 7px;
    font-weight: 600;
}

textarea,
input[type="password"],
input[type="file"] {
    width: 100%;
}

textarea,
input[type="password"] {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
}

textarea {
    resize: vertical;
    line-height: 1.45;
}

textarea:focus,
input:focus,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.key {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82rem;
}

input[type="file"] {
    padding: 10px 0;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.primary {
    margin-top: 24px;
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: var(--background);
    font-weight: 600;
}

.primary:hover:not(:disabled) {
    filter: brightness(0.92);
}

.action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
}

.action-row .primary {
    margin-top: 0;
}

.action-row .status {
    margin-top: 0;
}

.secondary {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: transparent;
    color: var(--text);
}

.secondary:hover {
    background: var(--surface);
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-button:hover {
    color: var(--text);
}

.theme-toggle {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--surface-hover);
}

#recipient-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
    color: var(--code);
}

details {
    margin-top: 20px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

summary {
    cursor: pointer;
    font-weight: 600;
}

details textarea {
    margin-top: 8px;
}

.result {
    margin-top: 28px;
}

.result-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.result-header label,
.result-header button {
    margin-bottom: 7px;
}

.status {
    min-height: 24px;
    margin-top: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--muted);
}

.status[data-type="success"] {
    color: var(--success);
}

.status[data-type="error"] {
    color: var(--error);
}

.warning {
    margin-top: 24px;
    padding: 12px 14px;
    border: 1px solid var(--warning);
    border-radius: 6px;
    background: var(--surface);
    color: var(--warning);
    font-weight: 600;
}

footer {
    margin-top: 72px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.9rem;
}

footer a,
.muted a {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

footer a:hover,
.muted a:hover {
    color: var(--text);
}

[hidden] {
    display: none !important;
}

@media (max-width: 520px) {
    .container {
        margin-top: 32px;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab {
        flex: 1;
    }
}
