/* Science Hub · 作品探索优先。加载在 styles.css 之后。 */
:root {
  --color-bg: #F8F7FB;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F4F1F9;
  --color-surface-alt: #F3F1F7;
  --color-border: #E6E2EF;
  --color-border-light: #EEEBF3;
  --color-text: #272331;
  --color-text-secondary: #666270;
  --color-text-tertiary: #77717F;
  --color-accent: #6D55B3;
  --color-accent-light: #5C469D;
  --color-accent-bg: #EEEAF7;
  --glass-bg: #FFFFFF;
  --glass-border: #E6E2EF;
  --glass-shadow: 0 2px 12px #27233108;
  --card-shadow: none;
  --card-shadow-hover: 0 4px 16px #2723310A;
  --elevation-1: 0 1px 2px #27233105;
  --elevation-2: 0 4px 16px #2723310D;
  --elevation-3: 0 12px 36px #2723311A;
  --font-sans: 'Microsoft YaHei UI', 'PingFang SC', 'Segoe UI', system-ui, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --hub-sidebar-width: 220px;
  --hub-preview-bg: #F3F2F7;
  --hub-on-accent: #FFFFFF;
}
[data-theme="dark"] {
  --color-bg: #19171E;
  --color-surface: #24212B;
  --color-surface-hover: #312C3B;
  --color-surface-alt: #2B2734;
  --color-border: #423B4F;
  --color-border-light: #35303E;
  --color-text: #F3F0F7;
  --color-text-secondary: #BBB4C7;
  --color-text-tertiary: #A49CAF;
  --color-accent: #B8A2F0;
  --color-accent-light: #C8B6F5;
  --color-accent-bg: #393049;
  --glass-bg: #24212B;
  --glass-border: #423B4F;
  --glass-shadow: 0 2px 12px #0000001A;
  --card-shadow: none;
  --card-shadow-hover: 0 4px 16px #00000026;
  --elevation-1: 0 1px 2px #00000014;
  --elevation-2: 0 4px 16px #00000026;
  --elevation-3: 0 12px 36px #00000040;
  --hub-preview-bg: #302B3B;
  --hub-on-accent: #241D33;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* 固定侧栏及保留的账号、等级与通知功能。 */
.header {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--hub-sidebar-width);
  height: 100dvh;
  background: var(--color-surface);
  border: 0;
  border-right: 1px solid var(--color-border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.header .header-inner {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  max-width: none;
  padding: 30px 16px 20px;
  overflow-y: auto;
}
.header .header-logo { gap: 9px; padding: 0 4px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.header .header-logo:hover { color: var(--color-text); }
.header .header-logo .logo-icon,
.header .hub-brand { display: grid; place-items: center; width: 31px; height: 34px; flex-shrink: 0; background: none; color: var(--color-accent); border-radius: 0; }
.header .hub-brand svg { display: block; width: 31px; height: 34px; }
.header .header-nav,
.header .header-nav.open {
  display: flex;
  position: static;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 7px;
  width: 100%;
  margin: 44px 0 24px;
  padding: 0;
  overflow: visible;
  background: none;
  border: 0;
  backdrop-filter: none;
}
.header .header-nav :is(a, button) { min-width: 0; min-height: 46px; gap: 12px; padding: 11px 14px; border-radius: 7px; font-size: 14px; text-align: left; }
.header .header-nav :is(a, button) svg { width: 19px; height: 19px; flex-shrink: 0; }
.header .header-nav :is(a, button):hover { color: var(--color-text); background: var(--color-surface-alt); }
.header .header-nav :is(a, button).active { color: var(--color-accent); background: var(--color-accent-bg); font-weight: 700; }
.header .mobile-menu-btn { display: none; }
.hub-sidebar-note { margin-top: auto; padding: 20px 12px; color: var(--color-text-secondary); font-size: 12px; line-height: 1.9; border-top: 1px solid var(--color-border); }
.hub-sidebar-note :is(strong, b) { display: block; margin-bottom: 6px; color: var(--color-text); font-size: 13px; font-weight: 500; }
.header .header-actions { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 12px 8px; width: 100%; margin-top: auto; padding-top: 16px; }
.hub-sidebar-note + .header-actions { margin-top: 0; }
.header .xp-bar-mini { grid-column: 1 / -1; justify-content: space-between; gap: 8px; width: 100%; min-height: 42px; padding: 10px; border-radius: 7px; }
.header .xp-bar-mini .xp-badge { filter: none; }
.header .xp-bar-mini .xp-diff { font-size: 12px; line-height: 1.4; white-space: normal; }
.header .xp-bar-mini .xp-bar-wrap { flex: 1; min-width: 0; gap: 6px; }
.header .xp-bar-mini .xp-fill { width: 100%; height: 4px; }
.header .xp-bar-mini .xp-fill-inner { background: var(--color-accent); animation: none; }
.header .xp-bar-mini .xp-fill-inner::after { display: none; }
.header .xp-text { font-size: 12px; white-space: nowrap; }
.header .theme-toggle,
.header .notification-bell { display: grid; place-items: center; width: 38px; height: 38px; padding: 8px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 7px; }
.header :is(.theme-toggle, .notification-bell) svg { width: 19px; height: 19px; }
.header .notification-bell { justify-self: end; }
.header :is(.theme-toggle, .notification-bell):hover { background: var(--color-surface-alt); }
.header .header-user { grid-column: 1 / -1; gap: 8px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--color-border); }
.header .header-user-avatar { width: 32px; height: 32px; flex-shrink: 0; background: var(--color-accent-bg); color: var(--color-accent); }
.header #userName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.header #logoutBtn { margin-left: auto !important; padding: 6px; font-size: 12px; }
.notification-popover { inset: auto auto 20px calc(var(--hub-sidebar-width) + 16px); max-height: min(420px, calc(100dvh - 40px)); }
.notification-popover :is(span, small) { font-size: 12px; }

/* 保留原视图和弹窗机制，只改变内容工作面的排布。 */
.main-content { max-width: none; min-height: 100dvh; margin: 0 0 0 var(--hub-sidebar-width); padding: 32px 42px 48px; }
.main-content > .view { min-width: 0; }
.main-content > .view > .section-header { align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 26px; }
.main-content > .view > .section-header .section-title { font-size: 30px; line-height: 1.35; letter-spacing: -.6px; font-weight: 650; }
.main-content .btn { min-height: 38px; border-radius: 7px; font-size: 14px; }
.main-content .btn-sm { padding: 7px 12px; }
.main-content .btn-xs { min-height: 30px; padding: 5px 8px; font-size: 12px; }
.main-content .btn-primary:hover { box-shadow: none; }
.main-content .btn-primary,
.studio-ai-input-area .btn-send,
.works-checkbox.checked { color: var(--hub-on-accent); }
.header :is(a, button, [tabindex]):focus-visible,
.main-content :is(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.main-content :is(.hub-project-card, .project-card, .works-card):hover { transform: none; }

/* 首页以可运行作品的真实结果预览为主体。 */
.hub-home-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 8px 0 30px; }
.hub-home-intro > div { min-width: 0; }
.hub-home-intro h1 { margin: 0; font-size: clamp(28px, 2.5vw, 34px); line-height: 1.4; letter-spacing: -.8px; font-weight: 650; }
.hub-home-intro p { max-width: 700px; margin: 10px 0 0; color: var(--color-text-secondary); font-size: 14px; line-height: 1.8; }
.hub-home-intro > .btn { flex-shrink: 0; padding: 10px 18px; }
.hub-home-eyebrow { display: block; margin-bottom: 12px; color: var(--color-accent); font-size: 12px; letter-spacing: 1.2px; }
.hub-home-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--color-border); }
.hub-home-tabs,
.hub-sort-tabs { display: flex; gap: 24px; align-self: stretch; }
.hub-home-tab { min-height: 42px; padding: 8px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--color-text-secondary); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.hub-home-tab.active,
.hub-home-tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-accent); font-weight: 600; }
.hub-home-filters,
.hub-home-toolbar .hub-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.hub-select { max-width: 100%; min-width: 112px; min-height: 38px; padding: 8px 28px 8px 12px; border: 1px solid var(--color-border); border-radius: 7px; background-color: var(--color-surface); color: var(--color-text); font: inherit; font-size: 13px; cursor: pointer; }
.hub-search { display: flex; align-items: center; gap: 8px; min-width: 0; width: 220px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 7px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 14px; }
.hub-search svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-text-secondary); }
.hub-search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: none; color: var(--color-text); font: inherit; font-size: 14px; }
.hub-search input::placeholder { color: var(--color-text-tertiary); }
.hub-search:focus-within { border-color: var(--color-accent); }
.hub-result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px 0 14px; color: var(--color-text-secondary); font-size: 12px; }
.hub-empty { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; min-height: 240px; padding: 28px; border: 1px dashed var(--color-border); border-radius: 10px; color: var(--color-text-secondary); font-size: 14px; text-align: center; }
.hub-explore-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.hub-project-card { min-width: 0; overflow: hidden; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); transition: border-color 150ms ease, box-shadow 150ms ease; }
.hub-project-card:hover { border-color: var(--color-accent); box-shadow: var(--card-shadow-hover); }
.hub-project-visual { position: relative; width: 100%; aspect-ratio: 2.8 / 1; overflow: hidden; background: var(--hub-preview-bg); border-bottom: 1px solid var(--color-border); }
/* 缩放与居中由 ui-shell 的 ResizeObserver 统一计算。 */
.hub-card-frame { position: absolute; top: 0; left: 0; display: block; width: 1000px; height: 620px; border: 0; background: #FFFFFF; pointer-events: none; transform-origin: top left; }
.hub-preview-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; position: absolute; inset: 0; padding: 24px; color: var(--color-text-secondary); text-align: center; font-size: 14px; line-height: 1.7; }
.hub-preview-fallback svg { width: 40px; height: 40px; color: var(--color-accent); }
.hub-preview-fallback :is(small, span) { max-width: 30ch; font-size: 12px; }
.hub-project-copy { min-width: 0; padding: 19px 20px 16px; }
.hub-project-copy h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.hub-title-button { padding: 0; border: 0; background: none; color: var(--color-text); font: inherit; line-height: inherit; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.hub-title-button:hover { color: var(--color-accent); }
.hub-project-copy p { margin: 0; color: var(--color-text-secondary); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.hub-project-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; color: var(--color-text-secondary); font-size: 12px; }
.hub-project-bottom > span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-project-action { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 8px; min-height: 36px; padding: 6px 0; border: 0; background: none; color: var(--color-accent); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.hub-project-action:hover { text-decoration: underline; text-underline-offset: 4px; }
.hub-project-action svg { display: block; width: 16px; height: 16px; }
.hub-continue-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 24px; padding: 16px 20px; background: var(--color-surface); border: 1px solid var(--color-border); border-left: 1px solid var(--color-border); border-radius: 8px; }
.hub-continue-strip[hidden] { display: none; }
.hub-continue-copy { min-width: 0; }
.hub-continue-strip :is(h2, h3, strong) { font-size: 16px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.hub-continue-strip p { margin-top: 4px; font-size: 13px; color: var(--color-text-secondary); }
.hub-continue-strip .btn { flex-shrink: 0; }
.hub-personal-details { margin-top: 32px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); }
.hub-personal-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; padding: 18px 20px; color: var(--color-text); font-size: 14px; cursor: pointer; list-style: none; }
.hub-personal-details > summary::-webkit-details-marker { display: none; }
.hub-personal-details > summary::after { content: '+'; color: var(--color-text-secondary); font-size: 22px; line-height: 1; }
.hub-personal-details[open] > summary::after { content: '−'; }
.hub-personal-details[open] > summary { border-bottom: 1px solid var(--color-border); }
.hub-personal-details > :not(summary) { margin: 20px; }
.hub-personal-details .section-title { font-size: 20px; }
.hub-personal-details .contribution-panel { box-shadow: none; }

