/* Studio / paper, pigment, and precise working space. */
:root {
  --paper: #f4f1eb; --paper-2: #eae5dc;
  --card: #fffcf7; --card-2: #f2eee6;
  --ink: #242920; --ink-2: #596052; --ink-3: #646b5c; --ink-4: #646b5c;
  --line: #deddd2; --line-2: #c5c8b9;
  --clay: #b74e30; --clay-deep: #a84328; --clay-soft: #b74e300d; --clay-line: #b74e3040;
  --clay-ink: #fffaf2; --ok: #48694c;
  --r-lg: 16px; --r: 12px; --r-sm: 8px;
}
[data-theme="dark"] {
  --paper: #181c18; --paper-2: #202620; --card: #222821; --card-2: #2b3229;
  --ink: #efeee4; --ink-2: #c0c5b6; --ink-3: #a1aa97; --ink-4: #8e9885;
  --line: #374032; --line-2: #59634f;
  --clay: #e69a79; --clay-deep: #f0ad8f; --clay-soft: #e69a7915; --clay-line: #e69a7945; --clay-ink: #20251c;
}
::selection { color: var(--ink); background: var(--clay-line); }
body { letter-spacing: 0; }
button { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--clay); outline-offset: 4px;
}
button:disabled { cursor: wait; }
.topbar {
  padding: 18px clamp(20px, 4vw, 56px); gap: 24px;
  border-bottom: 1px solid var(--line); box-shadow: none;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}
