:root {
    --pv-dark: #1e2a3a;
    --pv-dark-2: #2c3e50;
    --pv-blue: #3498db;
    --pv-blue-dark: #2980b9;
    --pv-bg: #ffffff;
    --pv-bg-alt: #f8f9fa;
    --pv-bg-card: #ffffff;
    --pv-text: #212529;
    --pv-text-muted: #4b5563;
    --pv-text-light: #6b7280;
    --pv-border: #e9ecef;
    --pv-link: #2563eb;
    --pv-shadow: rgba(0, 0, 0, 0.06);
    --pv-code-bg: #f1f3f5;
    --pv-note-bg: #eff6ff;
    --pv-note-border: #3b82f6;
    --pv-tip-bg: #ecfdf5;
    --pv-tip-border: #16a34a;
    --pv-warning-bg: #fffbeb;
    --pv-warning-border: #d97706;
    color-scheme: light;
}

[data-theme="dark"] {
    --pv-bg: #0f1419;
    --pv-bg-alt: #1a1f2e;
    --pv-bg-card: #1a2332;
    --pv-text: #e1e4e8;
    --pv-text-muted: #b1b8c3;
    --pv-text-light: #8b949e;
    --pv-border: #2d3748;
    --pv-link: #60a5fa;
    --pv-shadow: rgba(0, 0, 0, 0.35);
    --pv-code-bg: #161b26;
    --pv-note-bg: #14233b;
    --pv-note-border: #3b82f6;
    --pv-tip-bg: #12261c;
    --pv-tip-border: #3fb950;
    --pv-warning-bg: #2a2314;
    --pv-warning-border: #e3b341;
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--pv-text);
    background: var(--pv-bg);
    overflow-x: hidden;
}

a { color: var(--pv-link); }
a:hover { text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--pv-blue); outline-offset: 2px; }

