/* Continuous mobile-first corrections. No global overflow clipping. */
@media (max-width:1100px) {
    .nd-article-layout { grid-template-columns:minmax(170px,205px) minmax(0,720px); gap:24px; }
    .nd-article-layout .nd-reading-shell { grid-column:2; }
}

@media (max-width:900px) {
    .nd-article-layout { display:block; width:var(--nd-reading); }
    .nd-article-layout .nd-reading-shell { width:100%; }
    .nd-toc-shell { position:fixed; z-index:180; right:max(12px,env(safe-area-inset-right)); bottom:max(14px,calc(env(safe-area-inset-bottom) + 8px)); top:auto; padding:0; }
    .nd-toc-trigger { width:52px; height:52px; min-height:52px; padding:0; justify-content:center; border-radius:17px; box-shadow:var(--nd-shadow); backdrop-filter:blur(22px); -webkit-backdrop-filter:blur(22px); }
    .nd-toc-trigger span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
    .nd-toc-trigger i { font-size:1.18rem; }
    .nd-toc-panel { position:absolute; right:0; bottom:calc(100% + 10px); width:min(340px,calc(100vw - 24px)); max-height:min(68dvh,560px); margin:0; transform:translateY(12px) scale(.97); transform-origin:bottom right; }
    .nd-toc-shell.is-open .nd-toc-panel { max-height:min(68dvh,560px); padding:16px; transform:none; box-shadow:var(--nd-shadow); }
    .nd-toc-panel nav { max-height:calc(min(68dvh,560px) - 62px); }
}

@media (max-width:768px) {
    .nd-header-inner { width:calc(100% - 24px); }
    .nd-section,.nd-hero,.nd-footer { width:calc(100% - 24px); }
    .nd-section { padding-top:clamp(48px,10vw,76px); }
    .nd-section-head { margin-bottom:30px; }
    .nd-search-panel { width:calc(100% - 16px); }
    .nd-search-form { grid-template-columns:auto minmax(0,1fr) auto; }
    .nd-search-submit { grid-column:1/-1; width:100%; }
    .nd-frozen-warning>div { width:calc(100% - 24px); align-items:flex-start; flex-direction:column; gap:1px; padding:10px 0; }
    .nd-frozen-warning span { padding:2px 0; }
    .nd-appearance { top:72px; right:12px; }
    .nd-card p,.nd-search-result p { overflow-wrap:anywhere; }
    .nd-read-next h2 { padding-right:24px; }
}

@media (max-width:430px) {
    :root { --nd-content:calc(100% - 20px); --nd-reading:calc(100% - 20px); }
    .nd-header-inner { width:calc(100% - 20px); gap:7px; }
    .nd-header-actions { gap:5px; }
    .nd-icon-button { width:39px; height:39px; }
    .nd-menu-button { height:39px; padding:0 11px; }
    .nd-menu-button span { font-size:.67rem; }
    .nd-brand small { display:none; }
    .nd-mobile-nav { inset-inline:6px; padding:13px; }
    .nd-search-panel { top:calc(100% + 5px); width:calc(100% - 10px); padding:10px; border-radius:16px; }
    .nd-search-form { gap:7px; }
    .nd-search-form input { height:44px; font-size:.9rem; }
    .nd-search-clear { padding:0 10px; }
    .nd-search-hint { overflow-wrap:anywhere; }
    .nd-appearance { top:67px; right:5px; width:calc(100% - 10px); }
    .nd-hero { padding-top:48px; }
    .nd-hero h1 { font-size:clamp(2.7rem,13vw,3.8rem); }
    .nd-brand-slogan { letter-spacing:.14em; }
    .nd-card,.nd-fragment { padding:18px; }
    .nd-card-meta { margin-bottom:19px; }
    .nd-year { gap:12px; padding:28px 0; }
    .nd-month { grid-template-columns:48px minmax(0,1fr); gap:10px; }
    .nd-time-entry { gap:8px; }
    .nd-asset-panel { min-height:260px; }
    .nd-about-grid { min-width:0; }
    .nd-article-actions { align-items:stretch; }
    .nd-article-actions a { justify-content:center; flex:1; min-width:0; text-align:center; }
    .nd-article-head h1 { font-size:clamp(1.9rem,8.2vw,2.35rem); line-height:1.13; letter-spacing:-.025em; }
    .nd-article-head h1.is-cjk { font-size:clamp(1.82rem,7.6vw,2.2rem); line-height:1.2; letter-spacing:0; }
    .nd-read-next>a { border-radius:var(--nd-r-md); }
    .nd-read-next-meta { padding-right:20px; }
    .nd-restricted-actions { display:grid; }
    .nd-restricted-actions a,.nd-restricted-actions button { justify-content:center; width:100%; }
    .nd-footer { margin-top:72px; }
}

@media (max-width:360px) {
    :root { --nd-content:calc(100% - 14px); --nd-reading:calc(100% - 14px); }
    .nd-header-inner { width:calc(100% - 14px); }
    .nd-menu-button span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
    .nd-menu-button { width:39px; padding:0; justify-content:center; }
    .nd-mobile-nav nav { grid-template-columns:1fr; }
    .nd-search-panel { width:calc(100% - 6px); }
    .nd-search-form>svg { display:none; }
    .nd-search-form { grid-template-columns:minmax(0,1fr) auto; }
    .nd-search-submit { grid-column:1/-1; }
    .nd-hero-index { flex-wrap:wrap; }
    .nd-list-item { grid-template-columns:64px minmax(0,1fr); gap:8px; }
    .nd-fragment,.nd-card { border-radius:17px; }
    .nd-toc-panel { width:calc(100vw - 14px); }
    .nd-article-body { font-size:.96rem; }
    .nd-article-body pre { padding-inline:11px; }
}

@media (max-width:320px) {
    .nd-header-actions { gap:3px; }
    .nd-icon-button,.nd-menu-button { width:37px; height:37px; }
    .nd-brand span { font-size:1.08rem; }
    .nd-search-clear { font-size:.63rem; padding-inline:8px; }
    .nd-section-head h1 { font-size:clamp(1.9rem,10vw,2.2rem); }
    .nd-article-actions { flex-direction:column; }
    .nd-toc-trigger { width:49px; height:49px; min-height:49px; }
}

@media (max-height:540px) and (orientation:landscape) {
    .nd-mobile-nav,.nd-search-panel,.nd-appearance { max-height:calc(100dvh - 72px); overflow:auto; }
    .nd-toc-panel { max-height:calc(100dvh - 82px); }
    .nd-toc-panel nav { max-height:calc(100dvh - 145px); }
    .nd-hero { padding-top:34px; }
}

@media (max-width:900px) {
    .nd-toc-shell:not(.is-open) .nd-toc-panel { max-height:0; padding-block:0; visibility:hidden; pointer-events:none; }
}
