:root {
    color-scheme: light;
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --bg-primary: #f6f8fc;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-card-emphasis: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0));
    --border-soft: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(14, 165, 233, 0.22);
    --text-primary: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.75);
    --text-muted: rgba(15, 23, 42, 0.54);
    --text-invert: #e0f2fe;
    --accent: #0ea5e9;
    --accent-soft: rgba(14, 165, 233, 0.12);
    --accent-strong: rgba(14, 165, 233, 0.24);
    --pill-bg: rgba(148, 163, 184, 0.2);
    --pill-accent-bg: rgba(14, 165, 233, 0.18);
    --shadow-card: 0 18px 36px rgba(15, 23, 42, 0.08);
    --shadow-hero: 0 22px 48px rgba(14, 165, 233, 0.18);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0b0f14;
    --bg-header: #04070d;
    --bg-card: rgba(15, 23, 42, 0.6);
    --bg-card-emphasis: rgba(15, 23, 42, 0.72);
    --border-soft: rgba(125, 211, 252, 0.16);
    --border-strong: rgba(125, 211, 252, 0.32);
    --text-primary: #e5f4ff;
    --text-secondary: rgba(229, 244, 255, 0.8);
    --text-muted: rgba(229, 244, 255, 0.6);
    --text-invert: #0f172a;
    --accent: #7dd3fc;
    --accent-soft: rgba(125, 211, 252, 0.16);
    --accent-strong: rgba(125, 211, 252, 0.24);
    --pill-bg: rgba(148, 163, 184, 0.2);
    --pill-accent-bg: rgba(56, 189, 248, 0.3);
    --shadow-card: 0 0 32px rgba(14, 165, 233, 0.12);
    --shadow-hero: 0 0 40px rgba(14, 165, 233, 0.24);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg-primary: #0b0f14;
        --bg-header: #04070d;
        --bg-card: rgba(15, 23, 42, 0.6);
        --bg-card-emphasis: rgba(15, 23, 42, 0.72);
        --border-soft: rgba(125, 211, 252, 0.16);
        --border-strong: rgba(125, 211, 252, 0.32);
        --text-primary: #e5f4ff;
        --text-secondary: rgba(229, 244, 255, 0.8);
        --text-muted: rgba(229, 244, 255, 0.6);
        --text-invert: #0f172a;
        --accent: #7dd3fc;
        --accent-soft: rgba(125, 211, 252, 0.16);
        --accent-strong: rgba(125, 211, 252, 0.24);
        --pill-bg: rgba(148, 163, 184, 0.2);
        --pill-accent-bg: rgba(56, 189, 248, 0.3);
        --shadow-card: 0 0 32px rgba(14, 165, 233, 0.12);
        --shadow-hero: 0 0 40px rgba(14, 165, 233, 0.24);
    }
}

html {
    background: var(--bg-primary);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header,
.app-footer {
    padding: 1rem 2rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-footer {
    border-top: 1px solid var(--border-soft);
    border-bottom: none;
    font-size: 0.85rem;
}

.branding {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.beta-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
}

.main-nav {
    display: flex;
    gap: 1rem;
}

.main-nav a {
    padding: 0.4rem 0.8rem;
    border-radius: 0.6rem;
    transition: background 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--accent-soft);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    font-size: 1rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent);
    outline: none;
}

.theme-toggle__icon {
    pointer-events: none;
}

.search-form {
    position: relative;
}

.search-form input {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 0.6rem;
    padding: 0.45rem 0.8rem;
    color: var(--text-primary);
    min-width: 14rem;
}

.search-form input::placeholder {
    color: var(--text-muted);
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

.search-panel {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.search-inline {
    display: flex;
    gap: 0.8rem;
}

.search-inline input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
}

.search-inline input::placeholder {
    color: var(--text-muted);
}

.search-inline input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

.result-count {
    margin: 0;
    color: var(--text-muted);
}

.generated-at {
    color: var(--text-muted);
}

.app-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.grid.two-col {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.card,
.detail-card,
.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.card.hero {
    background: var(--bg-card-emphasis);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-hero);
}

.card-header,
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card h1,
.card h2 {
    margin: 0.8rem 0;
    color: var(--text-primary);
}

.card p {
    margin: 0.4rem 0 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.stats-card h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.stats-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.stats-card li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 0.6rem;
    background: var(--accent-soft);
    color: var(--text-primary);
}

.badge {
    background: var(--accent-strong);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-invert);
}

.widgets {
    margin-top: 1.5rem;
    display: grid;
    gap: 0.8rem;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-strong);
    color: var(--accent);
    background: var(--accent-soft);
    transition: background 0.2s ease;
    box-sizing: border-box;
}

.button:hover {
    background: var(--accent-strong);
    color: var(--text-invert);
}

.button.w-full {
    width: 100%;
}

.ghost-link {
    color: var(--accent);
    font-size: 0.85rem;
}

.pill {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--pill-bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.pill-accent {
    background: var(--pill-accent-bg);
    color: var(--accent);
}

.news-list {
    margin-top: 2rem;
    display: grid;
    gap: 1.2rem;
}

.detail-card header {
    display: grid;
    gap: 0.4rem;
}

.detail-card .meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-card .body {
    margin: 1.5rem 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

.prose p {
    margin-bottom: 1rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.prose h1 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0.5rem;
}

.prose h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
}

.prose h3 {
    font-size: 1.25rem;
}

.prose h4 {
    font-size: 1.1rem;
}

.prose ul,
.prose ol {
    margin: 0 0 1.2rem 1.5rem;
    padding: 0;
    color: var(--text-secondary);
}

.prose li {
    margin-bottom: 0.4rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose blockquote {
    margin: 1.2rem 0;
    padding: 0.8rem 1rem;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    color: var(--text-secondary);
    border-radius: 0 0.4rem 0.4rem 0;
}

.prose blockquote p {
    margin: 0;
}

.prose code {
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    border: 1px solid var(--border-soft);
}

.prose pre {
    margin: 1.2rem 0;
    padding: 1rem;
    background: var(--bg-header);
    border: 1px solid var(--border-soft);
    border-radius: 0.6rem;
    overflow-x: auto;
    line-height: 1.5;
}

.prose pre code {
    display: block;
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 0.9em;
    overflow-x: auto;
    white-space: pre;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: var(--accent-strong);
}

.prose img {
    max-width: 100%;
    height: auto;
    margin: 1.2rem 0;
    border-radius: 0.6rem;
    border: 1px solid var(--border-soft);
}

.prose table {
    width: 100%;
    margin: 1.2rem 0;
    border-collapse: collapse;
    border: 1px solid var(--border-soft);
    border-radius: 0.6rem;
    overflow: hidden;
}

.prose th,
.prose td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.prose th {
    background: var(--accent-soft);
    font-weight: 600;
    color: var(--text-primary);
}

.prose tr:last-child td {
    border-bottom: none;
}

.prose hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid var(--border-soft);
}

.prose strong {
    font-weight: 600;
    color: var(--text-primary);
}

.prose em {
    font-style: italic;
}

.empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.muted {
    color: var(--text-muted);
}

.page-head {
    margin-bottom: 1.5rem;
}

.app-footer .footer-links {
    display: flex;
    gap: 1rem;
}

@media (max-width: 960px) {
    .app-header,
    .app-footer {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .grid.two-col {
        grid-template-columns: 1fr;
    }
}

