/* Youuay / Talk visual standard. Portable tokens come from @youuay/shared-theme. */
:root {
  color-scheme: dark;
  --font-display: var(--youuay-heading);
  --font-body: var(--youuay-body);
  --font-mono: var(--youuay-mono);
  --bg-base: var(--youuay-bg);
  --bg-primary: var(--youuay-bg);
  --bg-elevated: var(--youuay-surface);
  --bg-secondary: var(--youuay-surface);
  --bg-surface: var(--youuay-surface2);
  --bg-surface-hover: var(--youuay-surface2);
  --bg-muted: var(--youuay-bg);
  --text-primary: var(--youuay-text);
  --text-secondary: var(--youuay-muted);
  --text-tertiary: var(--youuay-muted);
  --red-vivid: var(--youuay-accent);
  --red-bright: var(--youuay-accent-text);
  --red-core: var(--youuay-accent);
  --border-subtle: var(--youuay-border);
  --border-default: var(--youuay-border-strong);
  --shadow-glow-red: none;
}
[data-theme="light"] {
  color-scheme: light;
  --bg-base: var(--youuay-bg);
  --bg-elevated: var(--youuay-surface);
  --bg-surface: var(--youuay-surface2);
  --bg-surface-hover: #e8e8e8;
  --bg-muted: var(--youuay-bg);
  --text-primary: var(--youuay-text);
  --text-secondary: var(--youuay-muted);
  --text-tertiary: var(--youuay-muted);
  --border-subtle: var(--youuay-border);
  --border-default: var(--youuay-border-strong);
}
body { background: var(--bg-base); font-family: var(--font-body); }
button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--red-bright); outline-offset: 4px;
}
button:disabled { cursor: not-allowed; }
.fs-skip { position: fixed; top: -100px; left: 16px; z-index: 20000; padding: 12px; background: var(--bg-elevated); color: var(--text-primary); }
.fs-skip:focus { top: 8px; }
.app-header {
  height: 80px; min-height: 80px; padding: 0 max(24px, calc((100vw - 1216px)/2));
  gap: 24px; flex-wrap: nowrap; background: var(--bg-base); z-index: 100;
}
.brand-svg-logo { width: 220px; max-width: 220px; height: 36px; }
.brand-container { flex-shrink: 0; }
.fs-desktop-nav, .fs-header-actions { display: flex; align-items: center; gap: 24px; }
.fs-desktop-nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 0; background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 500; cursor: pointer; }
.fs-desktop-nav svg { display: none; }
.fs-desktop-nav button.active { color: var(--text-primary); border-bottom-color: var(--red-vivid); }
.fs-header-actions { gap: 12px; }
#fs-balance { display: flex; padding: 10px 16px; border-radius: 30px; background: var(--bg-surface); font-size: 12px; white-space: nowrap; cursor: pointer; font-weight: 600; min-height: 40px; align-items: center; }
.fs-account { position: relative; }
.fs-account summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border-default); }
.fs-account summary::-webkit-details-marker { display: none; }
.fs-account-menu { position: absolute; right: 0; top: 54px; width: 260px; padding: 10px; background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-md); z-index: 110; }
.fs-account-menu > * { width: 100%; }
#fs-user { display: block; padding: 12px 8px; font-size: 13px; overflow-wrap: anywhere; }
.fs-account-menu button { justify-content: flex-start; text-align: left; background: transparent; border: 0; padding: 12px; min-height: 44px; }
.fs-account-menu button:hover { background: var(--bg-surface); }
.fs-toolbar { max-width: var(--youuay-width); margin: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 24px 32px 0; }
.fs-project-name { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.fs-project-name span { font-size: 12px; color: var(--text-secondary); }
#fs-name { background: transparent; font-size: 14px; color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 10px 12px; width: 240px; min-width: 0; }
.fs-button { border: 1px solid var(--border-default); border-radius: 8px; padding: 10px 14px; min-height: 44px; color: var(--text-primary); background: var(--bg-elevated); font-size: 13px; font-weight: 500; cursor: pointer; }
.fs-button:hover { border-color: var(--red-bright); }
.fs-primary { background: var(--red-vivid); border-color: var(--red-vivid); color: white; }
.fs-primary:hover { background: var(--youuay-accent-hover); }
#fs-status { width: 100%; font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
#fs-status:empty { display: none; }
.fs-studio-intro { max-width: var(--youuay-width); margin: 0 auto; padding: 32px 32px 24px; scroll-margin-top: 96px; }
.fs-studio-intro h1 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 30px); font-weight: 600; letter-spacing: -.6px; }
.fs-studio-intro > p { color: var(--text-secondary); font-size: 14px; margin: 8px 0 24px; }
.studio-switcher { width: fit-content; max-width: 100%; background: var(--bg-elevated); padding: 4px; gap: 4px; border-radius: 12px; flex-wrap: wrap; overflow: visible; }
.switcher-btn { min-height: 44px; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.switcher-btn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: none; }
#promptAssistantBtn { background: transparent !important; border-color: transparent !important; color: var(--red-bright); }
.studio-body, .studio-body.prompt-assistant-active { display: grid; grid-template-columns: minmax(0,5fr) minmax(0,7fr); gap: 40px; min-height: 0; max-width: var(--youuay-width); padding: 0 32px 48px; margin: auto; }
.sidebar-panel { padding: 0; background: transparent; border: 0; overflow: visible; max-height: none; min-width: 0; }
.section-card { background: var(--bg-elevated); border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.card-label-row { gap: 8px; flex-wrap: wrap; }
.section-label { color: var(--text-primary); font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.mode-pills { flex-wrap: wrap; margin-bottom: 0; }
.pill-btn { min-height: 44px; font-size: 12px; border-radius: 8px; flex-basis: 110px; }
.pill-btn.active { border-color: var(--red-vivid); background: #d32f2f14; }
.form-label { font-size: 13px; font-weight: 500; }
.form-input, .form-select, .form-textarea { border-radius: 8px; background-color: var(--bg-base); }
.form-select { min-width: 0; text-overflow: ellipsis; }
.form-textarea { min-height: 120px; resize: vertical; }
.model-badge-info { background: var(--bg-base); flex-wrap: wrap; gap: 8px; }
.model-price-tag { font-size: 12px; }
.btn-generate { min-height: 52px; border-radius: 12px; box-shadow: none; background: var(--red-vivid); font-family: var(--font-display); }
.workspace-panel { height: auto; max-height: none; overflow: visible; background: transparent; gap: 16px; }
.fs-preview-title { font-family: var(--font-display); font-size: 15px; font-weight: 500; padding: 0 0 4px; }
.stage-card, #stageCard { height: auto !important; min-height: 380px; flex: none; border: 1px solid var(--border-subtle); border-radius: 16px; padding: 20px; background: var(--bg-elevated); }
.stage-placeholder { flex-direction: column; border: 0; background: none; padding: 32px 12px; letter-spacing: 0; text-transform: none; font-family: var(--font-body); }
.fs-empty-icon { display: grid; place-items: center; margin: 0 auto 24px; width: 64px; height: 64px; background: #d32f2f14; border-radius: 20px; color: var(--red-bright); }
.fs-empty-icon svg { width: 28px; height: 28px; }
.stage-placeholder h3 { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--text-primary); margin-bottom: 12px; }
.stage-placeholder p { font-size: 13px; font-weight: 400; line-height: 1.7; max-width: 320px; margin: auto; }
.media-container { max-width: 100%; }
.media-container img, .media-container video { max-height: 65vh; max-width: 100%; object-fit: contain; }
.media-toolbar-actions { flex-wrap: wrap; justify-content: center; gap: 8px; }
.btn-stage-action { min-height: 44px; }
#panelResizer, #panelResizerRight, .panel-resizer-right { display: none !important; }
.history-dock-section { height: auto !important; max-height: none; flex: none; min-height: 160px; border: 1px solid var(--border-subtle); border-radius: 16px; padding: 20px; background: var(--bg-elevated); box-shadow: none; overflow: visible; }
.history-scroll-viewport { overflow: visible; padding: 12px 0 0; }
.history-toolbar-actions { gap: 6px; max-width: 100%; flex-wrap: wrap; }
.gallery-grid { grid-template-columns: repeat(auto-fill,minmax(min(var(--thumb-width,170px),100%),1fr)); }
.fs-mobile-nav { display: none; }
.fs-login { position: fixed; inset: 0; z-index: 10000; overflow-y: auto; background: var(--bg-base); display: grid; place-items: center; padding: 32px 20px; }
.fs-login[hidden] { display: none; }
.fs-login section { width: min(420px,100%); border: 1px solid var(--border-subtle); background: var(--bg-elevated); padding: 36px; border-radius: 20px; margin: auto; }
.fs-login-brand { font-family: var(--font-display); font-size: 23px; font-weight: 600; margin-bottom: 28px; letter-spacing: -.5px; }
.fs-login h2 { font-family: var(--font-display); font-size: 23px; line-height: 1.4; margin-bottom: 12px; font-weight: 500; }
.fs-login-hint { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 24px; }
.fs-login-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-secondary); margin: 22px 0; }
.fs-login-divider::before, .fs-login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-default); }
.fs-login form { display: grid; gap: 12px; margin-bottom: 16px; }
.fs-login input { min-height: 48px; width: 100%; padding: 12px; border: 1px solid var(--border-default); border-radius: 8px; color: var(--text-primary); background: var(--bg-base); font-size: 16px; }
.fs-login form .fs-button { background: var(--red-vivid); color: white; border-color: var(--red-vivid); }
.fs-login section > .fs-button { width: 100%; background: transparent; }
.fs-login [role="alert"] { font-size: 13px; color: var(--red-bright); margin-top: 16px; }
.fs-panel { width: min(900px,calc(100vw - 48px)); max-height: 85dvh; padding: 0 24px 24px; margin: auto; color: var(--text-primary); background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 16px; }
.fs-panel::backdrop { background: #000a; backdrop-filter: blur(6px); }
.fs-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; background: var(--bg-elevated); padding: 20px 0 16px; z-index: 1; }
.fs-panel h2 { font: 500 20px var(--font-display); }
.fs-panel h3 { font: 500 15px var(--font-display); margin: 24px 0 12px; }
.fs-panel-hint, .fs-empty-state { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 16px; }
.fs-empty-state { border: 1px dashed var(--border-default); border-radius: 12px; padding: 24px; margin-top: 16px; }
.fs-project-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; border: 1px solid var(--border-subtle); border-radius: 12px; padding: 16px; margin-top: 12px; }
.fs-project-row strong { flex: 1; overflow-wrap: anywhere; min-width: 120px; font-size: 14px; font-weight: 500; }
.fs-file-input { width: 100%; font-size: 13px; padding: 12px; border: 1px dashed var(--border-default); border-radius: 12px; }
.fs-file-input::file-selector-button { padding: 10px; margin-right: 12px; border: 0; border-radius: 6px; background: var(--bg-surface); color: var(--text-primary); cursor: pointer; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 16px; margin: 20px 0; }
.fs-grid > div { display: flex; flex-direction: column; gap: 10px; overflow: hidden; border: 1px solid var(--border-default); border-radius: 12px; padding: 12px; }
.fs-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; }
.fs-grid span { overflow-wrap: anywhere; font-size: 12px; flex: 1; }
.fs-panel > .fs-button { margin: 4px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
/* Assistant is a focused overlay instead of squeezing three columns into the viewport. */
body.fs-assistant-open { overflow: hidden; }
body.fs-assistant-open::after { content: ''; position: fixed; inset: 0; background: #0009; z-index: 998; }
.studio-body.prompt-assistant-active .prompt-assistant-panel { position: fixed; inset: 16px 16px 16px auto; width: min(920px,calc(100vw - 32px)); height: auto; max-height: none; z-index: 999; border: 1px solid var(--border-default); border-radius: 20px; background: var(--bg-elevated); box-shadow: var(--shadow-lg); }
.prompt-assistant-body { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.prompt-assistant-left, .prompt-assistant-right { min-width: 0; }
.prompt-assistant-header, .prompt-assistant-footer { background: transparent; }
.prompt-assistant-panel button { min-height: 44px; }
.utilities-dropdown { z-index: 1001; }
.upscaler-modal-card { max-height: calc(100dvh - 32px); }
.upscaler-header-title { min-width: 0; }
.upscaler-title { font-size: 18px; }
.upscaler-model-tag { display: none; }
@media (max-width: 1023px) {
  .app-header { padding: 0 24px; gap: 16px; }
  .brand-svg-logo { width: 180px; max-width: 180px; height: 32px; }
  .fs-desktop-nav { gap: 16px; }
  .studio-body, .studio-body.prompt-assistant-active { gap: 24px; padding-left: 24px; padding-right: 24px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .section-card { padding: 18px; }
  .fs-project-name span { display: none; }
}
@media (max-width: 767px) {
  body { padding-bottom: calc(80px + var(--youuay-safe-bottom)); }
  .app-header { height: 64px; min-height: 64px; padding: 0 16px; gap: 8px; }
  .brand-svg-logo { width: 165px; max-width: 165px; height: 28px; }
  .fs-desktop-nav { display: none; }
  .fs-header-actions { gap: 8px; }
  #fs-balance { max-width: 115px; font-size: 10px; padding: 8px 10px; white-space: normal; text-align: center; }
  .fs-account summary { width: 40px; height: 40px; }
  .fs-toolbar { padding: 16px 16px 0; gap: 8px; }
  .fs-project-name { width: 100%; }
  #fs-name { width: 100%; font-size: 16px; background: var(--bg-elevated); }
  #fs-save { margin-left: auto; }
  .fs-studio-intro { padding: 24px 16px 20px; scroll-margin-top: 80px; }
  .fs-studio-intro > p { font-size: 13px; margin-bottom: 20px; }
  .studio-switcher { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; padding: 4px; }
  .switcher-btn { justify-content: center; font-size: 12px; padding: 10px 8px; width: 100%; min-width: 0; }
  .switcher-text-full { display: inline; }
  .switcher-text-short { display: none; }
  .utilities-wrapper { width: 100%; }
  .studio-body, .studio-body.prompt-assistant-active { grid-template-columns: minmax(0,1fr); padding: 0 16px 24px; gap: 24px; }
  .sidebar-panel, .workspace-panel { width: 100%; }
  .workspace-panel { scroll-margin-top: 80px; }
  .section-card { padding: 20px; margin-bottom: 16px; }
  .card-label-row { align-items: center; }
  .form-input, .form-select, .form-textarea, .prompt-assistant-left .form-select, .prompt-assistant-left .form-input, .prompt-assistant-left .form-textarea { font-size: 16px; }
  .form-select, .form-input { min-height: 48px; }
  .chip-btn, .panel-close-btn, .btn-icon, .pill-btn, .ref-tab-btn { min-height: 44px; }
  .ref-media-tabs { flex-wrap: wrap; }
  .param-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stage-card, #stageCard { min-height: 300px; padding: 16px; }
  .history-dock-section { padding: 16px; }
  .history-toolbar-actions { width: 100%; justify-content: space-between; }
  .thumb-control-label { display: none; }
  .thumb-pill-btn { min-width: 36px; min-height: 36px; }
  .fs-mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); bottom: 0; left: 0; right: 0; padding: 8px 8px calc(8px + var(--youuay-safe-bottom)); background: var(--bg-base); border-top: 1px solid var(--border-subtle); z-index: 101; }
  .fs-mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 48px; border: 0; border-radius: 10px; color: var(--text-secondary); background: transparent; font-size: 10px; cursor: pointer; }
  .fs-mobile-nav button.active { color: var(--red-bright); background: #d32f2f12; }
  .fs-panel { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 0 16px 20px; border-radius: 16px; }
  .fs-panel-header { padding-top: 16px; }
  .fs-panel h2 { font-size: 18px; }
  .fs-project-row { padding: 12px; }
  .fs-project-row strong { flex-basis: 100%; }
  .fs-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .fs-grid > div { padding: 8px; }
  .fs-grid img { height: 110px; }
  .fs-login { padding: 24px 16px; }
  .fs-login section { padding: 24px; }
  .fs-login-brand { font-size: 21px; }
  .fs-login h2 { font-size: 21px; }
  .studio-body.prompt-assistant-active .prompt-assistant-panel { inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .prompt-assistant-header { padding: 16px; gap: 12px; }
  .prompt-assistant-header-title .title-text { font-size: 16px; }
  .prompt-assistant-body { display: flex; flex-direction: column; padding: 16px; gap: 24px; overflow-y: auto; }
  .prompt-assistant-left, .prompt-assistant-right { overflow: visible; height: auto; flex: none; }
  .pa-dual-prompts-container { overflow: visible; }
  .pa-optimized-box { flex: none; }
  .prompt-assistant-footer { padding: 12px 16px calc(12px + var(--youuay-safe-bottom)); flex-wrap: wrap; }
  .upscaler-modal { padding: 8px; }
  .upscaler-modal-card { max-height: calc(100dvh - 16px); }
  .upscaler-header { padding: 12px; gap: 8px; }
  .upscaler-title { font-size: 16px; }
  .upscaler-icon-badge { display: none; }
  .upscaler-body { display: flex; flex-direction: column; overflow-y: auto; }
  .upscaler-left-col, .upscaler-right-col { padding: 16px; overflow: visible; flex: none; }
  .upscaler-left-col { border-right: 0; }
  .upscale-source-tabs { flex-wrap: wrap; }
  .upscale-tab-btn { flex: 1 1 100px; min-height: 44px; }
  .upscale-preview-container { min-height: 280px; }
  .utilities-dropdown { bottom: calc(80px + var(--youuay-safe-bottom)); width: calc(100% - 24px); left: 12px; right: 12px; border-radius: 16px; max-height: calc(100dvh - 160px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.fs-login-brand img { display: block; width: 100%; height: auto; max-height: 48px; object-fit: contain; object-position: left; }
.pa-tab-btn.active { color: var(--red-bright); background: #d32f2f12; border-color: var(--border-default); }
.panel-close-btn:hover { color: var(--red-bright); }
.pa-image-upload-box { background: var(--bg-base); }
.pa-prompt-content-view { background: var(--bg-base); }

.fs-project-preview { aspect-ratio: 16/7; background: var(--youuay-surface2); }
.fs-project-preview svg { color: var(--youuay-accent-text); }
.fs-prompt-excerpt { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fs-file-type { font: 400 48px var(--youuay-heading); color: var(--youuay-muted); }

.fs-project-title { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
