/* Shared layout and behavior contracts; colors remain in tokens.css. */
[hidden] { display:none !important; }
:root { --site-header-height: 65px; --motion-panel:180ms; --motion-viewer:220ms; }
html { scrollbar-gutter:stable; }
body { overflow-wrap:break-word; }
button, a, summary, input, textarea, select { -webkit-tap-highlight-color:transparent; }
:focus-visible { outline:2px solid rgb(var(--rgb-primary)); outline-offset:3px; }
button:disabled, select:disabled { cursor:not-allowed; opacity:.65; }
.cg-nav-action { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:8px 12px; border-radius:var(--radius-md); font-size:14px; font-weight:500; white-space:nowrap; color:rgb(var(--rgb-text-secondary)); transition:background-color var(--transition-fast),color var(--transition-fast); }
.cg-nav-action:hover, .cg-nav-action[aria-current=page] { background:rgb(var(--rgb-surface-2)); color:rgb(var(--rgb-text-primary)); }
.cg-primary { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 16px; border-radius:var(--radius-md); background:rgb(var(--rgb-primary)); color:rgb(var(--rgb-primary-foreground)); font-size:14px; font-weight:600; transition:background-color var(--transition-fast); }
.cg-primary:hover { background:rgb(var(--rgb-primary-hover)); }
.cg-menu { position:absolute; right:0; top:calc(100% + 8px); z-index:60; width:256px; max-width:calc(100vw - 32px); max-height:calc(100dvh - var(--site-header-height) - 24px); overflow:auto; padding:8px; border:1px solid rgb(var(--rgb-border)); border-radius:var(--radius-lg); background:rgb(var(--rgb-surface)); box-shadow:var(--shadow-lg); }
.cg-menu a, .cg-menu button { width:100%; justify-content:flex-start; text-align:left; white-space:normal; }
.cg-preferences { padding:16px; }
.cg-preferences a.cg-nav-action { width:auto; flex:0 0 auto; }
.cg-select { display:block; width:100%; min-width:0; min-height:42px; padding:8px 10px; border:1px solid rgb(var(--rgb-border-strong)); border-radius:var(--radius-md); background:rgb(var(--rgb-surface)); color:rgb(var(--rgb-text-primary)); }
.cg-avatar { position:relative; display:inline-flex; flex-shrink:0; width:32px; height:32px; border-radius:50%; overflow:hidden; background:rgb(var(--rgb-primary) / .10); color:rgb(var(--rgb-primary)); }
.cg-avatar img,.cg-avatar>[data-avatar-fallback] { width:100%; height:100%; object-fit:cover; }
.cg-avatar>[data-avatar-fallback] { align-items:center; justify-content:center; font-weight:600; }
.cg-avatar>[data-avatar-fallback]:not(.hidden) { display:flex; }
.cg-avatar-sm { width:28px; height:28px; font-size:12px; }
.cg-avatar-lg { width:88px; height:88px; font-size:30px; }
.cg-identity { display:inline-flex; align-items:center; gap:8px; min-width:0; color:rgb(var(--rgb-text-primary)); border-radius:var(--radius-sm); }
a.cg-identity:hover { color:rgb(var(--rgb-primary)); }
.cg-feedback { position:fixed; z-index:100; bottom:24px; left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100vw - 32px); padding:12px 18px; border:1px solid rgb(var(--rgb-border)); border-radius:var(--radius-lg); background:rgb(var(--rgb-surface)); color:rgb(var(--rgb-text-primary)); box-shadow:var(--shadow-lg); font-size:14px; }
.cg-copy-buffer { position:fixed; left:-10000px; top:0; }
/* 全站敏感内容偏好只改变呈现；详情页的显式局部状态拥有更高优先级。 */
body.show-nsfw [data-nsfw-container]:not([data-nsfw-revealed]) [data-nsfw-media],
[data-nsfw-container][data-nsfw-revealed="true"] [data-nsfw-media] { filter:none !important; transform:none; }
[data-nsfw-container][data-nsfw-revealed="false"] [data-nsfw-media] { filter:blur(26px) !important; transform:scale(1.025); }
.htmx-indicator { opacity:0; }
.htmx-request .htmx-indicator,.htmx-request.htmx-indicator { display:block; opacity:1; }
html[data-motion=off] *,html[data-motion=off] *::before,html[data-motion=off] *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
html[data-motion=reduced] *,html[data-motion=reduced] *::before,html[data-motion=reduced] *::after { animation:none !important; transition-duration:0s !important; scroll-behavior:auto !important; }
html[data-motion=reduced] .active\:scale-\[0\.98\]:active { transform:none !important; }
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
@media(max-width:639px) { .cg-nav-action { padding-left:8px; padding-right:8px; } }
