/* Solarized palette (Ethan Schoonover). Light by default, dark when the
   system prefers it, and data-theme on <html> overrides both. */
:root {
    --base03: #002b36;
    --base02: #073642;
    --base01: #586e75;
    --base00: #657b83;
    --base0: #839496;
    --base1: #93a1a1;
    --base2: #eee8d5;
    --base3: #fdf6e3;
    --yellow: #b58900;
    --orange: #cb4b16;
    --red: #dc322f;
    --blue: #268bd2;
    --cyan: #2aa198;
    --green: #859900;

    --bg: var(--base3);
    --surface: var(--base2);
    --text: var(--base01);
    --muted: var(--base00);
    --edge: var(--base1);
    --accent: var(--blue);
    --on-accent: var(--base3);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: var(--base03);
        --surface: var(--base02);
        --text: var(--base1);
        --muted: var(--base0);
        --edge: var(--base01);
        --on-accent: var(--base03);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: var(--base03);
    --surface: var(--base02);
    --text: var(--base1);
    --muted: var(--base0);
    --edge: var(--base01);
    --on-accent: var(--base03);
    color-scheme: dark;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.top,
main,
footer {
    width: 100%;
    max-width: 38rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text);
}

main {
    flex: 1;
}

footer {
    padding-bottom: 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
    border-bottom: thin solid var(--edge);
}

.tabs [role="tab"] {
    flex: 1;
    border: none;
    border-bottom: 0.2rem solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-weight: 600;
}

.tabs [role="tab"][aria-selected="true"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

form,
.card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.card {
    padding: 1rem;
    border: thin solid var(--edge);
    border-radius: 0.5rem;
    background: var(--surface);
}

.card p {
    margin: 0;
}

label {
    font-weight: 600;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.6em 0.75em;
    border: thin solid var(--edge);
    border-radius: 0.4rem;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.drop:focus-within {
    outline: 0.15rem solid var(--accent);
    outline-offset: 0.1rem;
}

/* After the generic input rule, and as specific, so it wins. */
input.code-input,
.code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

input.code-input {
    font-size: 1.2rem;
}

.code {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    overflow-wrap: anywhere;
    user-select: all;
}

button {
    padding: 0.6em 1.1em;
    border: thin solid var(--accent);
    border-radius: 0.4rem;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: progress;
}

button.quiet {
    align-self: flex-start;
    padding: 0.3em 0.6em;
    border-color: var(--edge);
    background: none;
    color: var(--muted);
    font-weight: 400;
}

button.danger {
    border-color: var(--red);
    background: none;
    color: var(--red);
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-weight: 400;
}

.drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border: 0.15rem dashed var(--edge);
    border-radius: 0.5rem;
    color: var(--muted);
    font-weight: 400;
    text-align: center;
    cursor: pointer;
}

.drop.over {
    border-color: var(--accent);
    color: var(--accent);
}

/* The label is the visible control; the input stays focusable for keyboards. */
.drop input {
    position: absolute;
    width: 1em;
    height: 1em;
    opacity: 0;
    pointer-events: none;
}

.drop span {
    color: var(--accent);
    font-weight: 600;
}

.file-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.status {
    margin: 0;
    min-height: 1.5em;
}

/* Solarized accents are mid-tones, too faint for small text on the light
   background: errors get weight, success a green bar beside normal text. */
.hint.error,
.status.error {
    color: var(--red);
    font-weight: 600;
}

.hint.ok,
.status.ok {
    padding-left: 0.6rem;
    border-left: 0.25rem solid var(--green);
}

progress {
    width: 100%;
    height: 0.75rem;
    accent-color: var(--accent);
}
