/* Site chrome uses semantic colors. Uploaded artwork and game canvases retain
   their authored palette; they are never inverted or recolored by filters.
   The neutrals are warm (a faint stone tint, never blue-grey) so the chrome
   stays quiet and the covers carry the color. */
:root {
  --bg:#ffffff;--surface:#fff;--surface-raised:#fff;--surface-hover:#e9e8e3;
  --text:#111111;--text-secondary:#62625b;--text-tertiary:#73726c;
  --border:#dad9d3;--line:#ebeae5;--soft:#f1f0ec;
  --primary:#111111;--on-primary:#fff;--primary-hover:#35342f;
  --accent:#a75a45;--focus:#527b8c;
  --success:#386b52;--success-bg:#edf5ef;--danger:#a54c40;--danger-bg:#fbefec;
  --warning:#8a6634;--warning-bg:#faf3e7;
  --muted:var(--text-secondary);--ink:var(--text);
  --shadow-popover:0 4px 12px #1c1b1b06,0 16px 48px #1c1b1b12;
  --header-bg:#ffffffec;--skeleton:#efeee9;--skeleton-sheen:#ffffffa8;
  --focus-ring:#62899b20;--backdrop:#1c1b1b5c;
  color:var(--text);background:var(--bg);color-scheme:light;
}
:root[data-theme="dark"] {
  --bg:#121211;--surface:#1c1b1a;--surface-raised:#252423;--surface-hover:#2e2d2b;
  --text:#f5f4ef;--text-secondary:#b8b6af;--text-tertiary:#96948d;
  --border:#3d3c39;--line:#2e2d2b;--soft:#232220;
  --primary:#f5f4ef;--on-primary:#111111;--primary-hover:#fff;
  --accent:#e6a088;--focus:#9bbdce;
  --success:#a2c9af;--success-bg:#22392c;--danger:#efac9e;--danger-bg:#3a2828;
  --warning:#dcc292;--warning-bg:#382f24;
  --shadow-popover:0 8px 20px #0004,0 20px 54px #0005;
  --header-bg:#121211eb;--skeleton:#2a2927;--skeleton-sheen:#ffffff0a;
  --focus-ring:#9bbdce25;--backdrop:#0a0a09b3;
  color-scheme:dark;
}
html,body{background:var(--bg);color:var(--text)}
::selection{background:var(--primary);color:var(--on-primary)}
button,input,textarea,select,.button{background:var(--surface);border-color:var(--border);color:var(--text)}
input::placeholder,textarea::placeholder{color:var(--text-tertiary);opacity:1}
input[type="checkbox"],input[type="radio"],progress{accent-color:var(--primary)}
input[type="file"]::file-selector-button{background:var(--surface);color:var(--text);border-color:var(--border)}
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus,textarea:focus,select:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--focus-ring)}
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible,[tabindex]:focus-visible,.work-entry:focus-visible{outline-color:var(--focus)}
.button.primary,.auth-button{background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
.button.primary:hover:not(:disabled),.auth-button:hover{background:var(--primary-hover);border-color:var(--primary-hover);color:var(--on-primary)}
.button.quiet,.locale-toggle,.work-actions button,.discussion-jump,.comment-meta button,.comment-like,.reply-target button,.replies-more,.share-close,.order-chip button,.feed-controls select{background:transparent}
.button:not(.primary):not(:disabled):hover,.button.quiet:hover,.locale-toggle:hover,.work-actions button:hover,.work-comment-count:hover,.discussion-jump:hover{background:var(--surface-hover);border-color:var(--border);color:var(--text)}
.button.quiet:hover{border-color:transparent}
.site-header{background:var(--header-bg);border-color:var(--line)}
.site-header nav a,.locale-toggle,.back,.creator-link,.feed-grid .creator-link,.feed-grid .work-actions button,.feed-grid .work-comment-count,.work-actions button,.discussion-jump,.row-actions .button{color:var(--text-secondary)}
.site-header nav a.active,.site-header nav a:hover,.back:hover,.creator-link:hover,.work-entry:hover .tile-title,.feed-grid .work-entry:hover .tile-title,.related-work:hover strong,.detail-author:hover,.comment-byline a:hover,.comment-meta button:hover{color:var(--text)}
.site-header nav a.active:after,.nav-indicator.line{background:var(--text)}
.nav-indicator.pill{background:var(--soft)}
.avatar,.large-avatar,.comment-avatar,.author-badge{background:var(--soft);color:var(--text-secondary)}
.account-options,.action-menu-panel,.share-dialog,.version-preview-dialog{background:var(--surface-raised);border-color:var(--border);color:var(--text);box-shadow:var(--shadow-popover)}
.share-box input{background:var(--surface);color:var(--text)}
.share-dialog::backdrop,.version-preview-dialog::backdrop{background:var(--backdrop)}
.share-dialog p,.share-dialog .share-item-title,.share-close,.detail-description,.detail-meta,.tile-desc,.work-row p,.stat dt,.stat small,.data-note,.feedback-record header,.field>label,.field>legend,.file-selected,.sample-links,.steps span,.select-work .select-copy small,.template-copy p,.empty-state p,.illustrated-empty p,.creator-card p,.author-heading p,.work-facts dd,.comment-body,.comment-status,.personalization>summary,.card-secondary>summary,.saved-label{color:var(--text-secondary)}
.illustrated-empty h2,.sign-in-copy h1,.steps span.active{color:var(--text)}
.composer-main,.comments-more,.comments-retry,.build-panel,.cover-picker,.import-availability-panel,.work-edit-cover,.empty-state{background:var(--soft);border-color:var(--border)}
.comment-composer textarea{background:transparent}
.filter,.feed-controls .filter,.feed-controls select{color:var(--text-secondary)}
.filter.active,.feed-controls .filter.active,.studio-nav a.active{background:var(--soft);color:var(--text)}
.studio-nav a:not(.active):hover,.cards-nav a:not(.active):hover{background:var(--surface-hover);color:var(--text)}
.cards-nav a.active,.inbox-tabs a.active{color:var(--text);border-color:var(--text)}
.creator-card,.creator-covers,.image-placeholder,.work-edit-cover-preview{background:var(--soft);color:var(--text-secondary)}
.creator-card:hover{background:var(--surface-hover)}
.work-tile .cover,.detail-cover{background:var(--soft);border-color:var(--line)}
.feed-grid .cover{background:var(--feed-paper,var(--soft))}
.feed-grid .cover.empty-cover{background:var(--soft);color:var(--text-secondary)}
.work-tile .cover,.feed-grid .cover{outline-color:var(--line)}
.cover-action,.cover .tag{background:var(--surface-raised);color:var(--text);box-shadow:var(--shadow-popover)}
.work-actions button.liked,.feed-grid .work-actions button.liked,.comment-like.liked{color:var(--accent)}
.game-shell{background:var(--soft);border-color:var(--border)}
.game-tools,.game-result{background:var(--surface);border-color:var(--line);color:var(--text-secondary)}
.game-frame,.version-preview-dialog iframe{color-scheme:normal}
.related-work,.comment-thread{border-color:var(--line)}
.comment-highlight{background:var(--warning-bg);outline-color:var(--warning-bg)}
.data-table th,.data-table tbody tr:hover{background:var(--soft);color:var(--text-secondary)}
.segmented label,.field input,.field textarea,.profile-fields,.personalization,.card-preview,.select-work,.template{border-color:var(--border)}
.gallery-load-status{display:flex;align-items:center;justify-content:center;gap:12px;min-height:72px;padding:18px 24px;background:var(--surface);color:var(--text-secondary);font-size:13px;line-height:1.6;flex-wrap:wrap;text-align:center}
.gallery-load-status[data-state="timeout"]{color:var(--text)}
/* The lit city card has one look, so its stage is dark in either site theme:
   the frame before it paints, the loading strip, the retry button and the
   no-3D sample list share the card's own dark tokens. They are the card's
   palette, not the site's: the site's dark theme may change without touching
   them (a test pins them to CITY_STAGE). Keyed on the frame every city
   renderer emits; the rest of the page keeps following the site theme. */
.card-preview:has(>.gallery-frame[src*="/lit-city/"]) {
  --bg:#15191e;--surface:#1c2229;--surface-raised:#232b34;--surface-hover:#2b3540;
  --text:#ebeff3;--text-secondary:#b7c0cb;--text-tertiary:#94a0af;
  --border:#394450;--line:#303a45;--soft:#232c36;
  --primary:#e4ebf0;--on-primary:#1b242d;--primary-hover:#fff;
  --accent:#e6a088;--focus:#9bbdce;--focus-ring:#9bbdce25;
  --muted:var(--text-secondary);--ink:var(--text);
  --shadow-popover:0 8px 20px #0004,0 20px 54px #0005;
  background:var(--bg);color:var(--text);color-scheme:dark;
}
.card-preview:has(>.gallery-frame[src*="/lit-city/"])>.gallery-load-status{background:transparent}
/* Until the card's own document commits, the frame holds a blank light-scheme
   document. A frame whose colour scheme differs from its document's is painted
   opaque (white here), so the element stays light: the blank stays transparent
   and this dark background shows instead of a white flash, in either theme. */
.gallery-frame[src*="/lit-city/"]{background:#15191e;color-scheme:light}
.segmented label:has(input:checked){background:var(--soft);border-color:var(--text-secondary)}
.steps b,.order-chip{background:var(--soft);color:var(--text-secondary)}
.steps .active b{background:var(--primary);color:var(--on-primary)}
.select-work,.template{background:var(--surface)}
.select-work.selected,.template.selected{border-color:var(--focus);box-shadow:0 0 0 1px var(--focus)}
.select-work input{accent-color:var(--primary)}
.import-availability-panel>p{color:var(--text)}
.build-panel progress{accent-color:var(--focus)}
.version-conflict{background:var(--warning-bg);border-color:var(--border);color:var(--warning)}
.version-current-label,.version-notice{background:var(--success-bg);color:var(--success)}
.error-state{background:var(--danger-bg);color:var(--danger)}
.error-state p,.error,.auth-panel .auth-error{color:var(--danger)}
.feed-status{color:var(--danger)}
.success,.share-dialog .share-status.success{color:var(--success)}
.notice{background:var(--primary);color:var(--on-primary);box-shadow:var(--shadow-popover)}
.skip{background:var(--surface);color:var(--text)}
.route-skeleton i,.feed-skeleton .skeleton-work>div,.feed-skeleton .skeleton-work>span,.skeleton-work>div,.skeleton-work>span,.skeleton-work>small{background:var(--skeleton)}
.route-skeleton .skeleton-rule{background:var(--line)}
.route-skeleton .skeleton-picture::after,.feed-skeleton .skeleton-work>div::after{background:linear-gradient(100deg,transparent,var(--skeleton-sheen),transparent)}

/* Authored cards are displayed as objects, with their original paper/ink. */
.white-card{color:#252c34;--text:#252c34;--text-secondary:#5c6672;--text-tertiary:#687582;--soft:#efefeb;--line:#e4e1da}
.white-card .tile-title,.white-card .work-entry:hover .tile-title{color:#252c34}
.white-card .card-headline,.white-card .profile-website,.white-card .card-signature{color:#5c6672}
.sign-in-cover{border-color:var(--border);background:var(--surface-raised);box-shadow:0 3px 6px #00000008,0 18px 40px -15px #00000038}
:root[data-theme="dark"] .sign-in-cover{box-shadow:0 3px 8px #0003,0 18px 40px -15px #0009}
:root[data-theme="dark"] .sign-in-art svg>rect:first-child{fill:var(--soft)}

/* Small native disclosure: keyboard operable, no dialog or route interruption. */
.appearance-menu{position:relative;flex:none}
.appearance-menu>summary{display:grid;place-items:center;width:36px;height:36px;padding:0;border:0;border-radius:8px;list-style:none;cursor:pointer;color:var(--text-secondary);background:transparent}
.appearance-menu>summary::-webkit-details-marker{display:none}
.appearance-menu>summary:hover,.appearance-menu[open]>summary{background:var(--surface-hover);color:var(--text)}
.appearance-menu svg{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex:none}
.appearance-options{position:absolute;right:0;top:calc(100% + 10px);z-index:50;min-width:170px;padding:6px;border:1px solid var(--border);border-radius:12px;background:var(--surface-raised);box-shadow:var(--shadow-popover)}
.appearance-options>button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;min-height:40px;padding:9px 10px;text-align:left;font-size:13px;border-radius:7px;color:var(--text-secondary)}
.appearance-options>button:hover,.appearance-options>button[aria-pressed="true"]{background:var(--surface-hover);color:var(--text)}
.appearance-options svg{width:16px;height:16px}
.appearance-check{margin-left:auto;font-size:12px}
.auth-header-actions{display:flex;gap:12px;align-items:center}
.auth-header .appearance-options button{border:0;color:var(--text-secondary)}
.auth-header #auth-locale{border-color:var(--border);color:var(--text-secondary)}
.auth-panel{background:var(--surface);border-color:var(--border)}
.auth-panel p,.auth-back,.auth-loading{color:var(--text-secondary)}
.auth-back:hover{color:var(--text)}
.auth-button.secondary{background:var(--surface);color:var(--text-secondary);border-color:var(--border)}
.auth-button.secondary:hover{background:var(--surface-hover);color:var(--text)}
.auth-badge{background:var(--warning-bg);color:var(--warning);border-color:var(--border)}
.auth-loading:before{border-color:var(--border);border-top-color:var(--focus)}
/* Clerk's documented CSS variables update without remounting an in-progress
   sign-in form, so changing appearance never discards a typed address/code. */
.auth-component{
  --clerk-color-background:var(--surface);--clerk-color-foreground:var(--text);
  --clerk-color-muted:var(--soft);--clerk-color-muted-foreground:var(--text-secondary);
  --clerk-color-input:var(--surface);--clerk-color-input-foreground:var(--text);
  --clerk-color-primary:var(--primary);--clerk-color-primary-foreground:var(--on-primary);
  --clerk-color-neutral:var(--text);--clerk-color-border:var(--border);
  --clerk-color-ring:var(--focus);--clerk-color-danger:var(--danger);
  --clerk-color-success:var(--success);--clerk-color-warning:var(--warning);
  --clerk-color-modal-backdrop:var(--backdrop);--clerk-border-radius:.75rem;
}
/* Same-origin portfolio embeds share the stored preference and storage events.
   Only navigation, lists and fallback surfaces follow the site theme; canvas
   materials, lights, cover textures and the authored 3D stage stay untouched. */
[data-portfolio-embed] .details{background:var(--bg);border-color:var(--line)}
[data-portfolio-embed] .details>summary,[data-portfolio-embed] .work-heading,[data-portfolio-embed] .work small,[data-portfolio-embed] .work .arrow,[data-portfolio-embed] .current-work span,[data-portfolio-embed] .pager,[data-portfolio-embed] .keys,[data-portfolio-embed] #page-note,[data-portfolio-embed] #empty,[data-portfolio-embed] #headline,[data-portfolio-embed] #bio,[data-portfolio-embed] #website,[data-portfolio-embed] #signature{color:var(--text-secondary)}
[data-portfolio-embed] .work,[data-portfolio-embed] .paging button,[data-portfolio-embed] .room-nav button,[data-portfolio-embed] .hotspot,[data-portfolio-embed] .work-nav,[data-portfolio-embed] .hover-label{background:var(--surface-raised);border-color:var(--border);color:var(--text);box-shadow:var(--shadow-popover)}
[data-portfolio-embed] .work{box-shadow:none}
[data-portfolio-embed] .work:hover:not(:disabled),[data-portfolio-embed] .hotspot:hover,[data-portfolio-embed] .paging button:hover:not(:disabled),[data-portfolio-embed] .pager button:hover:not(:disabled),[data-portfolio-embed] .work-switch>button:hover:not(:disabled){background:var(--surface-hover);color:var(--text)}
[data-portfolio-embed] .hotspot.paper,[data-portfolio-embed] .play-current,[data-portfolio-embed] #hover-title{background:var(--primary);color:var(--on-primary)}
[data-portfolio-embed] .play-current:hover{background:var(--primary-hover)}
[data-portfolio-embed] .work-switch>button{background:transparent}
[data-portfolio-embed] .fallback{background:var(--bg);color:var(--text)}
[data-portfolio-embed] .fallback p{color:var(--text-secondary)}
@media(max-width:480px){
  .site-header{gap:10px;padding-inline:14px}.site-header nav{gap:12px}.site-header .brand{font-size:21px}
  .header-actions{gap:3px}.appearance-menu>summary{width:32px;height:36px}.locale-toggle{min-width:28px;padding-inline:3px}
  .site-header #identity .button{padding-inline:4px;font-size:11px}
  .appearance-options{min-width:158px}
}
@media(max-width:359px){.site-header{gap:7px;padding-inline:10px}.site-header nav{gap:8px;font-size:11px}.site-header .brand{font-size:19px}.appearance-menu>summary{width:28px}.locale-toggle{min-width:24px}.header-actions{gap:1px}}
@media(prefers-reduced-motion:no-preference){.appearance-options{animation:appearance-enter 150ms ease-out both}@keyframes appearance-enter{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}}

/* The search box sits in the header bar between the logo and the actions. */
.site-header .header-search{display:flex;align-items:center;gap:10px;flex:1 1 auto;max-width:560px;height:44px;margin:0 auto;padding:0 18px;border-radius:999px;background:var(--soft);color:var(--text-secondary);transition:background var(--motion-fast)}
.site-header .header-search:hover{background:var(--surface-hover)}
.site-header .header-search:focus-within{background:var(--surface);color:var(--text);box-shadow:0 0 0 1px var(--focus),0 0 0 4px var(--focus-ring)}
.site-header .header-search svg{width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;opacity:.85}
.site-header .header-search input{flex:1;min-width:0;height:100%;padding:0;border:0;border-radius:0;background:transparent;color:inherit;font-size:14px;outline:none;box-shadow:none}
.site-header .header-search input::placeholder{color:var(--text-tertiary)}
.site-header .header-search:focus-within input::placeholder{color:var(--text-tertiary)}
@media(max-width:720px){
  .site-header .header-search{display:none}
  /* On the Feed the search drops to a second row of the bar. */
  body:has(.discovery-page) .site-header{flex-wrap:wrap;height:auto;row-gap:10px;padding-top:11px;padding-bottom:12px}
  body:has(.discovery-page) .site-header .header-search{display:flex;order:3;flex:0 0 100%;max-width:none}
}

/* Empty states without art: one line and one way out on the page itself, no grey slab. */
.plain-empty{min-height:280px;background:none}
.discovery-page .empty-state .button{border-radius:999px;padding-inline:20px}
/* 加载更多 matches the sort button: a quiet filled pill. */
.discovery-page .feed-pagination>.button{height:40px;min-width:132px;border:0;border-radius:999px;background:var(--soft);color:var(--text);font-weight:600}
.discovery-page .feed-pagination>.button:not(:disabled):hover{border:0;background:var(--surface-hover)}

/* Feed categories are plain text tabs: the selected one is bold with a short ink underline
   (Pinterest). The sort button is a small quiet pill. */
.discovery-page .feed-toolbar .filters{gap:22px}
.discovery-page .filters .filter,.discovery-page .filters .filter.active{position:relative;display:inline-flex;align-items:center;min-height:40px;padding:8px 0;border:0;border-radius:0;background:none;color:var(--text-secondary);font-size:16px;font-weight:500}
.discovery-page .filters .filter:hover{background:none;color:var(--text)}
.discovery-page .filters .filter.active{color:var(--text);font-weight:650}
.discovery-page .filters .filter.active::after{content:"";position:absolute;left:0;right:0;bottom:1px;height:3px;border-radius:3px;background:var(--text)}
.discovery-page .feed-sort{margin-left:auto}
.discovery-page .feed-sort-menu>summary{min-width:0;height:36px;padding:0 12px 0 15px;border-radius:999px;gap:6px;border-color:transparent;background:var(--soft);font-size:13px;font-weight:650}
.discovery-page .feed-sort-menu>summary:hover,.discovery-page .feed-sort-menu[open]>summary{border-color:transparent;background:var(--surface-hover)}
@media(max-width:720px){
  .discovery-page .feed-toolbar .filters{gap:18px}
  .discovery-page .filters .filter,.discovery-page .filters .filter.active{font-size:15px}
  .discovery-page .feed-sort-menu>summary{padding:0 8px 0 10px}
  /* Chips that run under the sort button fade out, which says "scroll sideways". */
  .discovery-page .feed-toolbar .filters{-webkit-mask-image:linear-gradient(to right,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(to right,#000 calc(100% - 28px),transparent)}
}

/* Appearance and language sit in the footer for everyone. */
.site-information{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 24px}
.footer-preferences{display:flex;align-items:center;gap:4px}
.footer-preferences .appearance-menu>summary,.footer-preferences .locale-toggle{min-height:40px;min-width:40px;border-color:transparent;background:transparent;color:var(--text-secondary)}
.footer-preferences .appearance-menu>summary:hover,.footer-preferences .locale-toggle:hover{background:var(--surface-hover);color:var(--text)}
.footer-preferences .appearance-options{top:auto;bottom:calc(100% + 8px)}
