/* Passer: calm, sober "vault" look. Navy for trust, emerald for "secured", no decoration
   that distracts from the one thing on the page. */

:root {
    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --text: #0f1b2d;
    --muted: #55627a;
    --border: #d6deea;
    --border-strong: #b9c5d8;
    --input-border: #7c8aa3;

    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-text: #ffffff;
    --primary-soft: #e6edfd;

    --secure: #047857;
    --secure-soft: #e3f6ee;
    --warn: #b45309;
    --warn-soft: #fdf1e2;
    --error: #b42318;
    --error-soft: #fdecea;

    /* The header is always dark, in both themes. */
    --hero-bg: #0b1f45;
    --hero-bg-2: #12306a;
    --hero-text: #e8eefb;
    --hero-muted: #a9b8d6;
    --hero-accent: #34d399;

    --focus: #2563eb;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgb(15 27 45 / .06), 0 12px 32px -12px rgb(15 27 45 / .18);
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #070d1a;
        --surface: #0f182b;
        --surface-2: #131e35;
        --text: #e6ecf6;
        --muted: #97a5bd;
        --border: #243149;
        --border-strong: #33435f;
    --input-border: #5a6b8a;

        --primary: #5b8def;
        --primary-hover: #7aa3f3;
        --primary-text: #06101f;
        --primary-soft: #17264a;

        --secure: #34d399;
        --secure-soft: #0f2e27;
        --warn: #f5b25c;
        --warn-soft: #33240f;
        --error: #ff9b91;
        --error-soft: #3a1714;

        --hero-bg: #050b18;
        --hero-bg-2: #0c1a38;

        --focus: #7aa3f3;
        --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 16px 40px -16px rgb(0 0 0 / .6);
    }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; }
strong { font-weight: 650; }
.muted { color: var(--muted); }

.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Header ---------- */

.hero {
    color: var(--hero-text);
    background:
        radial-gradient(60rem 22rem at 15% -30%, rgb(52 211 153 / .14), transparent 60%),
        radial-gradient(50rem 26rem at 110% 0%, rgb(91 141 239 / .25), transparent 60%),
        linear-gradient(160deg, var(--hero-bg) 0%, var(--hero-bg-2) 100%);
    padding: 0 1rem 6.5rem;
}
.hero__bar {
    max-width: 46rem; margin: 0 auto; padding: 1rem 0;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.hero__badge-short { display: none; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .01em; color: inherit; text-decoration: none; border-radius: 10px; }
.brand:hover .brand__mark { background: rgb(255 255 255 / .14); }
.brand__mark {
    display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 10px;
    background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .14); color: var(--hero-accent);
}
.brand__mark .icon { width: 1.25rem; height: 1.25rem; }
.hero__badge {
    display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px;
    font-size: .8rem; font-weight: 600; color: #6ee7b7;
    background: rgb(52 211 153 / .1); border: 1px solid rgb(52 211 153 / .3);
}
.hero__badge .icon { width: .95rem; height: .95rem; }
.hero__account { display: flex; align-items: center; gap: .75rem; margin: 0; min-width: 0; }
.hero__user { color: var(--hero-muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero__logout {
    display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 8px; cursor: pointer;
    font: inherit; font-size: .9rem; color: var(--hero-text); background: rgb(255 255 255 / .06); border: 1px solid rgb(255 255 255 / .16);
}
.hero__logout:hover { background: rgb(255 255 255 / .12); }
.hero__intro { max-width: 46rem; margin: 0 auto; padding: 2.25rem 0 0; }
.hero__title { font-size: clamp(1.6rem, 4.2vw, 2.25rem); line-height: 1.2; font-weight: 750; letter-spacing: -.015em; }
.hero__text { margin-top: .6rem; color: var(--hero-muted); font-size: 1.05rem; max-width: 36rem; }

/* ---------- Page and cards ---------- */

.page { flex: 1; width: 100%; max-width: 48rem; margin: -4.5rem auto 0; padding: 0 1rem 2rem; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.75rem;
}
.card + .card { margin-top: 1rem; }
.card__head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; }
.card__center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; margin-bottom: 1.5rem; }
.card__title { font-size: 1.3rem; line-height: 1.3; font-weight: 700; }
.card__sub { color: var(--muted); max-width: 30rem; }