/* 社区保持筛选、知识图谱与卡片交互，统一作品预览语言。 */
#view-community .community-header { gap: 16px; margin-bottom: 22px; }
.community-tabs { max-width: 100%; gap: 4px; padding: 0; background: none; border-radius: 0; overflow-x: auto; scrollbar-width: thin; }
.community-tab { flex-shrink: 0; min-height: 42px; padding: 9px 12px; border-bottom: 2px solid transparent; border-radius: 0; font-size: 14px; white-space: nowrap; }
.community-tab.active { background: none; border-bottom-color: var(--color-accent); box-shadow: none; color: var(--color-text); font-weight: 600; }
.community-search { min-width: 0; min-height: 38px; padding: 8px 12px; border-radius: 7px; }
.community-search input { min-width: 0; font-size: 14px; }
.community-filter-bar { min-width: 0; gap: 7px; margin-bottom: 0; }
.filter-chip { min-height: 32px; font-size: 12px; padding: 5px 11px; }
.kg-mode-toggle { flex-wrap: wrap; }
#view-community .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
#view-community .project-card { min-width: 0; padding: 0; overflow: hidden; border-radius: 10px; background: var(--color-surface); }
.project-card .hub-project-visual { margin-bottom: 18px; }
#view-community .project-card-header { gap: 10px; margin: 0 18px 10px; }
#view-community .project-card-avatar { width: 32px; height: 32px; border-radius: 7px; }
#view-community .project-card-meta { min-width: 0; }
#view-community .project-card-meta h4 { font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
#view-community .project-card-meta .author { font-size: 12px; }
#view-community .project-card-desc { margin: 0 18px 12px; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
#view-community .project-card-tags { margin: 0 18px 14px; gap: 6px; }
#view-community .project-card-footer { flex-wrap: wrap; gap: 10px; margin: 0 18px 16px; padding-top: 12px; }
#view-community .project-card-footer .stats { flex-wrap: wrap; gap: 4px; }
#view-community .project-card-footer :is(.stat-btn, .remix-text) { min-height: 32px; font-size: 12px; }
#view-community .project-card-kp { max-width: 100%; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
#view-community .project-card :is(.badge, .tag),
#view-works :is(.badge, .tag, .status-badge) { font-size: 12px !important; }

