:root {
    --bg: #f5f7fa;
    --surface: #fff;
    --surface-alt: #fafbfc;
    --hover-bg: #f5f7fa;
    --text: #1a1a1a;
    --text-sec: #586069;
    --text-muted: #8b929a;
    --border: #e1e4e8;
    --border-light: #d0d5dd;
    --accent: #1e3c72;
    --accent-hover: #162d56;
    --danger: #b91c1c;
    --success: #15803d;
    --gate-overlay: rgba(30,60,114,.94);
    --shadow: 0 20px 40px rgba(0,0,0,.3);
}

[data-bs-theme="dark"] {
        --bg: #0d1117;
        --surface: #161b22;
        --surface-alt: #1c2128;
        --hover-bg: #1c2128;
        --text: #e6edf3;
        --text-sec: #8b949e;
        --text-muted: #6e7681;
        --border: #30363d;
        --border-light: #21262d;
        --accent: #58a6ff;
        --accent-hover: #1f6feb;
        --danger: #f85149;
        --success: #3fb950;
        --gate-overlay: rgba(13,17,23,.96);
        --shadow: 0 20px 40px rgba(0,0,0,.6);
    }
}

/* ── Theme text toggle ── */
.theme-text {
    background:none; border:none; cursor:pointer; margin-left:8px; flex-shrink:0;
    font-size:12px; font-weight:600; font-family:inherit;
    color:var(--text-sec); padding:4px 8px; border-radius:4px;
    transition:color .15s;
}
.theme-text:hover { color:var(--accent); }
.theme-text:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6;
    transition: background .3s, color .3s;
}
.container { max-width:1000px; margin:0 auto; padding:0 20px; }

