.base32-tool {
    --base32-panel: #ffffff;
    --base32-panel-soft: #fcfcfd;
    --base32-text: #101418;
    --base32-muted: #5a6872;
    --base32-border: #d8dee4;
    --base32-amber: #fff5e3;
    --base32-amber-border: #ecd8ab;
    --base32-green: #eef8ef;
    --base32-green-border: #cfe2d1;
    --base32-red: #f3e4e4;
    --base32-red-border: #e9d3d3;
    --base32-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: var(--base32-text);
    font-family: "Inter", var(--font-sans);
    padding-top: 0;
}

html[data-theme="dark"] .base32-tool {
    --base32-panel: #181b1f;
    --base32-panel-soft: #20242a;
    --base32-text: #f1f3f5;
    --base32-muted: #9aa2ab;
    --base32-border: #2a3037;
    --base32-amber: rgba(116, 88, 26, 0.2);
    --base32-amber-border: #6f5623;
    --base32-green: rgba(34, 84, 41, 0.22);
    --base32-green-border: #366441;
    --base32-red: rgba(100, 46, 52, 0.24);
    --base32-red-border: #6b3a40;
}

.base32-tool * {
    box-sizing: border-box;
}

.base32-tool .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.base32-topbar,
.base32-status,
.base32-pill-row,
.base32-textarea-header {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.base32-topbar {
    justify-content: space-between;
}

.base32-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.base32-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    height: 100%;
}

.base32-mini,
.base32-helper {
    margin: 0;
    color: var(--base32-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.base32-mini strong,
.base32-pill strong,
.base32-note strong {
    color: var(--base32-text);
}

.base32-inline,
.base32-mini code,
.base32-note code {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--base32-border);
    border-radius: 999px;
    background: var(--base32-panel);
    color: var(--base32-text);
    font-family: var(--base32-mono);
    font-size: 0.86em;
    white-space: nowrap;
}

.base32-helper-error {
    color: #79531b;
    background: var(--base32-amber);
    border: 1px solid var(--base32-amber-border);
    border-radius: 14px;
    padding: 10px 11px;
}

html[data-theme="dark"] .base32-helper-error {
    color: #f0d48c;
}

.base32-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.base32-textarea-header {
    justify-content: space-between;
}

.base32-textarea {
    width: 100%;
    min-width: 0;
    min-height: 220px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--base32-border);
    border-radius: 12px;
    background: var(--base32-panel);
    color: var(--base32-text);
    font-family: var(--base32-mono);
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.base32-textarea[readonly] {
    background: var(--base32-panel-soft);
}

.base32-textarea.base32-output.has-error {
    border-color: var(--base32-amber-border);
    background: #fffaf0;
}

html[data-theme="dark"] .base32-textarea.base32-output.has-error {
    background: rgba(71, 54, 18, 0.25);
}

.base32-textarea:focus,
.base32-button:focus-visible {
    border-color: rgba(11, 132, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(11, 132, 255, 0.1);
    outline: none;
}

.base32-copy-inline {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    flex: 0 0 auto;
}

.base32-copy-inline.done {
    color: #245e2d;
    border-color: var(--base32-green-border);
    background: var(--base32-green);
}

.base32-copy-inline.error {
    color: #7b5c1c;
    border-color: var(--base32-amber-border);
    background: var(--base32-amber);
}

html[data-theme="dark"] .base32-copy-inline.done {
    color: #b8ebbf;
}

html[data-theme="dark"] .base32-copy-inline.error {
    color: #f0d48c;
}

@media (max-width: 560px) {
    .base32-tool {
        padding-top: 0;
    }

    .base32-topbar {
        align-items: stretch;
    }

    .base32-actions {
        width: 100%;
    }

    .base32-textarea {
        min-height: 210px;
    }
}