/* 创作工作台。保存和发布始终留在顶部操作区。 */
.hub-studio-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 20px; }
.hub-studio-toolbar > div { min-width: 0; }
.hub-studio-toolbar .section-title { font-size: 30px; line-height: 1.35; }
.hub-studio-toolbar p { margin-top: 6px; color: var(--color-text-secondary); font-size: 14px; }
.hub-studio-toolbar .studio-actions { align-items: center; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; }
.hub-studio-toolbar .studio-actions .btn { flex: 0 1 auto; min-height: 40px; }
#studioSaveStatus { color: var(--color-text-secondary); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.hub-studio-mobile-tabs { display: none; }
.studio-layout { grid-template-columns: 330px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 20px; height: calc(100dvh - 208px); min-height: 520px; }
.studio-ai-panel,
.studio-workbench { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.studio-ai-panel,
.studio-preview { border-radius: 10px; box-shadow: none; }
.studio-ai-header { align-items: flex-start; gap: 10px; padding: 16px 14px; }
.studio-ai-header > div:first-child { min-width: 0; }
.studio-ai-header strong { font-size: 14px; }
.studio-ai-subtitle { margin-top: 5px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.studio-session-actions { flex-shrink: 0; }
.studio-session-bar { flex-wrap: wrap; justify-content: flex-start; gap: 6px 8px; padding: 9px 12px; font-size: 12px; }
#studioSessionLabel { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-session-bar .ai-model-select { min-height: 30px; font-size: 12px; }
.studio-context-banner { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.studio-ai-messages { gap: 14px; padding: 18px 14px; overscroll-behavior: contain; }
.studio-ai-messages .ai-msg { max-width: 94%; padding: 10px 12px; border-radius: 9px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.studio-ai-messages .ai-msg.welcome { max-width: 100%; padding: 0; }
.studio-ai-input-area { gap: 8px; padding: 12px; }
.studio-ai-input-area textarea { min-width: 0; min-height: 58px; padding: 10px 12px; font-size: 14px; line-height: 1.6; border-radius: 7px; }
.studio-ai-input-area .btn-send { width: 38px; height: 38px; flex-shrink: 0; border-radius: 7px; }
.studio-preview { min-height: 0; }
.studio-preview-header { padding: 12px 14px; }
.studio-preview-header-right { flex-wrap: wrap; min-width: 0; }
.studio-view-tab { min-height: 34px; font-size: 14px; }
.studio-preview-canvas { background: var(--color-surface-alt); padding: 12px; }
.studio-preview-canvas .tool-iframe { border-radius: 6px; box-shadow: none; }

/* 我的作品：紧凑列表，保留全部原有操作及下拉浮层。 */
.works-manage-toolbar { gap: 12px 16px; padding: 14px 16px; border-radius: 9px; }
.works-manage-filters { gap: 6px; }
.works-manage-actions { min-width: 0; }
.works-manage-search { min-width: 0; }
.works-manage-search .search-input,
.works-manage-search .search-input:focus { max-width: 100%; width: 200px; min-height: 38px; font-size: 14px; }
.works-manage-batch-actions { flex-wrap: wrap; }
.works-manage-grid { gap: 12px; }
.works-card { min-width: 0; flex-direction: row; border-radius: 9px; overflow: visible; }
.works-card:hover { box-shadow: none; }
.works-card-check { padding: 0 12px; }
.works-card-body { padding: 16px 16px 16px 4px; }
.works-card-header { gap: 10px; margin-bottom: 6px; }
.works-card-avatar { background: var(--color-accent-bg) !important; color: var(--color-accent); border-radius: 6px; }
.works-card-title { min-width: 0; }
.works-card-title h4 { display: block; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.works-card-date,
.works-card-stats { font-size: 12px; color: var(--color-text-secondary); }
.works-card-desc { margin-bottom: 10px; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.works-card-footer { gap: 10px; }
.works-card-status { flex-wrap: wrap; }
.works-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 8px; width: 248px; padding: 16px; border-left: 1px solid var(--color-border); }
.works-card-actions :is(.btn, .works-action-btn, .works-action-span),
.works-card-actions .works-more-btn { width: 100%; min-height: 36px; padding: 7px 8px; border-radius: 6px; font-size: 12px; }
.works-card-actions .btn-chat { background: var(--color-accent-bg); color: var(--color-accent); }
.works-more-wrap { min-width: 0; }
.works-more-menu { max-width: calc(100vw - 24px); max-height: calc(100dvh - 120px); overflow-y: auto; }
.works-more-menu button { min-height: 38px; font-size: 14px; }
#view-works .draft-card { min-width: 0; padding: 20px; border-radius: 9px; box-shadow: none; }
#view-works .draft-card-name { font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
#view-works .draft-card-desc { font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
#view-works .draft-card-meta { flex-wrap: wrap; font-size: 12px; }
#view-works .draft-card-actions { flex-wrap: wrap; gap: 8px; }
#view-works .draft-card-actions [onclick^="loadDraftToStudio"] { order: -1; background: var(--color-accent); color: #FFFFFF; border-color: var(--color-accent); }
[data-theme="dark"] :is(.hub-home-intro, .hub-continue-strip, .hub-studio-toolbar) .btn-primary,
[data-theme="dark"] #view-works .draft-card-actions [onclick^="loadDraftToStudio"] { color: #241D33; }

@media (max-width: 900px) {
  .main-content { padding: 28px 26px 40px; }
  .hub-home-intro { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .hub-home-toolbar { align-items: stretch; }
  .hub-home-filters,
  .hub-home-toolbar .hub-filters { width: 100%; }
  .hub-search { flex: 1; }
  .hub-explore-grid,
  #view-community .project-grid { grid-template-columns: minmax(0, 1fr); }
  .hub-studio-mobile-tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); }
  .hub-studio-mobile-tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 5px; background: none; color: var(--color-text-secondary); font: inherit; font-size: 14px; cursor: pointer; }
  .hub-studio-mobile-tabs button.active,
  .hub-studio-mobile-tabs button[aria-selected="true"] { background: var(--color-accent-bg); color: var(--color-accent); font-weight: 600; }
  .studio-layout { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 230px); min-height: 460px; }
  #view-studio:not([data-mobile-panel="preview"]) .studio-workbench,
  #view-studio[data-mobile-panel="preview"] .studio-ai-panel { display: none; }
  #view-studio[data-mobile-panel="preview"] .studio-workbench { display: flex; }
  .works-card-actions { grid-template-columns: minmax(0, 1fr); width: 122px; padding: 12px; }
}

@media (max-width: 760px) {
  :root { --header-height: 64px; --hub-bottom-nav-height: 66px; }
  .header { inset: 0 0 auto; width: 100%; height: var(--header-height); border-right: 0; border-bottom: 1px solid var(--color-border); }
  .header .header-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; overflow: visible; }
  .header .header-logo { min-width: 0; padding: 0; font-size: 16px; }
  .header .header-logo .logo-icon,
  .header .hub-brand { width: 27px; height: 30px; }
  .header .hub-brand svg { width: 27px; height: 30px; }
  .header .header-nav,
  .header .header-nav.open { position: fixed; inset: auto 0 0; z-index: 100; flex-direction: row; align-items: stretch; justify-content: space-evenly; gap: 0; width: 100%; min-height: calc(var(--hub-bottom-nav-height) + env(safe-area-inset-bottom)); margin: 0; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--color-border); background: var(--color-surface); }
  .header .header-nav :is(a, button) { flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 54px; padding: 5px 2px; border-radius: 7px; font-size: 12px; line-height: 1.3; }
  .header .header-nav :is(a, button) svg { width: 20px; height: 20px; }
  .hub-sidebar-note { display: none; }
  .header .header-actions { display: flex; justify-content: flex-end; gap: 8px; width: auto; margin: 0; padding: 0; }
  .header .xp-bar-mini,
  .header #userName,
  .header #logoutBtn { display: none; }
  .header .header-user { padding: 0; border: 0; }
  .header .header-user-avatar { width: 34px; height: 34px; }
  .header .theme-toggle,
  .header .notification-bell { width: 36px; height: 36px; border: 0; }
  .main-content { margin-left: 0; padding: 92px 22px calc(32px + var(--hub-bottom-nav-height) + env(safe-area-inset-bottom)); }
  .notification-popover { inset: 74px 12px auto auto; max-height: calc(100dvh - 170px); }
  .hub-home-intro { margin-top: 0; }
  .hub-home-intro h1 { font-size: 30px; }
  .hub-home-intro p { max-width: 50ch; }
  .hub-explore-grid,
  #view-community .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .hub-project-copy { padding: 14px; }
  .hub-project-copy h3 { font-size: 16px; }
  .hub-project-action { min-height: 40px; }
  #view-community .community-header { align-items: stretch; }
  .community-tabs { width: 100%; }
  .community-search { width: 100%; }
  .community-search input { width: 100%; }
  .hub-studio-toolbar { align-items: stretch; gap: 12px; }
  .hub-studio-toolbar .studio-actions { width: 100%; }
  .hub-studio-toolbar .studio-actions .btn { min-height: 42px; }
  #studioSaveStatus { flex-basis: 100%; }
  .studio-layout { height: calc(100dvh - 430px); min-height: 360px; }
  .works-manage-toolbar { align-items: stretch; }
  .works-manage-actions { width: 100%; justify-content: flex-start; }
  .works-manage-search { flex: 1; }
  .works-manage-search .search-input,
  .works-manage-search .search-input:focus { width: 100%; }
  .works-card { flex-direction: row; flex-wrap: wrap; }
  .works-card-check { align-self: flex-start; padding: 18px 12px 0; }
  .works-card-body { flex-basis: calc(100% - 44px); padding: 14px 16px 14px 0; }
  .works-card-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; padding: 12px; border: 0; border-top: 1px solid var(--color-border); }
  .works-card-actions > :is(.btn, .works-action-btn, .works-action-span, .works-more-wrap) { flex: 1 1 100px; width: auto; min-width: 0; }
  .works-card-actions :is(.btn, .works-action-btn, .works-action-span, .works-more-btn) { min-height: 40px; }
  #view-works .draft-card-actions .btn { min-height: 40px; }
}