.badge {
    display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 12px;
}
.badge .icon { width: 1.4rem; height: 1.4rem; }
.badge--large { width: 4rem; height: 4rem; border-radius: 50%; margin-bottom: .35rem; }
.badge--large .icon { width: 1.9rem; height: 1.9rem; }
.badge--primary { color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgb(29 78 216 / .15); }
.badge--secure { color: var(--secure); background: var(--secure-soft); box-shadow: inset 0 0 0 1px rgb(4 120 87 / .2); }
.badge--warn { color: var(--warn); background: var(--warn-soft); }
.badge--muted { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.badge--pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .badge--pulse { animation: none; } }

/* ---------- Forms ---------- */

.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.field__label { font-weight: 650; font-size: .95rem; padding: 0; }
.field__hint { color: var(--muted); font-size: .85rem; }

input[type="text"], input[type="password"], textarea {
    width: 100%; padding: .7rem .85rem; font: inherit; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--input-border); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
::placeholder { color: var(--muted); opacity: 1; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; font-family: var(--mono); font-size: .95rem; line-height: 1.5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hero :focus-visible { outline-color: var(--hero-accent); }
h2[tabindex="-1"]:focus { outline: none; }

.segmented {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .25rem; padding: .25rem;
    background: var(--surface-2); border: 1px solid var(--input-border); border-radius: var(--radius-sm);
}
.segmented__option { position: relative; cursor: pointer; }
.segmented__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented__option span {
    display: block; padding: .5rem .5rem; text-align: center; border-radius: 7px; font-size: .92rem; font-weight: 600; color: var(--muted);
}
.segmented__option input:checked + span { background: var(--primary); color: var(--primary-text); box-shadow: 0 1px 3px rgb(15 27 45 / .2); }
@media (forced-colors: active) {
    .segmented__option input:checked + span { outline: 2px solid Highlight; outline-offset: -2px; }
    .secret textarea.is-masked { color: Canvas; }
}
.segmented__option input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.segmented--icons span { display: inline-flex; width: 100%; align-items: center; justify-content: center; gap: .45rem; }
.segmented--icons .icon { width: 1.05rem; height: 1.05rem; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.6rem 1rem; text-align: center; cursor: pointer;
    color: var(--muted); background: var(--surface-2); border: 1.5px dashed var(--input-border); border-radius: var(--radius-sm);
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dropzone__icon { color: var(--primary); display: grid; }
.dropzone__icon .icon { width: 1.75rem; height: 1.75rem; }
.dropzone__text { color: var(--text); overflow-wrap: anywhere; }
.dropzone.has-file .dropzone__icon { color: var(--secure); }

.file-card { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.file-card__icon { color: var(--primary); display: grid; flex: none; }
.file-card__name { font-weight: 650; overflow-wrap: anywhere; }
.file-card__size { color: var(--muted); font-size: .88rem; }

.option { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.check { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); flex: none; }
.check__text { display: flex; flex-direction: column; gap: .15rem; }
.check__title { display: inline-flex; align-items: center; gap: .4rem; font-weight: 650; }
.check__title .icon { color: var(--muted); }
.check__hint { color: var(--muted); font-size: .88rem; }

/* ---------- Buttons ---------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.05rem; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
    color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    transition: background .15s, border-color .15s, transform .05s;
}
.button:hover { border-color: var(--muted); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .65; cursor: progress; }
.button--primary { color: var(--primary-text); background: var(--primary); border-color: var(--primary); }
.button--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button--ghost { background: transparent; }
.button--small { padding: .35rem .65rem; font-size: .85rem; font-weight: 600; }
.button--large { padding: .85rem 1.25rem; font-size: 1.02rem; }
.button--block { display: flex; width: 100%; }
.button.is-done { color: var(--secure); border-color: var(--secure); background: var(--secure-soft); }

/* ---------- Results and secrets ---------- */

.copy {
    display: flex; align-items: center; gap: .5rem; padding: .35rem .35rem .35rem .75rem; margin-bottom: 1.25rem;
    background: var(--surface-2); border: 1px solid var(--input-border); border-radius: var(--radius-sm);
}
.copy:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.copy__icon { color: var(--secure); display: grid; }
.copy input { flex: 1; min-width: 0; padding: .45rem 0; border: 0; background: transparent; font-family: var(--mono); font-size: .9rem; box-shadow: none !important; }
.copy--compact { margin-bottom: 0; background: var(--surface); }

.facts { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--muted); font-size: .92rem; }
.facts li { display: inline-flex; align-items: center; gap: .4rem; }
.facts .icon { color: var(--secure); }
.facts--center { justify-content: center; }

.passphrase-box { padding: 1rem; margin-bottom: 1.25rem; border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid rgb(180 83 9 / .25); }
.passphrase-box__title { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--warn); }
.passphrase-box__text { font-size: .9rem; margin: .25rem 0 .75rem; }

.secret { margin-bottom: 1.25rem; }
.secret textarea { font-size: 1.05rem; background: var(--surface-2); }
.secret textarea.is-masked { color: transparent; text-shadow: 0 0 9px var(--text); user-select: none; }
#toggle-secret[data-masked="true"] .when-shown, #toggle-secret:not([data-masked="true"]) .when-masked { display: none; }
.secret__actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }

