:root {
    --md-sys-color-primary: #0b57d0;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #041e49;
    --md-sys-color-secondary: #4a6267;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #cde7ec;
    --md-sys-color-on-secondary-container: #051f23;
    --md-sys-color-surface: #f8fafd;
    --md-sys-color-surface-container: #eef1f6;
    --md-sys-color-surface-container-high: #e8ebf0;
    --md-sys-color-on-surface: #191c20;
    --md-sys-color-on-surface-variant: #42474e;
    --md-sys-color-outline: #72777f;
    --md-sys-color-outline-variant: #c2c7cf;
    --md-sys-shape-pill: 9999px;
    --md-sys-shape-xl: 28px;
    --md-sys-shape-l: 16px;
    --md-sys-shape-m: 12px;
    --md-font-body: 'Roboto Flex', system-ui, sans-serif;
}

[data-theme="dark"] {
    --md-sys-color-primary: #a8c7fa;
    --md-sys-color-on-primary: #062e6f;
    --md-sys-color-primary-container: #0842a0;
    --md-sys-color-on-primary-container: #d3e3fd;
    --md-sys-color-secondary: #b1cbd0;
    --md-sys-color-on-secondary: #1c3438;
    --md-sys-color-secondary-container: #334b4f;
    --md-sys-color-on-secondary-container: #cde7ec;
    --md-sys-color-surface: #111418;
    --md-sys-color-surface-container: #1d2024;
    --md-sys-color-surface-container-high: #272a2f;
    --md-sys-color-on-surface: #e1e2e8;
    --md-sys-color-on-surface-variant: #c2c7cf;
    --md-sys-color-outline: #8c9199;
    --md-sys-color-outline-variant: #42474e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); font-family: var(--md-font-body); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; transition: background 0.3s, color 0.3s; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--md-sys-color-primary); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; border-radius: var(--md-sys-shape-m); }

.skip-link { position: absolute; top: -100%; left: 16px; z-index: 9999; padding: 12px 24px; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); border-radius: var(--md-sys-shape-m); font-weight: 500; }
.skip-link:focus { top: 16px; }

.m3-header-pill { position: sticky; top: 12px; z-index: 100; margin: 0 12px; padding: 8px 16px; background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-pill); display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: background 0.3s; }
.m3-logo img { height: 32px; width: auto; border-radius: var(--md-sys-shape-m); }
.m3-site-title { font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 600; color: var(--md-sys-color-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m3-site-title a { color: inherit; }
.m3-header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.m3-icon-btn { width: 44px; height: 44px; border-radius: var(--md-sys-shape-pill); border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--md-sys-color-on-surface); flex-shrink: 0; transition: background 0.2s; font-size: 24px; }
.m3-icon-btn:hover { background: var(--md-sys-color-surface-container-high); }

.m3-search-wrapper { position: relative; display: flex; align-items: center; }
.m3-search-input { width: 0; opacity: 0; padding: 0; border: none; background: var(--md-sys-color-surface); border-radius: var(--md-sys-shape-pill); height: 36px; font-size: 0.875rem; color: var(--md-sys-color-on-surface); transition: all 0.3s cubic-bezier(0.2,0,0,1); position: absolute; right: 0; }
.m3-search-input.active { width: 180px; opacity: 1; padding: 0 16px; position: relative; margin-right: 4px; }

.m3-fullscreen-nav { position: fixed; inset: 0; z-index: 200; background: var(--md-sys-color-surface); display: flex; flex-direction: column; padding: 24px; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.m3-fullscreen-nav.is-open { opacity: 1; visibility: visible; }
.m3-fullscreen-nav__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.m3-fullscreen-nav__list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.m3-fullscreen-nav__list li a { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-radius: var(--md-sys-shape-l); font-size: clamp(1.125rem, 3vw, 1.5rem); font-weight: 500; color: var(--md-sys-color-on-surface); transition: background 0.2s; }
.m3-fullscreen-nav__list li a:hover, .m3-fullscreen-nav__list li.current-menu-item a { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

.m3-main { flex: 1; width: 100%; padding-top: 12px; }
.m3-page-container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.m3-layout { display: grid; gap: 24px; grid-template-columns: 1fr; }

.m3-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 16px; flex-wrap: wrap; }
.m3-breadcrumb a { color: var(--md-sys-color-primary); }
.m3-breadcrumb__sep { opacity: 0.5; font-size: 0.75rem; }

.material-card { background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-xl); overflow: hidden; transition: box-shadow 0.2s; display: flex; flex-direction: column; }
.material-card--elevated { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.material-card--elevated:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

.m3-post-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.m3-post-card__media { position: relative; aspect-ratio: 16/9; background: var(--md-sys-color-surface-container-high); overflow: hidden; }
.m3-post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.m3-placeholder-svg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--md-sys-color-outline); font-size: 48px; }
.m3-post-card__content { padding: 16px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.m3-post-card__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.m3-chip { padding: 2px 10px; border-radius: var(--md-sys-shape-pill); background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.3px; }
.m3-title-large { font-size: clamp(1.125rem, 2.5vw, 1.375rem); line-height: 1.3; font-weight: 600; }
.m3-title-large a { color: var(--md-sys-color-on-surface); }
.m3-body-medium { font-size: 0.875rem; color: var(--md-sys-color-on-surface-variant); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.material-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; border-radius: var(--md-sys-shape-pill); background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font-weight: 500; font-size: 0.875rem; border: none; cursor: pointer; min-height: 40px; transition: opacity 0.2s; align-self: flex-start; }
.material-btn:hover { opacity: 0.9; }
.material-btn--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }

.m3-single-header { margin-bottom: 24px; }
.m3-single-title { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.2; font-weight: 600; margin-bottom: 12px; }
.m3-single-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.875rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 16px; }
.m3-author-box { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-l); margin-bottom: 24px; }
.m3-author-avatar img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.m3-author-info h4 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 2px; }
.m3-author-info p { font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); line-height: 1.4; }
.m3-single-content { font-size: clamp(1rem, 2vw, 1.125rem); line-height: 1.8; }
.m3-single-content > * + * { margin-top: 1.5em; }
.m3-single-content h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); margin-top: 2.5em; margin-bottom: 0.75em; font-weight: 600; }
.m3-single-content blockquote { border-left: 4px solid var(--md-sys-color-primary); padding: 16px 24px; background: var(--md-sys-color-surface-container); border-radius: 0 var(--md-sys-shape-m) var(--md-sys-shape-m) 0; font-style: italic; }
.m3-single-content pre { background: var(--md-sys-color-surface-container-high); padding: 16px; border-radius: var(--md-sys-shape-m); overflow-x: auto; font-size: 0.875rem; }

.m3-related-posts { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.m3-section-title { font-size: clamp(1.125rem, 2.5vw, 1.375rem); font-weight: 600; margin-bottom: 16px; }

.m3-sticky-actions { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; gap: 8px; padding: 8px 16px; background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-pill); box-shadow: 0 4px 12px rgba(0,0,0,0.15); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

.m3-chat-comments { margin-top: 48px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.m3-chat-toggle { width: 100%; padding: 16px; background: var(--md-sys-color-surface-container); border: none; border-radius: var(--md-sys-shape-l); display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 1rem; font-weight: 600; color: var(--md-sys-color-on-surface); margin-top: 24px; }
.m3-chat-toggle .material-symbols-outlined { transition: transform 0.3s; }
.m3-chat-toggle[aria-expanded="true"] .material-symbols-outlined { transform: rotate(180deg); }
.m3-chat-container { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.2,0,0,1); }
.m3-chat-container.is-open { max-height: 600px; overflow-y: auto; }
.m3-chat-list { list-style: none; padding: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.m3-chat-bubble { max-width: 85%; padding: 12px 16px; border-radius: var(--md-sys-shape-l); font-size: 0.9375rem; line-height: 1.5; position: relative; }
.m3-chat-bubble--other { align-self: flex-start; background: var(--md-sys-color-surface-container); border-bottom-left-radius: 4px; }
.m3-chat-bubble--self { align-self: flex-end; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border-bottom-right-radius: 4px; }
.m3-chat-meta { font-size: 0.6875rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.m3-chat-meta img { width: 20px; height: 20px; border-radius: 50%; }
.m3-chat-input-area { position: sticky; bottom: 0; padding: 12px 0; background: var(--md-sys-color-surface); display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--md-sys-color-outline-variant); margin-top: 8px; }
.m3-chat-input-area textarea { flex: 1; padding: 10px 16px; border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-l); background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface); font-family: inherit; font-size: 0.9375rem; resize: none; min-height: 44px; max-height: 120px; line-height: 1.4; }
.m3-chat-input-area button { width: 44px; height: 44px; border-radius: var(--md-sys-shape-pill); border: none; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

.m3-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.m3-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 12px; border-radius: var(--md-sys-shape-pill); color: var(--md-sys-color-on-surface-variant); font-weight: 500; transition: background 0.2s; }
.m3-pagination .page-numbers:hover { background: var(--md-sys-color-surface-container); }
.m3-pagination .page-numbers.current { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }

.m3-sidebar { display: flex; flex-direction: column; gap: 24px; }
.widget { background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-xl); padding: 20px; }
.widget-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.widget ul { list-style: none; }
.widget ul li { margin-bottom: 8px; }
.widget ul li a { color: var(--md-sys-color-on-surface-variant); font-size: 0.9375rem; }

.m3-footer-card { background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-xl) var(--md-sys-shape-xl) 0 0; padding: 48px 16px 32px; margin-top: auto; }
.m3-footer__grid { display: grid; gap: 32px; grid-template-columns: 1fr; max-width: 1200px; margin: 0 auto; }
.m3-footer__bottom { text-align: center; padding-top: 32px; margin-top: 32px; border-top: 1px solid var(--md-sys-color-outline-variant); font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); max-width: 1200px; margin-left: auto; margin-right: auto; }

@media (min-width: 600px) {
    .m3-page-container { padding: 24px; }
    .m3-post-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .m3-footer__grid { grid-template-columns: repeat(3, 1fr); }
    .m3-search-input.active { width: 280px; }
    .m3-header-pill { margin: 0 24px; top: 16px; }
    .m3-main { padding-top: 16px; }
}

@media (min-width: 900px) {
    .menu-toggle { display: none; }
    .m3-layout { grid-template-columns: 1fr 300px; }
    .m3-page-container { padding: 32px 24px; }
    .m3-sticky-actions { bottom: 24px; }
}

@media (min-width: 1200px) {
    .m3-layout { grid-template-columns: 1fr 350px; }
}

@media print {
    .m3-header-pill, .m3-footer-card, .m3-sticky-actions, .m3-chat-comments, .m3-sidebar, .m3-pagination { display: none !important; }
    body { background: #fff; color: #000; }
    .m3-single-content { font-size: 12pt; }
    a { color: #000; text-decoration: underline; }
}