@media (max-width: 480px) {
  .header .header-inner { gap: 8px; padding: 0 14px; }
  .header .header-logo { gap: 6px; font-size: 14px; }
  .header .header-actions { gap: 3px; }
  .header .theme-toggle,
  .header .notification-bell { width: 32px; height: 36px; padding: 6px; }
  .main-content { padding: 86px 16px calc(28px + var(--hub-bottom-nav-height) + env(safe-area-inset-bottom)); }
  .main-content > .view > .section-header .section-title,
  .hub-studio-toolbar .section-title { font-size: 28px; }
  .hub-home-intro h1 { font-size: 28px; letter-spacing: -.6px; }
  .hub-home-intro > .btn { min-height: 42px; }
  .hub-home-toolbar { gap: 10px; padding-bottom: 14px; }
  .hub-home-tabs,
  .hub-sort-tabs { gap: 20px; }
  .hub-home-filters,
  .hub-home-toolbar .hub-filters { gap: 8px; }
  .hub-home-filters > label { flex: 1; min-width: 0; }
  .hub-select { width: 100%; min-width: 0; min-height: 40px; font-size: 14px; }
  .hub-search { flex-basis: 100%; width: 100%; min-height: 40px; }
  .hub-explore-grid,
  #view-community .project-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .hub-project-copy { padding: 16px; }
  .hub-continue-strip { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .hub-personal-details > summary { padding: 16px; }
  .hub-personal-details > :not(summary) { margin: 16px; }
  .community-tab { padding: 8px 10px; }
  .filter-chip,
  .works-manage-filters .filter-chip { min-height: 36px; font-size: 12px; padding: 6px 10px; }
  .hub-studio-toolbar .studio-actions .btn { flex: 1 1 130px; padding: 9px 10px; white-space: normal; }
  .studio-ai-input-area textarea { font-size: 16px; }
  .studio-preview-header { gap: 8px; padding: 10px; }
  .studio-preview-canvas { padding: 8px; }
  .studio-view-tab { padding: 6px 10px; }
  .works-card-footer { align-items: flex-start; }
  .works-card-tags { gap: 6px; }
  .works-manage-toolbar { padding: 12px; }
  #view-works .draft-card { padding: 16px; }
  #view-works .draft-card-actions .btn { flex: 1 1 120px; white-space: normal; }
}

#view-community .reset-chip { white-space: nowrap; min-width: 62px; }
.hub-continue-strip { margin-top: 24px; }

.hub-local-note { margin: 0 0 10px; color: var(--color-accent); font-size: 11px; }
.main-content .stagger > * { animation: none; opacity: 1; transform: none; }
