:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-elevated: rgba(255, 255, 255, 0.98);
    --border: #d8dee9;
    --text: #1f2937;
    --muted: #5f6b7a;
    --accent: #2368e8;
    --accent-dark: #1851bc;
    --accent-warm: #f58220;
    --code-bg: #edf2f7;
    --surface-soft: #f8fafc;
    --surface-soft-alt: #eff6ff;
    --surface-soft-alt-strong: #dbeafe;
    --line-strong: rgba(0, 35, 63, 0.18);
    --line-soft: rgba(0, 35, 63, 0.14);
    --theme-chip-bg: rgba(21, 204, 204, 0.08);
    --theme-chip-fg: var(--accent-dark);
    --flag-outline: rgba(15, 23, 42, 0.18);
    --shadow-soft: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-medium: 0 18px 36px rgba(15, 23, 42, 0.16);
    --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.24);
    --shadow-float: 0 12px 30px rgba(15, 23, 42, 0.22);
    --overlay: rgba(15, 23, 42, 0.46);
    --description-text: #43546a;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #b91c1c;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --success-text: #166534;
    --badge-bg: #eff6ff;
    --badge-bg-hover: #dbeafe;
    --badge-border: #93c5fd;
    --button-text: #ffffff;
    --download-text-measure: 50rem;
}

:root[data-dh-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1220;
    --panel: #121c2b;
    --panel-elevated: rgba(18, 28, 43, 0.98);
    --border: #28364a;
    --text: #e7edf7;
    --muted: #9fb0c6;
    --accent: #4e95ff;
    --accent-dark: #7ab6ff;
    --accent-warm: #f39a4a;
    --code-bg: #0f1827;
    --surface-soft: #162232;
    --surface-soft-alt: #152846;
    --surface-soft-alt-strong: #1d3560;
    --line-strong: rgba(148, 163, 184, 0.4);
    --line-soft: rgba(148, 163, 184, 0.24);
    --theme-chip-bg: rgba(21, 204, 204, 0.14);
    --theme-chip-fg: #8de7ef;
    --flag-outline: rgba(226, 232, 240, 0.18);
    --shadow-soft: 0 8px 20px rgba(2, 8, 23, 0.3);
    --shadow-medium: 0 18px 40px rgba(2, 8, 23, 0.38);
    --shadow-strong: 0 24px 60px rgba(2, 8, 23, 0.5);
    --shadow-float: 0 14px 30px rgba(2, 8, 23, 0.42);
    --overlay: rgba(2, 8, 23, 0.72);
    --description-text: #c3d1e4;
    --danger-bg: #34131b;
    --danger-border: #7f1d1d;
    --danger-text: #fecaca;
    --success-bg: #10281f;
    --success-border: #166534;
    --success-text: #bbf7d0;
    --badge-bg: #152846;
    --badge-bg-hover: #1d3560;
    --badge-border: #3b82f6;
    --button-text: #f8fbff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

body.embed-mode {
    background: transparent;
}

.page {
    position: relative;
    width: min(920px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0;
}

body.embed-mode .page {
    width: 100%;
    padding: 0;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo-container img {
    max-width: 112px;
    width: 100%;
    height: auto;
    display: inline-block;
}

.page-tools {
    position: absolute;
    top: 34px;
    right: 0;
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    z-index: 30;
}

.language-switcher {
    position: relative;
    top: auto;
    right: auto;
    margin: 0;
    z-index: 30;
}

.language-switcher summary {
    list-style: none;
}

.language-switcher summary::-webkit-details-marker {
    display: none;
}

.language-switcher__active,
.language-switcher__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    box-shadow: var(--shadow-soft);
}

.language-switcher__active {
    width: 38px;
    cursor: pointer;
    border-color: var(--line-strong);
    background: var(--theme-chip-bg);
    color: var(--theme-chip-fg);
    box-shadow: inset 0 -2px 0 var(--accent-warm);
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-height: 32px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--theme-chip-bg);
    color: var(--theme-chip-fg);
    box-shadow: inset 0 -2px 0 var(--accent-warm), var(--shadow-soft);
    cursor: pointer;
}

.language-switcher__active:hover,
.language-switcher__active:focus,
.theme-switcher:hover,
.theme-switcher:focus,
.language-switcher__option:hover,
.language-switcher__option:focus {
    border-color: var(--accent);
    outline: none;
}

.theme-switcher__icon {
    display: block;
    position: relative;
    width: 15px;
    height: 15px;
}

.theme-switcher__icon::before,
.theme-switcher__icon::after {
    content: "";
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    transition: opacity 160ms ease, transform 160ms ease;
}

.theme-switcher__icon::before {
    border-radius: 50%;
    border: 2px solid currentColor;
    box-shadow:
        0 -8px 0 -6px currentColor,
        0 8px 0 -6px currentColor,
        8px 0 0 -6px currentColor,
        -8px 0 0 -6px currentColor,
        5px 5px 0 -6px currentColor,
        -5px 5px 0 -6px currentColor,
        5px -5px 0 -6px currentColor,
        -5px -5px 0 -6px currentColor;
    opacity: 0;
    transform: scale(0.78);
}

.theme-switcher__icon::after {
    inset: 1px 0 0 1px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-top-color: transparent;
    transform: rotate(24deg);
    opacity: 1;
}

html[data-dh-theme="dark"] .theme-switcher__icon::before {
    opacity: 1;
    transform: scale(1);
}

html[data-dh-theme="dark"] .theme-switcher__icon::after {
    opacity: 0;
    transform: rotate(24deg) scale(0.72);
}

.language-switcher__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    min-width: 172px;
    padding: 6px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel-elevated);
    box-shadow: var(--shadow-medium), inset 0 2px 0 var(--accent-warm);
}

