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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

.header {
    position: relative;
    text-align: center;
    padding: 10px 0px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

    .header h1 {
        font-size: 2rem;
        color: #58a6ff;
        margin-bottom: 8px;
    }

    .header p {
        color: #8b949e;
        font-size: 0.9rem;
    }

/* Top-right subtle controls */
.header-actions,
.header-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-actions {
    position: absolute;
    top: 16px;
    right: 20px;
}

.header-controls {
    justify-content: center;
    margin-top: 4px;
}

.btn-subtle {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.4;
    transition: all 0.15s;
}

    .btn-subtle:hover {
        background: #21262d;
        color: #c9d1d9;
        border-color: #58a6ff;
    }

    .btn-subtle:disabled {
        opacity: 0.4;
        cursor: default;
    }

.sel-subtle {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.4;
    transition: all 0.15s;
}

    .sel-subtle:hover {
        background: #21262d;
        color: #c9d1d9;
        border-color: #58a6ff;
    }

    .sel-subtle option {
        background: #0d1117;
        color: #c9d1d9;
    }

.stats {
    text-align: center;
    padding: 10px;
    color: #8b949e;
    font-size: 0.85rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    }

    .card img {
        width: 100%;
        aspect-ratio: 16/9;
        object-fit: cover;
        display: block;
    }

.card-body {
    padding: 14px 16px;
}

.card-date {
    font-size: 0.8rem;
    color: #58a6ff;
    margin-bottom: 6px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #f0f6fc;
}

.card-copyright {
    font-size: 0.75rem;
    color: #8b949e;
    line-height: 1.4;
}

    .card-copyright a {
        color: #58a6ff;
        text-decoration: none;
    }

        .card-copyright a:hover {
            text-decoration: underline;
        }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 30px 20px 50px;
    flex-wrap: wrap;
}

    .pagination button {
        background: #21262d;
        color: #c9d1d9;
        border: 1px solid #30363d;
        padding: 8px 14px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 0.85rem;
        transition: background 0.15s;
    }

        .pagination button:hover:not(:disabled) {
            background: #30363d;
        }

        .pagination button:disabled {
            opacity: 0.4;
            cursor: default;
        }

        .pagination button.active {
            background: #1f6feb;
            border-color: #1f6feb;
            color: #fff;
            font-weight: 600;
        }

    .pagination .dots {
        color: #555;
        padding: 0 4px;
    }

    .pagination .page-info {
        color: #8b949e;
        font-size: 0.8rem;
        margin-left: 12px;
    }

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #8b949e;
    font-size: 1.1rem;
}

.error {
    text-align: center;
    padding: 40px 20px;
    color: #f85149;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #484f58;
    font-size: 0.75rem;
    border-top: 1px solid #21262d;
}

    .footer a {
        color: #58a6ff;
        text-decoration: none;
    }

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header-actions {
        top: 8px;
        right: 10px;
    }
}

:root {
    color-scheme: dark;
    --page-bg: #0d1117;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --surface: #161b22;
    --surface-hover: #1c2333;
    --surface-control: #21262d;
    --border: #30363d;
    --border-subtle: #21262d;
    --accent: #58a6ff;
    --accent-strong: #1f6feb;
    --success-bg: #1b3a2b;
    --success-text: #3fb950;
    --failure-bg: #3d1a1a;
    --failure-text: #f85149;
    --header-start: #1a1a2e;
    --header-mid: #16213e;
    --header-end: #0f3460;
}

html[data-theme="light"] {
    color-scheme: light;
    --page-bg: #f6f8fa;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #6e7781;
    --surface: #ffffff;
    --surface-hover: #f0f6fc;
    --surface-control: #f6f8fa;
    --border: #d0d7de;
    --border-subtle: #d8dee4;
    --accent: #0969da;
    --accent-strong: #0969da;
    --success-bg: #dafbe1;
    --success-text: #1a7f37;
    --failure-bg: #ffebe9;
    --failure-text: #cf222e;
    --header-start: #eaf2ff;
    --header-mid: #eef6ff;
    --header-end: #dcecff;
}

body {
    background: var(--page-bg);
    color: var(--text-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header {
    background: linear-gradient(135deg, var(--header-start) 0%, var(--header-mid) 50%, var(--header-end) 100%);
}

.header h1,
.card-date,
.card-copyright a,
.footer a,
.nav-links a {
    color: var(--accent);
}

.header p,
.stats,
.card-copyright {
    color: var(--text-secondary);
}

.btn-subtle,
.sel-subtle {
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-subtle:hover,
.sel-subtle:hover {
    background: var(--surface-control);
    color: var(--text-primary);
    border-color: var(--accent);
}

.sel-subtle option {
    background: var(--surface);
    color: var(--text-primary);
}

.card {
    background: var(--surface);
    border-color: var(--border);
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.card-title {
    color: var(--text-primary);
}

.pagination button {
    background: var(--surface-control);
    color: var(--text-primary);
    border-color: var(--border);
}

.pagination button:hover:not(:disabled) {
    background: var(--surface-hover);
}

.pagination button.active {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.pagination .dots,
.pagination .page-info,
.loading {
    color: var(--text-secondary);
}

.footer {
    color: var(--text-muted);
    border-top-color: var(--border-subtle);
}

html[data-theme="light"] .log-table th,
html[data-theme="light"] .state-table th {
    color: var(--accent);
    background: var(--surface);
}

html[data-theme="light"] .log-table td,
html[data-theme="light"] .state-table td {
    color: var(--text-primary);
    border-bottom-color: var(--border);
}

html[data-theme="light"] .log-table tr:hover td,
html[data-theme="light"] .state-table tr:hover td {
    background: var(--surface-hover);
}

html[data-theme="light"] .badge-ok {
    background: var(--success-bg);
    color: var(--success-text);
}

html[data-theme="light"] .badge-fail {
    background: var(--failure-bg);
    color: var(--failure-text);
}
