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

:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --fg: #0a0c14;
    --fg-secondary: #2c2f37;
    --muted: #565b64;
    --border: #d4d9e0;
    --subtle-bg: #fafafa;        /* section headers, notices, table heads */
    --chip-bg: #f0f1f3;          /* small chips: sitebit */
    --placeholder-from: #f0f0f0;
    --placeholder-to: #e8e8e8;
    --accent: #ff6b35;
    --accent-hover: #e55a2b;
    --accent-subtle: #fff4f0;

    /* semantic status colors */
    --success-bg: #e8f5e9; --success-fg: #2e7d32; --success-border: #bbf7d0;
    --danger-bg: #fef2f2;  --danger-fg: #b91c1c;  --danger-border: #fecaca;
    --info-bg: #e3f2fd;    --info-fg: #1565c0;
    --warn-bg: #fff3e0;    --warn-fg: #e65100;
    --purple-bg: #f3e5f5;  --purple-fg: #7b1fa2;

    /* image-less card placeholder (hue set inline per post) */
    --ph-s: 55%;  --ph-l1: 90%; --ph-l2: 80%;
    --ph-mono-s: 42%;   --ph-mono-l: 42%;
    --ph-domain-s: 30%; --ph-domain-l: 38%;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --max-width: 1280px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
}

/* Dark tokens — applied for system-dark (unless user forced light) and for explicit toggle */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0c0e12;
        --surface: #191c23;
        --fg: #f6f8fb;
        --fg-secondary: #d0d5de;
        --muted: #aab0bc;
        --border: #3a414d;
        --subtle-bg: #1e222a;
        --chip-bg: #262b34;
        --placeholder-from: #20242c;
        --placeholder-to: #171a20;
        --accent: #ff7a48;
        --accent-hover: #ff8d60;
        --accent-subtle: #2a1a12;

        --success-bg: #13291b; --success-fg: #6ee7a0; --success-border: #1f4a30;
        --danger-bg: #2a1517;  --danger-fg: #fca5a5;  --danger-border: #4a2023;
        --info-bg: #13233a;    --info-fg: #7cc0ff;
        --warn-bg: #2e2210;    --warn-fg: #fbbf24;
        --purple-bg: #241733;  --purple-fg: #d3aef0;

        --ph-s: 30%;  --ph-l1: 20%; --ph-l2: 13%;
        --ph-mono-s: 55%;   --ph-mono-l: 72%;
        --ph-domain-s: 25%; --ph-domain-l: 65%;

        --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
        --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #191c23;
    --fg: #f6f8fb;
    --fg-secondary: #d0d5de;
    --muted: #aab0bc;
    --border: #3a414d;
    --subtle-bg: #1e222a;
    --chip-bg: #262b34;
    --placeholder-from: #20242c;
    --placeholder-to: #171a20;
    --accent: #ff7a48;
    --accent-hover: #ff8d60;
    --accent-subtle: #2a1a12;

    --success-bg: #13291b; --success-fg: #6ee7a0; --success-border: #1f4a30;
    --danger-bg: #2a1517;  --danger-fg: #fca5a5;  --danger-border: #4a2023;
    --info-bg: #13233a;    --info-fg: #7cc0ff;
    --warn-bg: #2e2210;    --warn-fg: #fbbf24;
    --purple-bg: #241733;  --purple-fg: #d3aef0;

    --ph-s: 30%;  --ph-l1: 20%; --ph-l2: 13%;
    --ph-mono-s: 55%;   --ph-mono-l: 72%;
    --ph-domain-s: 25%; --ph-domain-l: 65%;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

header {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
}
.logo {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
    color: var(--fg);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.logo .accent { color: var(--accent); }
.logo .dim {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
}

nav { display: flex; align-items: center; gap: 20px; }
nav a {
    color: var(--fg-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
}
nav a:hover { color: var(--accent); }
nav a.admin-link {
    color: var(--muted);
    font-size: 13px;
}
nav a.admin-link:hover { color: var(--fg); }

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    color: var(--fg-secondary);
    display: inline-flex;
    align-items: center;
    transition: background 0.15s, transform 0.15s;
}
.theme-toggle:hover { background: var(--chip-bg); transform: scale(1.08); }
.theme-toggle:active { transform: scale(0.95); }

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 18px 24px 32px;
    min-height: calc(100vh - 140px);
}

footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Section nav (newspaper section bar) */
.section-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-bottom: 6px;
    border-bottom: 2px solid var(--border);
}
.section-link {
    font-size: 14px;
    font-weight: 600;
    padding: 9px 13px;
    color: var(--fg-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.section-link:hover { color: var(--accent); }
.section-link.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Section heading */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 18px 0 16px;
}
.section-head h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
}
.section-head .count { font-size: 13px; color: var(--muted); font-weight: 500; }

/* News Grid (dense) */
.news-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

/* Lead story spans two columns + two rows. align-self:start keeps the card at its
   natural content height instead of stretching to fill both row tracks — otherwise
   the summary's flex:1 balloons and leaves dead space above the meta row. */
.card-lead {
    grid-column: span 2;
    grid-row: span 2;
    align-self: start;
}

