:root {
    color-scheme: light dark;
    --bg: #070b24;
    --panel: #10183d;
    --surface: rgba(13, 20, 51, .82);
    --line: rgba(174, 185, 216, .2);
    --line-strong: rgba(174, 185, 216, .36);
    --text: #f7f9ff;
    --muted: #adb9d8;
    --accent: #8fe8ff;
    --blue: #316bff;
    --green: #73e7bd;
    --red: #ff9cab;
    --button-text: #04102c;
    --shadow: 0 18px 55px rgba(0, 0, 0, .28);
    --header-height: 70px;
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #e9eef8;
    --panel: #f7f9fd;
    --surface: rgba(244, 247, 252, .88);
    --line: rgba(18, 40, 91, .16);
    --line-strong: rgba(18, 40, 91, .3);
    --text: #07102c;
    --muted: #4b5878;
    --accent: #006c80;
    --blue: #145cff;
    --green: #08785c;
    --red: #a2223b;
    --button-text: #fff;
    --shadow: 0 18px 55px rgba(23, 42, 84, .15);
}

@media (prefers-color-scheme: light) {
    html[data-theme="system"] {
        color-scheme: light;
        --bg: #e9eef8;
        --panel: #f7f9fd;
        --surface: rgba(244, 247, 252, .88);
        --line: rgba(18, 40, 91, .16);
        --line-strong: rgba(18, 40, 91, .3);
        --text: #07102c;
        --muted: #4b5878;
        --accent: #006c80;
        --blue: #145cff;
        --green: #08785c;
        --red: #a2223b;
        --button-text: #fff;
        --shadow: 0 18px 55px rgba(23, 42, 84, .15);
    }
}

body {
    color: var(--text);
    background: var(--bg);
    transition: background .25s, color .25s;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 84% 4%, color-mix(in srgb, var(--blue) 18%, transparent), transparent 34rem), linear-gradient(135deg, transparent 0 48%, color-mix(in srgb, var(--line) 30%, transparent) 48% 48.1%, transparent 48.1%);
    pointer-events: none;
}

.skip-link {
    position: fixed;
    top: -5rem;
    left: 1rem;
    z-index: 200;
    padding: .65rem 1rem;
    color: var(--button-text);
    background: var(--accent);
}

.skip-link:focus {
    top: 1rem;
}

.floating-header {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 100;
    width: min(1220px, calc(100% - 2rem));
    height: var(--header-height);
    margin: 0;
    padding: .55rem .65rem .55rem 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(140%);
}

.brand {
    display: flex;
    align-items: center;
    align-self: stretch;
    flex: 0 0 224px;
    padding-right: 10px;
}

.brand img {
    display: block;
    width: 224px;
    height: 40px;
    margin: 0;
    object-fit: contain;
    object-position: left center;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    font-size: .78rem;
}

.language {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.language a {
    color: var(--muted);
    text-decoration: none;
}

.language a.active {
    color: var(--text);
    font-weight: 800;
}

.theme-control {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.theme-control button {
    min-width: 27px;
    min-height: 27px;
    height: 27px;
    padding: 0 .5rem;
    border: 0;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: .7rem;
}

.theme-control button.active {
    color: var(--text);
    background: var(--line);
}

.header-cta {
    display: none;
}

main {
    margin-top: 110px;
    padding-top: 5rem;
}

.upload,
.result,
.checking > div {
    background: var(--surface);
    border-color: var(--line);
}

.file-field > span:first-child { color:var(--muted); }
.file-control { position:relative; display:flex; align-items:center; gap:.8rem; min-height:58px; padding:.75rem; overflow:hidden; border:1px dashed var(--accent); border-radius:10px; color:var(--text); background:var(--bg); }
.file-control:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
.file-button { flex:0 0 auto; padding:.45rem .7rem; border-radius:5px; color:var(--text); background:var(--line); font-size:.86rem; }
.file-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.file-control input[type="file"] { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.form-message { padding:.8rem 1rem; border:1px solid color-mix(in srgb,var(--red) 55%,transparent); border-radius:8px; color:var(--red); background:color-mix(in srgb,var(--red) 8%,transparent); font-weight:700; }
.form-message[hidden] { display:none; }
[aria-invalid="true"] { outline:2px solid var(--red); outline-offset:3px; }

button[type="submit"] {
    color: #fff;
    background: var(--blue);
}
button[type="submit"]:disabled { cursor:wait; opacity:.72; }

.checks span {
    color: var(--accent);
    background: color-mix(in srgb, var(--blue) 20%, var(--panel));
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1220px, calc(100% - 2rem));
    margin-inline: auto;
    padding: 2.5rem 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
    text-align: left;
}

.site-footer p {
    margin: 0;
}

.site-footer div {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text);
}

@media (max-width: 600px) {
    .floating-header {
        top: 8px;
        width: calc(100% - 1rem);
        height: 64px;
        padding-left: 20px;
        border-radius: 15px;
    }

    .brand {
        flex-basis: 190px;
    }

    .brand img {
        width: 190px;
        height: 34px;
    }

    .header-tools {
        gap: .35rem;
    }

    .theme-control button:first-child {
        display: none;
    }

    main {
        margin-top: 84px;
        padding-top: 3rem;
    }

    .site-footer {
        align-items: flex-start;
        gap: 1rem;
        flex-direction: column;
    }
}

@media (max-width: 440px) {
    .brand {
        flex: 0 0 42px;
        width: 42px;
        padding: 0;
        overflow: hidden;
    }

    .brand img {
        width: 190px;
        max-width: none;
        object-fit: contain;
        object-position: left center;
    }
}

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