/* ── Dark theme (default) ── */
:root,
[data-theme="dark"] {
    --bg: #0d0f14;
    --surface: #13161e;
    --surface2: #1a1e28;
    --border: #252a38;
    --accent: #e8b84b;
    --accent2: #5b8cff;
    --text: #d4d8e8;
    --text-strong: #ffffff;
    --muted: #5a607a;
    --green: #4caf78;
    --missing-bg: #2a2030;
    --missing-hover: #2f2238;
    --missing-text: #6a5070;
    --star-opacity: 1;
}

/* ── Light theme ── */
[data-theme="light"] {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface2: #eef0f5;
    --border: #dde0ea;
    --accent: #c47f00;
    --accent2: #2c5fe0;
    --text: #374060;
    --text-strong: #111520;
    --muted: #8890aa;
    --green: #2e8a56;
    --missing-bg: #f0eaf5;
    --missing-hover: #e8dff0;
    --missing-text: #a080b0;
    --star-opacity: 0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.wrapper {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

/* ── Header ── */
header {
    margin-bottom: 56px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 40px;
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(26px, 5vw, 48px);
    font-weight: 800;
    color: var(--text-strong);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h1 .agency { color: var(--accent); }

.subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

/* ── Theme toggle button ── */
.theme-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 7px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* pill track */
.toggle-track {
    width: 34px;
    height: 19px;
    border-radius: 99px;
    background: var(--border);
    position: relative;
    flex-shrink: 0;
    transition: background 0.3s;
}

[data-theme="light"] .toggle-track { background: var(--accent); }

.toggle-thumb {
    position: absolute;
    top: 2.5px;
    left: 2.5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    transition: transform 0.3s;
}

[data-theme="light"] .toggle-thumb { transform: translateX(15px); }

.toggle-label { white-space: nowrap; user-select: none; }

/* ── Badges ── */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--muted);
    transition: background 0.3s, border-color 0.3s;
}

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Info cards ── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 48px;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: background 0.3s, border-color 0.3s;
}

.info-card h3 {
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.info-card p {
    font-size: 13px;
    line-height: 1.7;
}

.permission-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(76, 175, 120, 0.08);
    border: 1px solid rgba(76, 175, 120, 0.25);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--green);
    margin-top: 8px;
}

/* ── Table ── */
.table-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.table-header h2 {
    font-family: 'Syne', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-strong);
}

.count { color: var(--muted); font-size: 12px; }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    overflow-x: auto;
    transition: background 0.3s, border-color 0.3s;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

thead tr {
    background: var(--surface2);
    border-bottom: 2px solid var(--border);
    transition: background 0.3s;
}

th {
    padding: 12px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

th:first-child { width: 50px; }

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody tr.missing { background: var(--missing-bg); }
tbody tr.missing:hover { background: var(--missing-hover); }

td {
    padding: 9px 14px;
    font-size: 13px;
    vertical-align: middle;
}

.ver-num { color: var(--muted); font-size: 12px; }

.build-num {
    color: var(--text-strong);
    font-weight: 700;
}

.build-date { color: var(--muted); font-size: 12px; white-space: nowrap; }

.comment-tag {
    display: inline-block;
    background: rgba(232, 184, 75, 0.12);
    border: 1px solid rgba(232, 184, 75, 0.3);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
}

.dl-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(91, 140, 255, 0.1);
    border: 1px solid rgba(91, 140, 255, 0.3);
    color: var(--accent2);
    text-decoration: underline;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.dl-link:active, .dl-link.linux:active {
    color: yellow;
}

.dl-link:visited, .dl-link.linux:visited {
    color: red;
}

.dl-link:hover {
    background: rgba(91, 140, 255, 0.2);
    border-color: rgba(91, 140, 255, 0.6);
}

.dl-link.linux {
    background: rgba(76, 175, 120, 0.1);
    border: 1px solid rgba(76, 175, 120, 0.3);
    color: var(--green);
}

.dl-link.linux:hover {
    background: rgba(76, 175, 120, 0.2);
    border-color: rgba(76, 175, 120, 0.6);
}

.no-version { color: var(--missing-text); font-size: 12px; font-style: italic; }

.linux-badge {
    display: inline-block;
    background: rgba(76, 175, 120, 0.1);
    border: 1px solid rgba(76, 175, 120, 0.3);
    color: var(--green);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

/* Hash cells */
.hash-cell {
    color: var(--missing-text);
    font-size: 11px;
    font-style: italic;
    white-space: nowrap;
}

/* ── Footer ── */
footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.badge--highlighted {
    color: var(--accent);
    border-color: rgba(232, 184, 75, 0.35);
    background: rgba(232, 184, 75, 0.07);
    text-decoration: none;
    box-shadow: 0 0 8px rgba(232, 184, 75, 0.12), inset 0 0 12px rgba(232, 184, 75, 0.04);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.badge--highlighted:hover {
    background: rgba(232, 184, 75, 0.14);
    border-color: rgba(232, 184, 75, 0.65);
    box-shadow: 0 0 14px rgba(232, 184, 75, 0.25), inset 0 0 16px rgba(232, 184, 75, 0.07);
    color: var(--accent);
}

[data-theme="light"] .badge--highlighted {
    box-shadow: 0 0 6px rgba(196, 127, 0, 0.15);
}

[data-theme="light"] .badge--highlighted:hover {
    box-shadow: 0 0 12px rgba(196, 127, 0, 0.3);
}