/* Image + image-less placeholder share sizing and the hue fallback.
   The <img> overlays a hue monogram; if it fails to load (dead og:image),
   `onerror` removes it and the monogram placeholder shows through. */
.card-image-link,
.card-image-placeholder {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    background: linear-gradient(135deg, var(--placeholder-from) 0%, var(--placeholder-to) 100%);
}
.card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--border);
    display: block;
}
.card-lead .card-image-link,
.card-lead .card-image-placeholder { height: 340px; }
.card-lead .ph-mono { font-size: 64px; }
.has-hue {
    background: linear-gradient(135deg,
        hsl(var(--ph-hue) var(--ph-s) var(--ph-l1)) 0%,
        hsl(var(--ph-hue) var(--ph-s) var(--ph-l2)) 100%);
}
.has-hue .ph-mono { color: hsl(var(--ph-hue) var(--ph-mono-s) var(--ph-mono-l)); }
.has-hue .ph-domain { color: hsl(var(--ph-hue) var(--ph-domain-s) var(--ph-domain-l)); }
.card-image-placeholder.is-discussion {
    background: linear-gradient(135deg, var(--accent-subtle) 0%, var(--placeholder-to) 100%);
}
.ph-mono {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
}
.is-discussion .ph-mono { font-size: 34px; }
.ph-domain {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    max-width: 85%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-body { padding: 14px 16px 15px; flex: 1; display: flex; flex-direction: column; }

/* Category chips (above headline) */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.chip-cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}
.chip-cat:hover { background: var(--accent); color: #fff; }
.chip-pending { background: var(--chip-bg); color: var(--muted); }

.card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--fg);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-title a {
    color: inherit;
    text-decoration: none;
}
.card-title a:hover { color: var(--accent); }

.card-summary {
    font-size: 13.5px;
    color: var(--fg-secondary);
    line-height: 1.55;
    margin-bottom: 12px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.muted-text { color: var(--muted); }

/* Lead story emphasis */
.card-lead .card-body { padding: 20px 22px 22px; }
.card-lead .card-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.4px;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    margin-bottom: 12px;
}
.card-lead .card-summary {
    font-size: 16px;
    line-height: 1.65;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    flex: 0 0 auto;
}
.card-lead .chip-cat { font-size: 12px; padding: 4px 12px; }

.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.card-meta .points { font-weight: 600; color: var(--accent); }
.card-meta a { color: var(--muted); text-decoration: none; }
.card-meta a:hover { color: var(--accent); }
.card-meta .sitebit {
    margin-left: auto;
    font-size: 11px;
    background: var(--chip-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Badges */
.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}
.badge-translated { background: var(--success-bg); color: var(--success-fg); }
.badge-sent { background: var(--info-bg); color: var(--info-fg); }
.badge-pending { background: var(--warn-bg); color: var(--warn-fg); }
.badge-fetching { background: var(--purple-bg); color: var(--purple-fg); }
.badge-fetched { background: var(--success-bg); color: var(--success-fg); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    max-width: 440px;
    margin: 32px auto 8px;
    padding: 0;
    font-size: 14px;
}
.pagination .page-btn {
    color: var(--fg);
    text-decoration: none;
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.15s;
}
.pagination a.page-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .page-btn.disabled { opacity: 0.4; pointer-events: none; }
.pagination .page-info { color: var(--muted); font-weight: 500; }

/* Article Detail */
.article-header { margin-bottom: 20px; }
.article-header h1 {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}
.article-original-title {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 14px;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--muted);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.article-meta .points { font-weight: 700; color: var(--accent); }
.article-meta a { color: var(--muted); text-decoration: none; }
.article-meta a:hover { color: var(--accent); }

/* Article top: text lead (title + meta + summary) beside a compact hero image on desktop */
.article-top { margin-bottom: 24px; }
.article-top.has-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
}
.article-lead .summary-box,
.article-lead .status-notice { margin-bottom: 0; }

.article-hero-link {
    position: relative;
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--border);
}
.article-hero {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.article-hero-link:hover .article-hero { transform: scale(1.04); }
.hero-zoom {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.article-hero-link:hover .hero-zoom { opacity: 1; }

/* Lightbox modal (full-size image viewer) */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); transform: scale(1.06); }
.lightbox-close:active { transform: scale(0.94); }

/* Below tablet: stack the hero under the text lead */
@media (max-width: 760px) {
    .article-top.has-hero { grid-template-columns: 1fr; gap: 16px; }
    .article-lead .summary-box,
    .article-lead .status-notice { margin-bottom: 0; }
    .article-hero { aspect-ratio: 16 / 9; }
    .hero-zoom { opacity: 1; }
}

.summary-box {
    background: var(--accent-subtle);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--fg);
}
.summary-box h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 700;
}

.article-links {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-outline {
    border: 1.5px solid var(--border);
    color: var(--fg-secondary);
    background: var(--surface);
}
.btn-outline:hover { border-color: var(--fg); color: var(--fg); }
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-accent:hover { background: var(--accent-hover); }

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.image-gallery img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: transform 0.2s;
}
.image-gallery img:hover { transform: scale(1.03); }

