:root {
    --bg: rgb(32, 32, 32);
    --surface: rgb(40, 40, 40);
    --surface-raised: rgb(50, 53, 60);
    --text: rgb(201, 201, 201);
    --text-strong: #fff;
    --accent: linear-gradient(90deg, #06bfff 0%, #2d73ff 100%);
    --danger: #b00;
    --radius: 24px;

    /* System fonts only -- nothing to download, so the app works offline. */
    --font: "Segoe UI Variable Display", "Segoe UI", -apple-system, "Avenir Next",
        system-ui, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

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

/* Author-level `display` beats the UA stylesheet, so [hidden] needs to win back. */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
}

/* --- Unlock screen ------------------------------------------------------ */

.unlock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2vh;
    height: 100vh;
}

.unlock__input {
    width: min(280px, 80vw);
    padding: 10px;
    border: 1px solid var(--surface-raised);
    border-radius: 2px;
    background-color: var(--surface-raised);
    color: var(--text-strong);
    font-size: 15px;
    outline: none;
}

.unlock__button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: min(300px, 84vw);
    padding: 10px;
    border: none;
    border-radius: 2px;
    background: var(--accent);
    color: var(--text-strong);
    font-family: inherit;
    font-size: 20px;
    cursor: pointer;
}

/* --- Card grid ---------------------------------------------------------- */

.card-grid {
    display: flex;
    flex-flow: row wrap;
    font-size: large;
}

.card {
    display: flex;
    align-items: center;
    width: calc(20vw - 52px);
    margin: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background-color: var(--surface);
    color: inherit;
    font: inherit;
    text-align: center;
    cursor: pointer;
}

.card:hover,
.card:focus-visible {
    outline: none;
    filter: brightness(1.25);
}

.card__logo {
    /* Scales with the card so the label keeps a usable share of narrow cards. */
    width: clamp(48px, 26%, 100px);
    height: auto;
    margin-right: 16px;
    flex-shrink: 0;
}

/* Shown in place of a logo when img/ is absent (see README > Icons). */
.card__logo--initial {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--surface-raised);
    color: var(--text-strong);
    font-size: 1.8em;
    font-weight: 600;
    line-height: 1;
}

.card__body {
    flex: 1;
    padding: 10px;
    min-width: 0;
}

.card__provider {
    display: block;
    font-size: 0.8em;
    opacity: 0.7;
}

.card__account {
    display: block;
    font-size: 0.9em;
    overflow-wrap: break-word;
}

.card__code {
    display: block;
    font-size: 2em;
    letter-spacing: 0.05em;
    /* Fixed-width digits, so the code does not shift as it changes. */
    font-variant-numeric: tabular-nums;
}

/* Column count steps down gradually; a single wide jump leaves cards cramped. */
@media (max-width: 1600px) {
    .card {
        width: calc(25vw - 52px);
    }
}

@media (max-width: 1250px) {
    .card {
        width: calc(33.33vw - 52px);
    }
}

@media (max-width: 950px) {
    .card {
        width: calc(50vw - 52px);
    }
}

@media (max-width: 650px) {
    .card {
        width: calc(100vw - 24px);
    }
}

/* --- Toast -------------------------------------------------------------- */

.toast {
    visibility: hidden;
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    min-width: 250px;
    padding: 16px;
    border-radius: 12px;
    background-color: #333;
    color: var(--text-strong);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.4s ease, bottom 0.4s ease;
    z-index: 10;
}

.toast--visible {
    visibility: visible;
    opacity: 1;
}

.toast--error {
    background-color: var(--danger);
    font-weight: 900;
}

/* --- Configuration ------------------------------------------------------ */

.fab-bar {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
}

.fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-strong);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.fab--secondary {
    width: 44px;
    height: 44px;
    background: var(--surface-raised);
}

.fab:disabled {
    opacity: 0.5;
    cursor: default;
}

.config__status {
    margin: 12px 0 0;
    font-size: 0.9em;
}

.config__status--error {
    color: #ff8080;
    font-weight: 700;
}

.config__primary:disabled,
.config__secondary:disabled {
    opacity: 0.5;
    cursor: default;
}

.config {
    width: min(560px, 92vw);
    border: none;
    border-radius: 12px;
    background-color: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.config::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.config__form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config__title {
    margin: 0;
}

.config__hint {
    margin: 0 0 8px;
    font-size: 0.85em;
    opacity: 0.75;
}

.config input {
    padding: 8px;
    border: 1px solid var(--surface-raised);
    border-radius: 2px;
    background-color: var(--surface-raised);
    color: var(--text-strong);
    font-size: 15px;
    outline: none;
}

.config__preview {
    margin: 12px 0 0;
    font-size: 1.1em;
    font-variant-numeric: tabular-nums;
}

.config__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.config__primary,
.config__secondary {
    padding: 10px 16px;
    border: none;
    border-radius: 2px;
    color: var(--text-strong);
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

.config__primary {
    background: var(--accent);
}

.config__secondary {
    background: var(--surface-raised);
}

.config__output {
    margin-top: 16px;
}

.config__output pre {
    margin: 0 0 8px;
    padding: 10px;
    max-height: 30vh;
    overflow: auto;
    border-radius: 4px;
    background: #1a1a1a;
    color: #7fd1ff;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

::-webkit-scrollbar {
    display: none;
}