img { max-width: 100%; height: auto; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 200;
    background: #fff; color: #1e2a3a; padding: 10px 16px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 8px; }

.icon { width: 24px; height: 24px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 32px; height: 32px; }

.site-header { background: var(--pv-dark); color: #fff; padding: 14px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.35rem; font-weight: 800; }
.brand img { display: block; width: 32px; height: 32px; }
.brand-sub {
    font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: #dbe4ee; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px; padding: 1px 10px;
}
.header-nav { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-link { color: #e5ecf3; text-decoration: none; font-size: 0.95rem; }
.header-link:hover { color: #fff; text-decoration: underline; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn-outline { color: #fff; border-color: rgba(255, 255, 255, 0.6); background: transparent; }
.btn-outline:hover { background: rgba(255, 255, 255, 0.12); }
.btn-primary { color: #fff; background: #2573a7; }
.btn-primary:hover { background: #1f648f; }

.switcher {
    display: inline-flex; align-items: center; padding: 3px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
}
.switcher button, .switcher a {
    display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px;
    padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: #cdd7e2;
    font: inherit; font-size: 0.8rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.switcher button:hover, .switcher a:hover { color: #fff; }
.switcher button.active, .switcher a.active { background: rgba(255, 255, 255, 0.22); color: #fff; }

.hero {
    background: linear-gradient(135deg, var(--pv-dark) 0%, var(--pv-dark-2) 100%);
    color: #fff; padding: 56px 0 72px; position: relative;
}
.hero h1 { margin: 0 0 14px; font-size: 2.6rem; font-weight: 800; letter-spacing: -1px; line-height: 1.15; }
.hero .lead { margin: 0 0 28px; font-size: 1.2rem; color: #d3dae0; max-width: 640px; }
.hero-compact { padding: 40px 0 48px; }
.hero-compact h1 { font-size: 2.1rem; }

.page-hero {
    background: linear-gradient(135deg, var(--pv-dark) 0%, var(--pv-dark-2) 100%);
    color: #fff; padding: 28px 0 44px;
}
.page-hero h1 { margin: 12px 0 10px; font-size: 2.2rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; max-width: 860px; }
.page-hero .lead { margin: 0 0 14px; font-size: 1.1rem; color: #d3dae0; max-width: 760px; }
.page-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; font-size: 0.9rem; color: #c3ccd6; }
.page-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }

.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; color: #c3ccd6; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px; opacity: 0.7; }
.breadcrumb a { color: #e5ecf3; }

.search-form {
    display: flex; align-items: center; gap: 10px; max-width: 680px; padding: 8px 8px 8px 16px;
    background: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.search-form .search-icon { color: #4b5563; }
.search-form input {
    flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.05rem;
    color: #212529; padding: 10px 4px;
}
.search-form input:focus-visible { outline: none; }
.search-form:focus-within { outline: 3px solid var(--pv-blue); outline-offset: 2px; }

.section { padding: 56px 0; background: var(--pv-bg); }
.section-alt { background: var(--pv-bg-alt); border-top: 1px solid var(--pv-border); border-bottom: 1px solid var(--pv-border); }
.section-title { margin: 0 0 24px; font-size: 1.5rem; font-weight: 800; color: var(--pv-text); }
.section-title-spaced { margin-top: 48px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.card {
    display: flex; flex-direction: column; padding: 24px; background: var(--pv-bg-card);
    border: 1px solid var(--pv-border); border-radius: 12px; box-shadow: 0 1px 3px var(--pv-shadow);
}
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 10px; background: var(--pv-note-bg); color: var(--pv-link); }
.card h3 { margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; }
.card h3 a { color: var(--pv-text); text-decoration: none; }
.card h3 a:hover { color: var(--pv-link); text-decoration: underline; }
.card > p { margin: 0 0 14px; color: var(--pv-text-muted); font-size: 0.95rem; }
.card-links { margin: 0 0 14px; padding: 0; list-style: none; border-top: 1px solid var(--pv-border); }
.card-links li { padding: 7px 0; border-bottom: 1px solid var(--pv-border); font-size: 0.95rem; }
.card .card-count { margin: auto 0 0; font-size: 0.85rem; color: var(--pv-text-light); }

.article-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.article-list li {
    display: flex; flex-direction: column; gap: 2px; padding: 16px 20px;
    background: var(--pv-bg-card); border: 1px solid var(--pv-border); border-radius: 10px;
}
.article-list a { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.article-list a:hover { text-decoration: underline; }
.article-list span { color: var(--pv-text-muted); font-size: 0.95rem; }
.article-list-large li { padding: 20px 24px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pill-list a { display: inline-block; padding: 8px 16px; border: 1px solid var(--pv-border); border-radius: 999px; background: var(--pv-bg-card); text-decoration: none; font-weight: 600; }
.pill-list a:hover { border-color: var(--pv-link); }

.notice { color: var(--pv-text-muted); }
.back-link { margin: 28px 0 0; }

.contact-box {
    display: flex; align-items: flex-start; gap: 18px; padding: 24px; margin-top: 32px;
    background: var(--pv-bg-card); border: 1px solid var(--pv-border); border-radius: 12px; color: var(--pv-link);
}
.section:not(.section-alt) > .container > .contact-box { margin-top: 0; }
.contact-box h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--pv-text); }
.contact-box p { margin: 0; color: var(--pv-text-muted); }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
@media (min-width: 1000px) {
    .article-layout { grid-template-columns: minmax(0, 780px) 280px; justify-content: center; align-items: start; }
    .toc { position: sticky; top: 24px; }
}

.toc { padding: 20px; background: var(--pv-bg-alt); border: 1px solid var(--pv-border); border-radius: 12px; font-size: 0.95rem; }
.toc-title { margin: 0 0 10px; font-weight: 800; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 6px 0; }

.prose { min-width: 0; font-size: 1.05rem; line-height: 1.75; color: var(--pv-text); }
.prose h2 { margin: 2.2em 0 0.6em; font-size: 1.55rem; font-weight: 800; line-height: 1.3; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.8em 0 0.5em; font-size: 1.2rem; font-weight: 700; line-height: 1.35; }
.prose h4 { margin: 1.5em 0 0.4em; font-size: 1.05rem; font-weight: 700; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.prose li { margin: 0.35em 0; }
.prose code { padding: 2px 6px; border-radius: 4px; background: var(--pv-code-bg); font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 0.9em; overflow-wrap: anywhere; }
.prose pre { margin: 0 0 1.2em; padding: 16px; overflow-x: auto; border-radius: 8px; background: var(--pv-code-bg); }
.prose pre code { padding: 0; background: transparent; }
.prose blockquote { margin: 0 0 1.2em; padding: 4px 18px; border-left: 4px solid var(--pv-border); color: var(--pv-text-muted); }
.prose a { overflow-wrap: anywhere; }

.table-wrap { margin: 0 0 1.4em; overflow-x: auto; border: 1px solid var(--pv-border); border-radius: 8px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--pv-border); }
.prose thead th { background: var(--pv-bg-alt); font-weight: 700; white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }

.callout { margin: 0 0 1.4em; padding: 14px 18px; border-left: 4px solid var(--pv-note-border); border-radius: 0 8px 8px 0; background: var(--pv-note-bg); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 4px; font-weight: 800; }
.callout-tip { border-left-color: var(--pv-tip-border); background: var(--pv-tip-bg); }
.callout-warning { border-left-color: var(--pv-warning-border); background: var(--pv-warning-bg); }

.site-footer { padding: 28px 0; text-align: center; color: var(--pv-text-light); font-size: 0.9rem; border-top: 1px solid var(--pv-border); background: var(--pv-bg); }
.site-footer p { margin: 0 0 8px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; }
.site-footer a { color: var(--pv-text-muted); }

@media (max-width: 720px) {
    .container { padding: 0 18px; }
    .header-link-site { display: none; }
    .hero { padding: 36px 0 48px; }
    .hero h1 { font-size: 1.9rem; }
    .hero .lead { font-size: 1.05rem; }
    .page-hero h1 { font-size: 1.7rem; }
    .section { padding: 40px 0; }
    .search-form { padding-left: 12px; }
    .search-form .btn { padding: 9px 14px; }
    .search-form .search-icon { display: none; }
    .card-grid { grid-template-columns: minmax(0, 1fr); }
    .prose { font-size: 1rem; }
}

@media (max-width: 560px) {
    .header-link-login, .header-nav .btn-outline { display: none; }
    .header-inner { flex-wrap: nowrap; }
    .header-nav { gap: 8px; flex-wrap: nowrap; }
    .switcher button, .switcher a { min-width: 28px; padding: 0 6px; }
}

@media (max-width: 400px) {
    .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

@media print {
    .site-header, .toc, .search-form, .site-footer nav, .contact-box { display: none; }
    .page-hero, .hero { background: none; color: #000; padding: 0; }
    .page-hero h1, .page-hero .lead, .page-hero .meta, .breadcrumb ol, .breadcrumb a { color: #000; }
}