/* Full translation */
.full-translation {
    margin: 32px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.full-translation > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 22px;
    cursor: pointer;
    background: var(--subtle-bg);
    border-bottom: 1px solid var(--border);
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}
.full-translation > summary::-webkit-details-marker { display: none; }
.full-translation > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex: 0 0 auto;
}
.full-translation[open] > summary::before { transform: rotate(45deg); }
.full-translation > summary h2 {
    display: inline;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
}
.full-translation > summary:hover { background: var(--chip-bg); }

.translated-body {
    max-width: 800px;
    padding: 30px 30px 34px;
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--fg);
    word-break: keep-all;      /* don't split Korean words mid-line */
    overflow-wrap: anywhere;
}
.translated-body > :first-child { margin-top: 0; }
.translated-body > :last-child { margin-bottom: 0; }
.translated-body p { margin: 0 0 18px; }
.translated-body h3 {
    font-size: 21px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.3px;
    margin: 32px 0 12px;
    color: var(--fg);
}
.translated-body h4 {
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.4;
    margin: 28px 0 10px;
    color: var(--fg);
}
.translated-body h5 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 24px 0 8px;
    color: var(--fg-secondary);
}
.translated-body ul,
.translated-body ol { margin: 0 0 18px; padding-left: 22px; }
.translated-body li { margin-bottom: 8px; }
.translated-body li::marker { color: var(--accent); }
.translated-body strong { font-weight: 700; color: var(--fg); }
.translated-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.translated-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86em;
    background: var(--chip-bg);
    padding: 2px 6px;
    border-radius: 4px;
}
.translated-body pre {
    margin: 0 0 18px;
    padding: 16px 18px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-x: auto;           /* long code lines scroll, never break layout */
}
.translated-body pre code {
    display: block;
    font-size: 13.5px;
    line-height: 1.6;
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--fg);
    white-space: pre;
}
.translated-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

/* Status notices */
.status-notice {
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--fg-secondary);
    background: var(--subtle-bg);
    border: 1px solid var(--border);
}
.status-notice strong { color: var(--fg); }
.status-notice.translated { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }

/* Usage Page */
.usage-page h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.usage-page h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--fg-secondary);
    margin: 32px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}
.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}
.stat-value { font-size: 26px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.usage-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--subtle-bg);
    border-bottom: 1px solid var(--border);
    color: var(--fg-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.usage-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); }

/* Login */
.login-page { max-width: 380px; margin: 60px auto; }
.login-page h1 { font-size: 22px; font-weight: 700; margin-bottom: 20px; text-align: center; }
.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-fg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    text-align: center;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--surface);
    color: var(--fg);
    transition: border-color 0.15s;
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form button {
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.login-form button:hover { background: var(--accent-hover); }

/* Empty state */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 15px;
}

/* Glossary */
.glossary-page h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.glossary-desc { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.glossary-msg { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success-fg); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.glossary-msg-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.glossary-form { display: flex; gap: 10px; margin-bottom: 24px; }
.glossary-form input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background: var(--surface); color: var(--fg); }
.glossary-form input:focus { outline: none; border-color: var(--accent); }
.glossary-form button { padding: 10px 20px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; }
.glossary-form button:hover { background: var(--accent-hover); }
.glossary-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.glossary-table th { text-align: left; padding: 10px 14px; background: var(--subtle-bg); border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--fg-secondary); }
.glossary-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.glossary-table input[type="text"] { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: transparent; color: var(--fg); }
.glossary-table input[type="text"]:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.glossary-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; white-space: nowrap; }
.glossary-badge-translate { background: var(--success-bg); color: var(--success-fg); }
.glossary-badge-keep { background: var(--info-bg); color: var(--info-fg); }
.glossary-actions { white-space: nowrap; }
.btn-sm { padding: 5px 12px; border: none; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-sm-save { background: var(--success-bg); color: var(--success-fg); }
.btn-sm-save:hover { filter: brightness(0.95); }
.btn-sm-del { background: var(--danger-bg); color: var(--danger-fg); }
.btn-sm-del:hover { filter: brightness(0.95); }

/* Back link */
.back-link { margin-top: 32px; }
.back-link a { color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link a:hover { color: var(--fg); }

@media (max-width: 1200px) {
    .news-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .card-lead { grid-row: span 1; }
    .card-lead .card-image-link,
    .card-lead .card-image-placeholder { height: 240px; }
    .card-lead .card-title { font-size: 22px; }
}
@media (max-width: 640px) {
    .news-grid { grid-template-columns: 1fr; gap: 14px; }
    .card-lead { grid-column: span 1; }
    .card-lead .card-image-link,
    .card-lead .card-image-placeholder { height: 200px; }
    .card-lead .card-title { font-size: 20px; }
    .article-header h1 { font-size: 22px; }
    .header-inner { padding: 12px 16px; }
    main { padding: 14px 16px 28px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .logo .dim { display: none; }
    nav { gap: 14px; }
    /* horizontal-scroll section nav instead of wrapping */
    .section-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .section-nav::-webkit-scrollbar { display: none; }
    .section-link { flex: 0 0 auto; }
}