.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .95rem; margin-bottom: 1.25rem; }
.alert .icon { margin-top: .15rem; }
.alert--error { background: var(--error-soft); color: var(--error); }
.alert--secure { background: var(--secure-soft); color: var(--secure); margin-bottom: 0; }
.alert--secure span { color: var(--text); }
.alert--secure strong { color: var(--secure); }
.alert--warn { background: var(--warn-soft); color: var(--warn); margin-bottom: 0; }
.alert--warn span { color: var(--text); }
.alert--warn strong { color: var(--warn); }
.file-card + .button { margin-bottom: 1rem; }

.note { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .85rem; }
.note .icon { color: var(--secure); }
.note--center { justify-content: center; margin-top: .85rem; }
.note--warn { margin-top: .75rem; text-align: left; align-items: flex-start; }
.note--warn .icon { color: var(--warn); margin-top: .15rem; }

.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ---------- Trust row and footer ---------- */

.trust {
    list-style: none; margin: 2rem 0 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.trust__item { display: flex; gap: .7rem; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.trust__item strong { display: block; color: var(--text); font-size: .92rem; margin-bottom: .1rem; }
.trust__icon { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 9px; color: var(--secure); background: var(--secure-soft); }
.trust__icon .icon { width: 1.05rem; height: 1.05rem; }

.footer {
    display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap;
    padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: .85rem; text-align: center;
}
.footer .icon { color: var(--secure); }

@media (max-width: 40rem) {
    .hero { padding-bottom: 5.5rem; }
    .hero__intro { padding-top: 1.5rem; }
    .hero__user { display: none; }
    .hero__badge-long { display: none; }
    .hero__badge-short { display: inline; }
    .page { margin-top: -3.75rem; }
    .card { padding: 1.25rem; }
    .card__head { flex-direction: column; gap: .75rem; }
    .trust { grid-template-columns: 1fr; }
    .copy { flex-wrap: wrap; padding: .5rem; }
    .copy__icon { display: none; }
    .copy input { flex-basis: 100%; padding: .3rem .25rem; }
    .copy .button { width: 100%; }
}

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