/* ── Navbar ── */
.navbar {
    background: var(--surface); border-bottom:1px solid var(--border); padding:0 20px;
    position:sticky; top:0; z-index:100;
}
.navbar-inner {
    max-width:1200px; margin:0 auto; display:flex;
    justify-content:space-between; align-items:center; height:64px;
}
.navbar-brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--text); }
.navbar-brand-icon { width:36px; height:36px; background:var(--accent); border-radius:6px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:16px; font-weight:600; }
.navbar-brand-text { font-size:18px; font-weight:600; color:var(--accent); }
.navbar-links { display:flex; gap:4px; flex-wrap:wrap; }
.navbar-link { padding:8px 16px; border-radius:6px; text-decoration:none; color:var(--text-sec); font-size:14px; font-weight:500; transition:all .2s; white-space:nowrap; }
.navbar-link:hover { background:var(--hover-bg); color:var(--text); }
.navbar-link.active { background:var(--accent); color:#fff; }

.lang-dropdown {
    margin-right:8px;
}
.lang-dropdown select {
    appearance:none; -webkit-appearance:none;
    padding:4px 22px 4px 10px; border:1px solid var(--border); border-radius:6px;
    background:var(--surface); color:var(--text-sec); font-size:12px; font-weight:600;
    font-family:inherit; cursor:pointer; outline:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%23586069'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 6px center; background-size:8px;
    transition:border-color .15s;
}
.lang-dropdown select:hover { border-color:var(--accent); }
.lang-dropdown select:focus { border-color:var(--accent); box-shadow:0 0 0 2px rgba(88,166,255,.15); }
[data-bs-theme="dark"] .lang-dropdown select {
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
}

/* ── Page Header (white default) ── */
.page-header {
    background: var(--surface); padding:48px 0; border-bottom:1px solid var(--border);
    margin-bottom:40px; text-align:center;
}
.page-header h1 { font-size:32px; font-weight:700; color:var(--text); margin-bottom:8px; }
.page-header .subtitle { color:var(--text-sec); font-size:16px; }

/* ── Primary Button ── */
.btn {
    display:inline-block; padding:12px 24px; background:var(--accent); color:#fff;
    text-decoration:none; border-radius:6px; font-size:14px; font-weight:600;
    transition:all .2s; border:none; cursor:pointer;
}
.btn:hover { background:var(--accent-hover); }
.btn-secondary { background:var(--text-sec); margin-left:8px; }
.btn-secondary:hover { background:var(--text-muted); }

/* ── Section Card ── */
.section {
    background: var(--surface); padding:40px; border-radius:8px; border:1px solid var(--border); margin-bottom:24px;
}
.section h2 {
    font-size:22px; font-weight:700; color:var(--text); margin-bottom:24px;
    padding-bottom:16px; border-bottom:2px solid var(--border);
}

/* ── Footer ── */
footer {
    background: var(--surface); border-top:1px solid var(--border); text-align:center;
    padding:32px 0; color:var(--text-sec); font-size:14px; margin-top:40px;
}

/* ════════════════════════════════════════════
   DOWNLOAD PAGE
   ════════════════════════════════════════════ */

.dl-table { width:100%; border-collapse:collapse; }
.dl-table th {
    text-align:left; font-size:11px; font-weight:600; color:var(--text-muted);
    text-transform:uppercase; letter-spacing:.5px;
    padding:0 12px 10px 12px; border-bottom:1px solid var(--border);
}
.dl-table td { padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.dl-table tr:last-child td { border-bottom:none; }
.dl-table tr:hover td { background:var(--surface-alt); }

.dl-file { display:flex; align-items:center; gap:10px; }
.dl-file .icon {
    flex-shrink:0; width:36px; height:36px; border-radius:6px;
    display:flex; align-items:center; justify-content:center;
    font-weight:700; font-size:10px; letter-spacing:.3px;
}
.dl-file .name { font-size:14px; font-weight:500; color:var(--text); word-break:break-all; }
.dl-cell-size, .dl-cell-date { font-size:13px; color:var(--text-sec); white-space:nowrap; }
.dl-cell-action { text-align:right; }
.dl-cell-action .dl-btn {
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 14px; background:var(--accent); color:#fff;
    text-decoration:none; border-radius:5px; font-size:12px; font-weight:600;
    transition:all .15s; white-space:nowrap;
}
.dl-cell-action .dl-btn:hover { background:var(--accent-hover); }
.dl-empty { text-align:center; padding:48px 20px; color:var(--text-muted); font-size:14px; }
.dl-empty .empty-icon { font-size:40px; margin-bottom:12px; opacity:.4; }

/* Gate */
.dl-gate {
    position:fixed; inset:0; background:var(--gate-overlay);
    display:flex; align-items:center; justify-content:center; z-index:1000; padding:20px;
}
.dl-gate-card {
    background: var(--surface); padding:32px; border-radius:10px;
    max-width:380px; width:100%; box-shadow:var(--shadow);
}
.dl-gate-card h2 { font-size:20px; font-weight:700; color:var(--text); margin-bottom:6px; }
.dl-gate-card p { font-size:14px; color:var(--text-sec); margin-bottom:20px; }
.dl-gate-input {
    width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:6px;
    font-size:14px; font-family:inherit; margin-bottom:12px; background:var(--surface);
    color:var(--text);
}
.dl-gate-input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(88,166,255,.15); }
.dl-gate-btn {
    width:100%; padding:10px 16px; background:var(--accent); color:#fff;
    border:none; border-radius:6px; font-size:14px; font-weight:600; cursor:pointer; font-family:inherit;
}
.dl-gate-btn:hover { background:var(--accent-hover); }
.dl-error { color:var(--danger); font-size:13px; margin-bottom:8px; min-height:18px; }
.dl-gate-hint { margin-top:16px; padding-top:16px; border-top:1px solid var(--border); font-size:12px; color:var(--text-muted); text-align:center; }

/* Upload bar */
.upload-bar {
    display:flex; gap:10px; align-items:center; padding:12px 20px;
    background: var(--surface-alt); border-bottom:1px solid var(--border);
}
.upload-bar input[type=file] {
    flex:1; font-size:13px; font-family:inherit; color:var(--text-sec);
}
.upload-bar input[type=file]::file-selector-button {
    padding:6px 14px; border:1px solid var(--border-light); border-radius:5px;
    background: var(--surface); color:var(--text); font-weight:500; font-size:12px;
    cursor:pointer; font-family:inherit; transition:all .15s; margin-right:8px;
}
.upload-bar input[type=file]::file-selector-button:hover { background:var(--hover-bg); border-color:var(--accent); }
.uf-submit {
    padding:6px 18px; background:var(--accent); color:#fff;
    border:none; border-radius:5px; font-size:12px; font-weight:600;
    cursor:pointer; font-family:inherit; white-space:nowrap;
}
.uf-submit:hover { background:var(--accent-hover); }
.uf-submit:disabled { opacity:.5; cursor:not-allowed; }
.uf-msg { font-size:12px; font-weight:500; min-width:0; }
.uf-msg.success { color:var(--success); }
.uf-msg.error { color:var(--danger); }

/* Section compact (downloads page) */
.section-header {
    padding:16px 20px; border-bottom:1px solid var(--border);
    display:flex; align-items:center; justify-content:space-between;
}
.section-header h2 { font-size:15px; font-weight:600; color:var(--text); margin:0; padding:0; border:none; }
.section-body { padding:4px 0; }
.section.compact { overflow:hidden; }
.section.compact, .section.compact .section-body { border-radius:8px; }

/* ── Responsive global ── */
@media (max-width:768px) {
    .page-header { padding:28px 0; }
    .page-header h1 { font-size:28px; }

    .dl-table, .dl-table thead, .dl-table tbody, .dl-table tr, .dl-table td, .dl-table th { display:block; }
    .dl-table thead { display:none; }
    .dl-table tr { padding:12px 16px; position:relative; }
    .dl-table td { padding:2px 0; border:none; }
    .dl-cell-size, .dl-cell-date { display:inline; font-size:12px; }
    .dl-cell-action { position:absolute; top:12px; right:16px; }
    .dl-cell-action .dl-btn { padding:4px 12px; font-size:11px; }
    .dl-file .icon { width:28px; height:28px; font-size:8px; }
    .dl-file .name { font-size:13px; }
    .upload-bar { flex-wrap:wrap; }
    .upload-bar input[type=file] { width:100%; }
}
