:root {
    color-scheme: light;
    --ink: #162337;
    --muted: #66758a;
    --line: #dce3ec;
    --navy: #173b6c;
    --navy-dark: #102c52;
    --blue-wash: #eef5ff;
    --green: #17724c;
    --green-wash: #edf9f3;
    --red: #a52727;
    --red-wash: #fff1f1;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 12%, rgba(70, 131, 204, .14), transparent 28rem),
        linear-gradient(145deg, #f4f7fb, #eaf0f7);
}

.page-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 32px 18px;
}

.card {
    width: min(100%, 720px);
    min-width: 0;
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 22px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 24px 70px rgba(23, 48, 82, .13);
}

.language-switch { display: flex; justify-content: flex-end; gap: 14px; margin: -20px 0 20px; font-size: .82rem; }
.language-switch a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; }
.language-switch img { display: block; width: 18px; height: 12px; object-fit: cover; border: 1px solid var(--line); }
.language-switch a:hover, .language-switch a:focus-visible, .language-switch a[aria-current="page"] { color: var(--navy); text-decoration: underline; }
.language-switch a[aria-current="page"] { font-weight: 700; }

.card__header { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 30px; }
.card__title { flex: 1; min-width: 0; }
.brand-logo { flex: 0 0 96px; width: 96px; height: auto; max-height: 60px; object-fit: contain; object-position: right top; }
.lock-mark { display: grid; place-items: center; flex: 0 0 50px; height: 50px; border-radius: 14px; background: var(--blue-wash); font-size: 24px; }
h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 2.35rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.subtitle { margin: 9px 0 0; color: var(--muted); line-height: 1.55; }

.operation-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: 0 0 18px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f4f7fa;
}
.operation-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.operation-switch label { cursor: pointer; }
.operation-switch input { position: absolute; opacity: 0; }
.operation-switch span { display: block; padding: 11px 14px; border-radius: 8px; color: var(--muted); text-align: center; font-weight: 750; transition: .16s ease; }
.operation-switch input:checked + span { color: var(--navy); background: white; box-shadow: 0 2px 8px rgba(23, 59, 108, .11); }
.operation-switch input:focus-visible + span { outline: 3px solid rgba(63, 120, 187, .28); }

.drop-zone {
    min-height: 275px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    border: 2px dashed #aab9ca;
    border-radius: 17px;
    background: #fafcff;
    cursor: pointer;
    transition: .18s ease;
}
.drop-zone:hover, .drop-zone:focus-within, .drop-zone.is-dragging { border-color: #3f78bb; background: var(--blue-wash); transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone__icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 4px; border-radius: 50%; background: #dfeeff; color: var(--navy); font-size: 26px; font-weight: 700; }
.drop-zone strong { font-size: 1.08rem; }
.drop-zone > span:not(.drop-zone__icon):not(.file-picker) { color: var(--muted); font-size: .91rem; }
.file-picker { margin: 8px 0 2px; padding: 10px 18px; border: 1px solid #b9c8d8; border-radius: 9px; background: white; color: var(--navy); font-weight: 750; box-shadow: 0 2px 5px rgba(23, 59, 108, .06); }
.file-name.has-file { color: var(--navy) !important; font-weight: 700; overflow-wrap: anywhere; }

.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; padding: 13px 22px; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; transition: .16s ease; }
.button--primary { width: 100%; margin-top: 18px; color: white; background: var(--navy); box-shadow: 0 8px 20px rgba(23, 59, 108, .18); }
.button--primary:hover { background: var(--navy-dark); transform: translateY(-1px); }
.button:disabled { opacity: .65; cursor: wait; transform: none; }
.button--success { margin-top: 18px; color: white; background: var(--green); }
.button--success:hover { filter: brightness(.92); }

.alert { display: flex; gap: 15px; margin-bottom: 22px; padding: 17px; border-radius: 13px; }
.alert--error { color: var(--red); background: var(--red-wash); border: 1px solid #f0cccc; }
.alert span { display: grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; color: white; background: var(--red); font-weight: 800; }
.alert p { margin: 2px 0 0; line-height: 1.45; }
.privacy-note { margin: 19px 4px 0; color: var(--muted); text-align: center; font-size: .78rem; line-height: 1.5; }
.public-key-link { margin: 14px 0 0; text-align: center; font-size: .84rem; }
.public-key-link a { color: var(--navy); font-weight: 700; text-underline-offset: 3px; }
.public-key-link a:hover, .public-key-link a:focus-visible { color: var(--navy-dark); }
.site-footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .75rem; line-height: 1.6; }
.site-footer a { color: var(--navy); font-weight: 700; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; }

@media (max-width: 540px) {
    .page-shell { padding: 15px; align-items: start; }
    .card { padding: 24px 18px; border-radius: 17px; }
    .language-switch { margin: 0 0 18px; }
    .card__header { gap: 10px; }
    .lock-mark { flex-basis: 42px; height: 42px; font-size: 20px; }
    .brand-logo { flex-basis: 64px; width: 64px; max-height: 40px; }
    h1 { font-size: 1.5rem; }
    .drop-zone { min-height: 240px; padding: 24px 16px; }
    .operation-switch span { padding-inline: 7px; }
    .button--success { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

.button { overflow-wrap: anywhere; }