.language-switcher:not([open]) .language-switcher__menu {
    display: none;
}

.language-switcher__option {
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: var(--text);
    font-size: 13px;
    line-height: 1.2;
}

.language-switcher__option:hover,
.language-switcher__option:focus {
    background: var(--surface-soft-alt);
    color: var(--accent-dark);
}

.language-switcher__label {
    white-space: nowrap;
}

.language-flag {
    display: block;
    width: 24px;
    height: 18px;
    overflow: hidden;
    border-radius: 2px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    box-shadow: inset 0 0 0 1px var(--flag-outline);
}

.language-flag--si {
    background-image: url("flags/si.svg");
}

.language-flag--gb {
    background-image: url("flags/gb.svg");
}

.language-flag--de {
    background-image: url("flags/de.svg");
}

.language-flag--it {
    background-image: url("flags/it.svg");
}

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

.header {
    margin-bottom: 18px;
    text-align: center;
}

h1 {
    margin: 0 0 6px;
    font-size: clamp(24px, 4vw, 34px);
    letter-spacing: 0;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.downloads {
    display: grid;
    gap: 14px;
}

body.embed-mode .downloads {
    gap: 16px;
}

body.embed-mode .download {
    background: var(--panel);
}

body.embed-mode .download:last-child {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

body.embed-mode .download-description,
body.embed-mode .details,
body.embed-mode .download-notes,
body.embed-mode .download-variant-docs {
    background: transparent;
}

.download {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.download:last-child {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.download + .download {
    position: relative;
    margin-top: 16px;
}

.download + .download::before {
    content: "";
    position: absolute;
    top: -16px;
    right: 10px;
    left: 10px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.login-panel {
    width: min(420px, 100%);
    margin: 0 auto;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.login-form input {
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
}

.message-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: 6px;
    color: var(--danger-text);
    font-size: 14px;
}

.message-success {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: 6px;
    color: var(--success-text);
    font-size: 14px;
}

.small-note {
    margin: 2px 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.forgot-panel {
    display: none;
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.forgot-panel.is-visible {
    display: block;
}

.login-form + .hash-link {
    margin-top: 12px;
}

.download-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.download h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0;
}

.download-title {
    min-width: 0;
}

.download-file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.download-variant-picker {
    display: grid;
    gap: 5px;
    width: min(100%, 320px);
    margin-top: 12px;
}

.download-variant-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.download-variant-select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
}

.description {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.download-description {
    width: min(100%, var(--download-text-measure));
    max-width: var(--download-text-measure);
    padding: 10px 12px;
    background: var(--surface-soft);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    color: var(--description-text);
    font-size: 1rem;
    line-height: 1.65;
    overflow-wrap: break-word;
    text-wrap: pretty;
    white-space: pre-line;
}

.download-notes {
    width: min(100%, var(--download-text-measure));
    max-width: var(--download-text-measure);
    margin-top: -1px;
    padding: 9px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.download-notes-body {
    color: var(--muted);
    font-size: inherit;
    overflow-wrap: break-word;
    text-wrap: pretty;
    white-space: pre-line;
}

.download-notes-body * {
    font-size: inherit;
    line-height: inherit;
}

.download-notes-body a {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

.download-variant-docs {
    width: min(100%, var(--download-text-measure));
    max-width: var(--download-text-measure);
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.download-variant-docs-title {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.download-variant-doc-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.download-variant-doc-list li + li {
    margin-top: 4px;
}

.download-variant-doc-list a {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 18px;
    margin-left: 6px;
    padding: 1px 5px;
    border: 1px solid var(--badge-border);
    border-bottom-color: var(--accent-warm);
    border-radius: 999px;
    background: var(--badge-bg);
    color: var(--accent-dark);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
}

.ai-badge:hover,
.ai-badge:focus {
    background: var(--badge-bg-hover);
    text-decoration: none;
}

.button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 14px;
    background: var(--accent);
    color: var(--button-text);
    border: 2px solid var(--accent);
    border-bottom-color: var(--accent-warm);
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: inset 0 -2px 0 var(--accent-warm);
    text-transform: uppercase;
}

.button:hover,
.button:focus {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    border-bottom-color: var(--accent-warm);
}

.details {
    display: grid;
    grid-template-columns: minmax(90px, 0.85fr) minmax(135px, 1.25fr) minmax(80px, 0.75fr) minmax(110px, 1fr) minmax(120px, 1fr) minmax(100px, 0.9fr);
    gap: 0;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.details-with-notes {
    border-radius: 6px 6px 0 0;
}

.detail {
    min-width: 0;
    padding: 10px;
    border-right: 1px solid var(--border);
}

.detail:last-child {
    border-right: 0;
}

.detail-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-value {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow-wrap: anywhere;
}

.file-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.file-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hash-link {
    flex: 0 0 auto;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--accent-dark);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.hash-link:hover,
.hash-link:focus {
    text-decoration: underline;
    outline: none;
}

.logout-panel {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.hash-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px;
    background: var(--code-bg);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    text-align: left;
    overflow-wrap: anywhere;
}

.hash-copy:hover,
.hash-copy:focus {
    border-color: var(--accent);
    outline: none;
}

.hash-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

.copy-icon {
    flex: 0 0 auto;
    color: var(--accent);
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1;
}

.hash-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.hash-help {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.hash-help:hover,
.hash-help:focus {
    text-decoration: underline;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 18px;
    background: var(--overlay);
    z-index: 10;
}

.modal-backdrop.is-open {
    display: grid;
}

.modal {
    width: min(620px, 100%);
    max-height: min(86vh, 720px);
    overflow: auto;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-strong);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.modal h2 {
    margin: 0;
    font-size: 21px;
}

.modal-subtitle {
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
    border-color: var(--accent);
    outline: none;
}

.instructions {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style-position: inside;
    color: var(--muted);
    font-size: 15px;
}

.command {
    display: block;
    margin-top: 4px;
    padding: 8px;
    background: var(--code-bg);
    border-radius: 6px;
    color: var(--text);
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.empty {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
}

.upload-shortcut {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: var(--button-text);
    border: 2px solid var(--accent);
    border-bottom-color: var(--accent-warm);
    border-radius: 50%;
    box-shadow: var(--shadow-float), inset 0 -2px 0 var(--accent-warm);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    z-index: 8;
}

.upload-shortcut:hover,
.upload-shortcut:focus {
    background: var(--accent-dark);
    outline: none;
}

.footer {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-top: clamp(120px, 22vh, 260px);
    margin-bottom: 120px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.hash-reminder {
    margin: -1px 0 0;
    padding: 12px 16px 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-top: 0;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    text-align: left;
}

body.embed-mode .hash-reminder {
    margin-bottom: 0;
}

.footer a,
.download-notes a,
.download-variant-docs a {
    color: var(--accent-dark);
    text-decoration: none;
}

.footer a:hover,
.footer a:focus,
.download-notes a:hover,
.download-notes a:focus,
.download-variant-docs a:hover,
.download-variant-docs a:focus {
    text-decoration: underline;
}

.cookie-banner {
    position: fixed;
    right: 16px;
    bottom: 70px;
    left: 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(10px);
    color: var(--muted);
    font-size: 13px;
    z-index: 20;
}

.cookie-banner span {
    line-height: 1.55;
}

.cookie-banner .button {
    flex-shrink: 0;
    min-width: 132px;
}

.cookie-banner.is-visible {
    display: flex;
}

@media (max-width: 760px) {
    .page {
        width: min(100% - 20px, 920px);
        padding: 18px 0 72px;
    }

    body.embed-mode .page {
        width: 100%;
        padding: 0;
    }

    .logo-container img {
        max-width: 92px;
    }

    .page-tools {
        position: static;
        justify-content: center;
        width: 100%;
        margin: -4px auto 18px;
        gap: 8px;
    }

    .language-switcher {
        position: relative;
        width: auto;
    }

    .language-switcher__menu {
        right: auto;
        left: 50%;
        width: max-content;
        max-width: calc(100vw - 28px);
        transform: translateX(-50%);
        z-index: 60;
    }

    .download-header {
        display: grid;
        gap: 10px;
    }

    .download-variant-picker {
        width: 100%;
    }

    .download-description {
        padding: 9px 10px;
    }

    .button {
        width: 100%;
    }

    .details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-value {
        white-space: normal;
    }

    .file-name-text {
        white-space: normal;
    }

    .detail:nth-child(even) {
        border-right: 0;
    }

    .detail:nth-child(n+3) {
        border-top: 1px solid var(--border);
    }

    .footer {
        margin-top: 48px;
        margin-bottom: 72px;
    }

}

@media (max-width: 460px) {
    .details {
        grid-template-columns: 1fr;
    }

    .cookie-banner {
        right: 10px;
        bottom: 64px;
        left: 10px;
        width: auto;
    }

    .cookie-banner.is-visible {
        display: grid;
    }

    .detail,
    .detail:nth-child(even) {
        border-right: 0;
        border-top: 1px solid var(--border);
    }

    .detail:first-child {
        border-top: 0;
    }
}