.brand { gap: 11px; font-size: 19px; letter-spacing: -.04em; white-space: nowrap; }
.brand-mark { width: 33px; height: 33px; border-radius: 9px; background: var(--clay); box-shadow: none; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .12em; }
.top-nav { margin: 0; padding: 0; gap: 4px; animation: none; }
.nav-link { padding: 9px 17px; font-size: 13px; border-radius: 7px; color: var(--ink-2); }
.nav-link.active { background: var(--ink); color: var(--paper); }
.nav-link:hover { transform: none; background: var(--card-2); color: var(--ink); }
.nav-link.active:hover { background: var(--ink); color: var(--paper); }
.theme-switch { box-shadow: none; }
.hero {
  scroll-margin-top: 90px;
  max-width: 1360px; margin: 0 auto; padding: 34px 40px 32px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
  text-align: left; animation: studio-arrive .65s var(--ease) both;
}
.studio-eyebrow { display: block; font: 500 10px/1.5 'Inter', sans-serif; letter-spacing: .18em; color: var(--ink-3); }
.hero h1 { font-size: clamp(32px, 4.2vw, 52px); line-height: 1.25; font-weight: 600; letter-spacing: -.06em; margin: 10px 0 0; }
.hero h1 .clay { font-style: normal; }
.hero p { margin: 0 0 3px; max-width: none; font-size: 12.5px; line-height: 1.9; color: var(--ink-2); }
.workspace {
  max-width: 1360px; grid-template-columns: 380px minmax(0, 1fr); align-items: start;
  gap: 32px; padding: 0 40px 56px; opacity: 1; animation: studio-arrive .65s var(--ease) .08s both;
  scroll-margin-top: 96px;
}
.compose {
  padding: 22px; gap: 18px; border-radius: 14px;
  background: var(--card); box-shadow: 0 2px 3px #24292003; top: 94px;
}
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; font-size: 12px; font-weight: 600; }
.panel-heading > span:first-child { white-space: nowrap; }
.panel-heading b { font: 11px/1 'Inter', sans-serif; color: var(--clay); padding-right: 9px; }
.panel-aside { color: var(--ink-3); font: 9px/1.5 'Inter', sans-serif; letter-spacing: .1em; text-align: right; }
.compose > .panel-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-heading .chat-fab { position: static; width: auto; height: auto; min-height: 24px; padding: 2px 0 2px 8px; display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--ink-3); border: 0; border-radius: 4px; box-shadow: none; font-size: 11px; transform: none; }
.panel-heading .chat-fab::after { content: '创作助手'; }
.panel-heading .chat-fab svg { width: 14px; height: 14px; }
.panel-heading .chat-fab:hover { color: var(--clay); transform: none; }
.field { gap: 9px; min-width: 0; }
.field-label { font-size: 12px; color: var(--ink-2); }
.field-aside { font-size: 10px; font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg { border: 1px solid var(--line); padding: 3px; border-radius: 8px; background: var(--paper); }
.seg button { padding: 8px; font-size: 12px; }
.seg-thumb { top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 5px; }
.prompt-wrap { border-color: var(--line); background: var(--paper); border-radius: 9px; }
.prompt-wrap textarea { min-height: 114px; font-size: 14px; padding: 13px 14px; line-height: 1.8; }
.prompt-wrap:focus-within { background: var(--card); border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.prompt-footnote { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; color: var(--ink-3); font-size: 10px; }
.prompt-footnote kbd { font: inherit; white-space: nowrap; }
.model-picker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.model-picker summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 14px 0; list-style: none; font-size: 12px; }
.model-picker summary::-webkit-details-marker { display: none; }
.model-picker summary > span:first-child { color: var(--ink-2); }
.model-picker summary strong { margin-left: auto; max-width: 66%; font-weight: 500; font-size: 11.5px; text-align: right; }
.picker-chevron { font-size: 18px; color: var(--ink-3); line-height: 1; transition: transform .2s ease; }
.model-picker[open] .picker-chevron { transform: rotate(180deg); }
.model-picker[hidden] { display: none; }
.output-picker { border-top: 0; margin-top: -7px; }
.output-picker summary { padding-top: 5px; }
.inline-error:empty { display: none; }
.model-picker-body { display: flex; flex-direction: column; gap: 18px; padding: 3px 0 18px; animation: studio-arrive .25s ease; }
.model-picker #siteHint { font-size: 11px !important; margin-top: 2px !important; line-height: 1.8 !important; }
.chips { gap: 6px; }
.chip { border-radius: 7px; padding: 8px 12px; min-height: 34px; font-size: 11.5px; border: 1px solid var(--line); background: transparent; }
.chip:hover { background: var(--paper); border-color: var(--line-2); transform: translateY(-1px); }
.chip.active { background: var(--clay-soft); border-color: var(--clay); color: var(--clay-deep); }
#sizeButtons .chip, #resolutionButtons .chip { flex: 1; justify-content: center; }
#qualityButtons .chip { flex: 1; justify-content: center; padding-inline: 8px; white-space: nowrap; }
.btn-generate { min-height: 48px; padding: 13px 17px; background: var(--ink); color: var(--paper); border-radius: 9px; font-size: 14px; box-shadow: none; gap: 14px; justify-content: space-between; }
.btn-generate:hover:not(:disabled) { background: var(--clay); color: var(--clay-ink); box-shadow: 0 5px 14px #b74e3020; transform: translateY(-1px); }
.btn-generate:active:not(:disabled) { transform: translateY(1px); }
.btn-generate .cost-tag { color: inherit; background: #ffffff12; border: 1px solid #ffffff20; border-radius: 5px; font-size: 11px; }
.reuse-context { display: flex; gap: 12px; padding: 12px; border-left: 2px solid var(--clay); background: var(--clay-soft); border-radius: 0 7px 7px 0; }
.reuse-context[hidden] { display: none; }
.reuse-context strong { display: block; font-size: 12px; color: var(--ink); }
.reuse-context p { margin-top: 5px; font-size: 11px; line-height: 1.8; color: var(--ink-2); }
.reuse-context button { flex-shrink: 0; align-self: flex-start; padding: 4px 5px; color: var(--clay-deep); font-size: 11px; border: 0; background: none; cursor: pointer; }
.gallery { gap: 20px; min-width: 0; }
.canvas-heading { min-height: 23px; margin: 0 1px 0; }
.spotlight { min-height: 470px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-2); box-shadow: none; overflow: hidden; }
.spotlight::after { display: none; }
.studio-empty { width: 100%; max-width: none; padding: 10px 24px 28px; }
.studio-art { position: relative; max-width: 500px; margin: 0 auto 23px; }
.studio-art img { display: block; width: 100%; height: auto; max-height: 330px; object-fit: contain; animation: paper-settle 1.1s var(--ease) both; }
.art-caption { display: block; font: 8px/1.5 'Inter', sans-serif; letter-spacing: .19em; color: var(--ink-3); }
.empty-title { font-size: clamp(17px, 1.8vw, 22px); letter-spacing: -.025em; margin-bottom: 10px; }
.empty-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 18px; }
.prompt-chip { font-size: 11px; border-color: var(--line-2); padding: 8px 12px; background: transparent; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; }
.prompt-chip:hover { background: var(--card); border-color: var(--clay); }
.prompt-chip svg { width: 12px; height: 12px; }
.spotlight-img { object-fit: contain; width: 100%; max-height: 650px; animation: studio-arrive .5s var(--ease); }
.spotlight:has(.spotlight-img), .spotlight:has(.spotlight-video) { min-height: 0; }
.image-actions { position: relative; inset: auto; transform: none; width: max-content; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; padding: 8px; margin: 12px; gap: 7px; border-radius: 9px; box-shadow: none; opacity: 1; animation: none; }
.action-btn { border-radius: 7px; min-height: 36px; font-size: 12px; }
.action-primary { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.history { scroll-margin-top: 100px; }
.history-head { border-bottom: 1px solid var(--line); padding-bottom: 13px; margin-bottom: 14px; }
.history-head .t { font-size: 15px; }
.history-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
.history-item { border-radius: 8px; box-shadow: none; }
.history-item:hover { transform: translateY(-2px); }
.history-item:focus-within { outline: 2px solid var(--clay); outline-offset: 2px; }
.history-item img:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.hitem-model { font-size: 9px; padding: 5px 7px; backdrop-filter: blur(12px); }
.hitem-copy { width: 32px; height: 32px; }
.task-queue { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--card); }
.task-queue-item { box-shadow: none; }
.gallery-section { max-width: 1360px; margin: 0 auto 54px; padding: 0 40px; scroll-margin-top: 88px; }
.gallery-head { border-top: 1px solid var(--line-2); padding: 32px 0 25px; display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; text-align: left; }
.gallery-head h2 { margin: 10px 0 0; font-size: 30px; letter-spacing: -.04em; font-weight: 500; }
.gallery-head p { font-size: 12px; line-height: 1.8; }
.gallery-grid { column-gap: 16px; }
.gallery-card { border: 1px solid var(--line); border-radius: 9px; box-shadow: none; }
.gallery-card:hover, .gallery-card.is-enter:hover { box-shadow: 0 7px 22px #24292012; transform: translateY(-3px); }
.gallery-card-author { padding: 11px 13px; font-size: 11px; }
.gallery-card-copy-btn { min-width: 32px; min-height: 32px; }
.site-footer { max-width: 1280px; margin: 0 auto; padding: 25px 0 34px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; font-size: 11px; color: var(--ink-3); text-align: left; }
.site-footer i { color: var(--clay); margin-inline: 8px; font-style: normal; }
/* A consistent viewing surface, with creation actions kept close to the image. */
body.artwork-open { overflow: hidden; }
#lightbox { background: #151c18f5; padding: 64px 24px 28px; gap: 0; }
#lightbox .lightbox-card { flex-shrink: 0; width: min(100%, 850px); max-width: 100%; background: #242a25 !important; border-color: #ffffff17 !important; box-shadow: 0 20px 70px #0003; border-radius: 12px; }
#lightbox img { max-width: 100%; width: 100%; max-height: 58vh; min-height: 0; object-fit: contain; background: #131914; border-radius: 0; box-shadow: none; }
#lightbox .lightbox-meta { padding: 13px 18px 9px; }
#lightbox .lightbox-meta-tag { font-size: 10px; padding: 4px 8px; }
#lightboxPrompt { padding: 14px 18px !important; max-height: 140px; overflow-y: auto; white-space: pre-wrap; font-size: 12px !important; }
.lightbox-actions { max-width: 850px; gap: 8px; margin-top: 18px; }
.lightbox-btn { border-radius: 7px; font-size: 12px; padding: 11px 15px; min-height: 42px; border-color: #ffffff24; background: #ffffff09; }
.lightbox-btn:hover { transform: translateY(-1px); }
.lightbox-btn.lightbox-primary { background: #f0e9dc; color: #273024; border-color: #f0e9dc; }
.lightbox-btn.lightbox-primary:hover { background: #fff9ed; }
.lightbox-primary span { margin-left: 10px; }
#lightbox .gallery-publish-btn { color: #dfaf94 !important; border-color: #ffffff24 !important; }
.lightbox-btn:disabled { opacity: .6; }
#galleryLightbox .lightbox-card { border-radius: 12px; }
.lightbox-card-action { border-radius: 7px; }
.chat-fab { width: 45px; height: 45px; right: 22px; bottom: 22px; box-shadow: 0 4px 14px #24292020; }
.mobile-generate-dock { display: none; }
.toast { max-width: min(520px, calc(100vw - 32px)); white-space: normal; text-align: center; border-radius: 9px; line-height: 1.65; font-size: 12px; }
[data-theme="dark"] .studio-art img { filter: brightness(.85) saturate(.8); }
[data-theme="dark"] .spotlight { background: #293027; }
@keyframes studio-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes paper-settle { from { opacity: 0; transform: translateY(12px) rotate(2deg); } to { opacity: 1; transform: none; } }
@media (min-width: 1600px) { .workspace { grid-template-columns: 400px minmax(0, 1fr); gap: 40px; } .spotlight { min-height: 540px; } }
@media (max-width: 1050px) {
  .brand-sub { display: none; }
  .workspace { grid-template-columns: 350px minmax(0, 1fr); gap: 22px; padding-inline: 24px; }
  .hero, .gallery-section { padding-inline: 24px; }
  .hero p { font-size: 11px; }
  .compose { padding: 18px; }
  .panel-aside { font-size: 8px; }
  .studio-empty { padding-inline: 16px; }
  .studio-art { margin-bottom: 20px; }
  .spotlight { min-height: 435px; }
  .site-footer { margin-inline: 24px; }
}
@media (max-width: 800px) {
  .hero { scroll-margin-top: 124px; }
  .topbar { flex-wrap: wrap; gap: 15px; padding: 14px 20px 10px; }
  .top-nav { order: 3; flex-basis: 100%; justify-content: center; gap: 8px; }
  .nav-link { flex: 1; max-width: 160px; padding: 8px 12px; }
  .top-actions { margin-left: auto; gap: 9px; }
  .hero { padding: 26px 20px 24px; gap: 12px; }
  .hero h1 { font-size: 36px; margin-top: 8px; }
  .hero p { max-width: 205px; font-size: 11px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 30px; padding: 0 20px 38px; scroll-margin-top: 125px; }
  .compose { position: static; padding: 20px; gap: 18px; }
  .compose .panel-aside { font-size: 9px; }
  .model-picker summary strong { max-width: 64%; }
  .prompt-wrap textarea { font-size: 16px; min-height: 120px; }
  .chip { min-height: 40px; font-size: 12px; }
  .seg button { padding: 10px; }
  .prompt-footnote kbd { display: none; }
  .btn-generate { min-height: 50px; }
  .mobile-generate-dock:not([hidden]) { position: fixed; bottom: 0; left: 0; right: 0; z-index: 340; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 25px #24292008; }
  .mobile-generate-dock > span { color: var(--ink-3); font-size: 11px; }
  .mobile-generate-dock button { border: 0; border-radius: 8px; background: var(--ink); color: var(--paper); font-family: inherit; font-size: 13px; font-weight: 500; padding: 12px 20px; min-width: 190px; min-height: 44px; cursor: pointer; }
  body.artwork-open .mobile-generate-dock, body:has(.modal-overlay.show) .mobile-generate-dock, body:has(.mask-editor-overlay.show) .mobile-generate-dock { display: none; }
  body:has(.mobile-generate-dock:not([hidden])) .float-progress { bottom: 88px; }
  .canvas-heading { margin: 0; }
  .spotlight { min-height: 0; }
  .image-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: calc(100% - 24px); }
  .image-actions .action-btn { justify-content: center; padding: 10px 9px; }
  .studio-art { max-width: 440px; }
  .studio-empty { padding: 6px 18px 26px; }
  .empty-title { font-size: 20px; }
  .gallery { gap: 16px; }
  .history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hitem-del { opacity: 1; }
  .hitem-copy { width: 36px; height: 36px; }
  .hitem-model { max-width: calc(100% - 53px); }
  .gallery-section { padding-inline: 20px; margin-bottom: 35px; }
  .gallery-head { padding: 26px 0 22px; }
  .gallery-head h2 { font-size: 26px; }
  .gallery-head p { max-width: 160px; font-size: 11px; }
  .site-footer { margin-inline: 20px; padding-bottom: 80px; }
  #lightbox { padding: 62px 14px 22px; }
  #lightbox img { max-height: 49dvh; }
  .lightbox-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lightbox-btn { justify-content: center; font-size: 12px; padding: 11px 9px; }
  #lightbox .lightbox-close { top: 14px; right: 14px; width: 38px; height: 38px; }
  .lightbox-btn.lightbox-primary { grid-column: 1 / -1; }
  .lightbox-primary span { margin-left: 8px; }
  .reuse-context button { min-width: 40px; min-height: 40px; }
}
@media (max-width: 480px) {
  .hero { align-items: flex-start; flex-direction: column; gap: 10px; padding-top: 22px; }
  .hero h1 { font-size: 36px; }
  .hero p { max-width: none; font-size: 11px; }
  .hero p br { display: none; }
  .studio-eyebrow { font-size: 9px; }
  .topbar { padding-inline: 16px; }
  .top-actions .btn { padding: 7px 12px; font-size: 12px; }
  .chip-bal { font-size: 11px; }
  .chip-avatar { display: none; }
  .theme-switch { transform: scale(.9); transform-origin: right center; }
  .hero, .workspace, .gallery-section { padding-left: 16px; padding-right: 16px; }
  .compose { padding: 18px; }
  .panel-aside { font-size: 8px; letter-spacing: .07em; }
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-head { display: block; }
  .gallery-head p { max-width: none; margin-top: 12px; }
  .studio-art { margin-bottom: 20px; }
  .empty-title { font-size: 18px; }
  .empty-sub { font-size: 11px; }
  .prompt-chips { gap: 6px; }
  .prompt-chip { padding: 9px; font-size: 10px; }
  .site-footer { display: block; margin-inline: 16px; }
  .site-footer > span { display: block; }
  .site-footer > span + span { margin-top: 10px; }
}
@media (max-width: 360px) {
  .topbar { gap: 10px; }
  .brand { font-size: 16px; gap: 6px; }
  .brand-mark { width: 28px; height: 28px; }
  .user-chip { gap: 5px; }
  .top-actions { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .hero, .workspace, .gallery-card { opacity: 1; transform: none; }
}

/* Shared suite controls */
/* Same control geometry across the suite; keyboard focus stays visible. */
html { -webkit-tap-highlight-color: transparent; }
:where(a,button,input,textarea,select,summary,label,[role="button"],[tabindex]) { -webkit-tap-highlight-color: transparent; }
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible,[role="button"]:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--clay,#ac492e); outline-offset:4px; }
:where(button,summary,[role="button"]):active { filter:brightness(.96); }
.theme-switch { position:relative; width:46px; min-width:46px; height:30px; min-height:30px; padding:0; display:inline-grid; place-items:center; border:1px solid var(--line,#dddfd4); border-radius:999px; background:var(--card,var(--panel,#fffdf8)); color:var(--ink); cursor:pointer; flex-shrink:0; transform:none; box-shadow:none; }
.theme-switch::after { content:""; position:absolute; inset:-7px 0; }
.theme-switch-track { position:relative; display:block; width:40px; height:22px; }
.theme-switch-thumb { position:absolute; left:0; top:0; width:22px; height:22px; border-radius:50%; display:grid; place-items:center; background:var(--paper,var(--bg,#f4f2ec)); color:var(--clay,#ac492e); box-shadow:0 2px 6px #1d302016; transition:transform .35s cubic-bezier(.32,.72,0,1),background .25s; }
.theme-switch svg { grid-area:1/1; width:13px; height:13px; transition:opacity .2s,transform .3s; }
.theme-switch .moon { opacity:0; transform:rotate(-25deg) scale(.78); }
.theme-switch[data-theme="dark"] .theme-switch-thumb { transform:translateX(18px); }
.theme-switch[data-theme="dark"] .sun { opacity:0; transform:rotate(35deg) scale(.78); }
.theme-switch[data-theme="dark"] .moon { opacity:1; transform:none; }
.theme-switch:hover { border-color:var(--clay,#ac492e); }
@media(max-width:540px) { .theme-switch { width:40px; min-width:40px; height:28px; min-height:28px; }.theme-switch-track { width:34px; height:20px; }.theme-switch-thumb { width:20px; height:20px; }.theme-switch[data-theme="dark"] .theme-switch-thumb { transform:translateX(14px); } }
