:root {
  --portal-sidebar: 80px;
  --portal-sidebar-xl: 96px;
  --portal-bg: #f5f5f7;
  --portal-ink: #1d1d1f;
  --portal-muted: #86868b;
  --portal-accent: #0071e3;
  --portal-accent-hover: #147ce5;
  --portal-radius-lg: 20px;
  --portal-radius-xl: 24px;
  --portal-border: rgba(0, 0, 0, 0.05);
  --portal-card: rgba(255, 255, 255, 0.5);
  --portal-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body.home-page,
body.tools-page,
body.library-page {
  margin: 0;
  background: var(--portal-bg) !important;
  background-image: none !important;
  color: var(--portal-ink);
  font-family: var(--portal-font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.home-page::before,
body.tools-page::before,
body.library-page::before,
body.home-page::after,
body.tools-page::after,
body.library-page::after {
  display: none !important;
  content: none !important;
}

/* 阻断 site-theme.css 对 portal 页的覆盖 */
body.home-page .hero-carousel,
body.tools-page .hero-carousel,
body.library-page .hero-carousel {
  background: linear-gradient(135deg, #111115 0%, #1c1c24 50%, #252538 100%) !important;
  border: none !important;
}

body.home-page .hero-carousel .slide,
body.tools-page .hero-carousel .slide,
body.library-page .hero-carousel .slide {
  background: transparent !important;
}

body.home-page .slide-tag {
  color: #5ac8fa !important;
}

/* ── Page stack spacing (space-y-12) ── */
.portal-page-stack {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.portal-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── 85% content shell ── */
.portal-shell,
main.container {
  width: 85%;
  max-width: none !important;
  margin: 0 auto;
  padding: 40px 0 80px !important;
}

/* ── Hero (home) ── */
.hero-carousel {
  position: relative;
  overflow: hidden;
  margin-bottom: 0 !important;
  padding: 40px 56px;
  border-radius: var(--portal-radius-xl) !important;
  background: linear-gradient(135deg, #111115 0%, #1c1c24 50%, #252538 100%) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  transition: box-shadow 0.3s ease;
}

.hero-carousel:hover {
  box-shadow: 0 25px 50px -12px rgba(0, 113, 227, 0.08) !important;
}

@media (min-width: 768px) {
  .hero-carousel { padding: 56px; }
}

.hero-carousel::before,
.hero-carousel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-carousel::before {
  top: -160px;
  right: -160px;
  width: 384px;
  height: 384px;
  background: rgba(0, 113, 227, 0.2);
  filter: blur(100px);
}

.hero-carousel::after {
  bottom: -80px;
  left: -80px;
  width: 320px;
  height: 320px;
  background: rgba(168, 85, 247, 0.1);
  filter: blur(80px);
}

.hero-carousel .slide {
  position: relative;
  z-index: 1;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
  padding: 0 !important;
  background: transparent !important;
}

@media (min-width: 1024px) {
  .hero-carousel .slide {
    grid-template-columns: 7fr 5fr;
  }
}

.slide-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.slide-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px !important;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #5ac8fa !important;
  font-size: 12px !important;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.slide-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5ac8fa;
  animation: portal-pulse 2s ease infinite;
}

@keyframes portal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.slide-title {
  margin-bottom: 16px !important;
  background: linear-gradient(90deg, #fff, #fff, #9ca3af);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  font-size: clamp(32px, 4vw, 56px) !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.02em !important;
}

.slide-desc {
  max-width: 520px;
  margin-bottom: 28px !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 17px !important;
  font-weight: 300;
  line-height: 1.6 !important;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-btn-primary,
.hero-btn-secondary {
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}

.hero-btn-primary {
  background: #fff;
  color: #000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.hero-btn-primary:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
}

.hero-btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.hero-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slide-visual-wrap {
  display: flex;
  justify-content: center;
}

.slide-visual {
  position: relative;
  width: 288px !important;
  height: 288px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
  transition: transform 0.5s ease;
}

@media (min-width: 768px) {
  .slide-visual {
    width: 320px !important;
    height: 320px !important;
  }
}

.hero-carousel:hover .slide-visual {
  transform: scale(1.03);
}

.slide-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-visual-caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 60%);
  color: rgba(255, 255, 255, 0.8);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  pointer-events: none;
}

/* ── Section headers ── */
.section-header,
.home-recommended-head,
.portal-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--portal-border);
}

.section-title,
.home-recommended-head h3,
.portal-section-head h2 {
  margin: 0;
  font-size: 24px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}

.section-subtitle,
.home-recommended-head p,
.portal-section-head p {
  margin: 4px 0 0;
  color: var(--portal-muted) !important;
  font-size: 12px !important;
}

.btn-outline,
.home-recommended-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  color: var(--portal-accent) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  cursor: pointer;
  text-decoration: none;
}

.btn-outline:hover,
.home-recommended-more:hover {
  text-decoration: underline;
}

/* ── Workflow grid (home + tools) ── */
.home-recommended-grid,
.tool-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px !important;
}

@media (min-width: 640px) {
  .home-recommended-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .home-recommended-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .tool-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.home-workflow-gallery-card,
.tool-card {
  overflow: hidden;
  border: 1px solid var(--portal-border) !important;
  border-radius: var(--portal-radius-lg) !important;
  background: var(--portal-card) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  cursor: pointer;
  transition: all 0.3s ease;
}

.home-workflow-gallery-card:hover,
.tool-card:hover {
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
  transform: translateY(-4px);
}

.home-workflow-gallery-card {
  display: flex;
  flex-direction: column;
}

.home-workflow-gallery-card .wf-cover,
.tool-card .tool-cover {
  position: relative;
  overflow: hidden;
  background: #f3f4f6;
}

.home-workflow-gallery-card .wf-cover {
  aspect-ratio: 1;
}

.tool-card .tool-cover {
  aspect-ratio: 4 / 3;
}

.home-workflow-gallery-card .wf-cover img,
.tool-card .tool-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.home-workflow-gallery-card:hover .wf-cover img,
.tool-card:hover .tool-cover img {
  transform: scale(1.05);
}

.home-workflow-gallery-card .wf-body,
.tool-card .tool-body {
  padding: 16px;
}

.home-workflow-gallery-card h4,
.tool-card .tool-body strong {
  margin: 0 0 4px;
  font-size: 14px !important;
  font-weight: 700 !important;
  transition: color 0.2s;
}

.home-workflow-gallery-card:hover h4,
.tool-card:hover .tool-body strong {
  color: var(--portal-accent) !important;
}

.home-workflow-gallery-card .wf-desc,
.tool-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.4) !important;
}

.tool-card .tool-body small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  color: rgba(29, 29, 31, 0.5) !important;
  font-size: 12px !important;
  line-height: 1.5;
}

.home-workflow-usage,
.usage-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6) !important;
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.tool-card .tool-enter {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--portal-ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
}

.tool-card:hover .tool-enter {
  background: var(--portal-accent);
  color: #fff;
}

/* ── Tutorials (home) ── */
.tutorial-section { margin-top: 0; }

/* 与教程分类页 .tutorial-public-list 相同的响应式列数，保证卡片尺寸一致 */
.tutorial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .tutorial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .tutorial-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .tutorial-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tutorial-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.tutorial-card:hover {
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.05);
  transform: translateY(-4px);
}

.tutorial-card .tutorial-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f3f4f6;
}

.tutorial-card .tutorial-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.tutorial-card:hover .tutorial-thumb img {
  transform: scale(1.05);
}

.tutorial-card .tutorial-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.tutorial-card .tutorial-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b7bec9;
}

.tutorial-card .tutorial-thumb-placeholder svg {
  width: 32px;
  height: 32px;
}

.tutorial-card .tutorial-chip {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}

.tutorial-card .tutorial-duration {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
}

.tutorial-card .tutorial-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  color: #1d1d1f;
}

.tutorial-card .tutorial-play svg {
  width: 14px;
  height: 14px;
  padding: 10px 8px 10px 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  fill: currentColor;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  box-sizing: content-box;
  transition: transform 0.25s ease;
}

.tutorial-card:hover .tutorial-play svg {
  transform: scale(1.08);
}

.tutorial-card .tutorial-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 120px;
  padding: 20px;
}

.tutorial-card .tutorial-info h4 {
  margin: 0 0 8px;
  color: #000;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.tutorial-card:hover .tutorial-info h4 {
  color: var(--portal-accent);
}

.tutorial-card .tutorial-info p {
  display: none;
}

.tutorial-card .tutorial-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--portal-accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.tutorial-card .tutorial-cta svg {
  width: 12px;
  height: 12px;
  transition: transform 0.22s ease;
}

.tutorial-card:hover .tutorial-cta svg {
  transform: translateX(4px);
}

.published-empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px dashed var(--portal-border);
  border-radius: var(--portal-radius-lg);
  text-align: center;
  color: var(--portal-muted);
}

.published-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--portal-ink);
  font-size: 16px;
}

/* ── Tools page ── */
.tools-shell {
  width: 85% !important;
  max-width: none !important;
  margin: 0 auto;
  padding: 40px 0 80px !important;
}

.tools-search input {
  font-size: 14px !important;
}

.credit-pill {
  padding: 0 16px !important;
  border: 0 !important;
  background: rgba(0, 113, 227, 0.1) !important;
  color: var(--portal-accent) !important;
  font-size: 12px !important;
}

.member-pill {
  padding: 0 20px !important;
  border: 0 !important;
  background: linear-gradient(90deg, #f59e0b, #ea580c) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.15) !important;
}

.recent-section h2 {
  margin-bottom: 12px !important;
  color: var(--portal-muted) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 最近使用卡片样式由 tools.css 定义（旧的药丸样式覆盖已移除） */

.tools-tabs {
  box-sizing: border-box;
  height: 40px;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin-bottom: 0 !important;
  padding: 4px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(0, 0, 0, 0.05) !important;
}

.tools-tabs button {
  height: 32px;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  color: rgba(29, 29, 31, 0.6) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.tools-tabs button.active {
  background: #fff !important;
  color: var(--portal-ink) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
  font-weight: 600 !important;
}

.tools-tabs button::after { display: none !important; }

.tools-filter-meta {
  margin-left: auto;
  color: var(--portal-muted);
  font-size: 12px;
}

.tools-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--portal-border);
}

/* ── Library page ── */
body.library-page .topbar { display: none; }

.library-shell {
  width: 85%;
  margin: 0 auto;
  padding: 40px 0 80px;
}

.library-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--portal-border);
}

.library-page-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.library-page-head p {
  margin: 4px 0 0;
  color: var(--portal-muted);
  font-size: 12px;
}

.library-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.library-head-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--portal-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.library-head-actions .btn:hover {
  background: #fff;
}

.library-head-actions .btn.primary {
  border-color: var(--portal-accent);
  background: var(--portal-accent);
  color: #fff;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.library-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
}

.library-tabs .tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  color: rgba(29, 29, 31, 0.6);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.library-tabs .tab.active {
  background: #fff;
  color: var(--portal-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.library-search {
  position: relative;
}

.library-search input {
  width: 240px;
  padding: 8px 16px 8px 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 12px;
  outline: none;
  transition: all 0.2s;
}

.library-search input:focus {
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.library-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--portal-muted);
  pointer-events: none;
}

body.library-page .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 768px) {
  body.library-page .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  body.library-page .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  body.library-page .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

body.library-page .asset-card {
  overflow: hidden;
  border: 1px solid var(--portal-border) !important;
  border-radius: var(--portal-radius-lg) !important;
  background: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.library-page .asset-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
  transform: translateY(-4px);
}

body.library-page .asset-preview {
  position: relative;
  aspect-ratio: 1 !important;
  background: #f3f4f6;
  overflow: hidden;
}

body.library-page .asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

body.library-page .asset-card:hover .asset-preview img {
  transform: scale(1.05);
}

body.library-page .asset-hover-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.2s;
}

body.library-page .asset-card:hover .asset-hover-actions {
  opacity: 1;
}

body.library-page .asset-hover-actions button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--portal-ink);
  cursor: pointer;
  transition: transform 0.2s;
}

body.library-page .asset-hover-actions button:hover {
  transform: scale(1.1);
}

body.library-page .asset-hover-actions svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

body.library-page .card-body {
  padding: 12px !important;
}

body.library-page .card-body h3 {
  margin: 0 0 4px;
  font-size: 12px !important;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.library-page .meta {
  display: flex;
  justify-content: space-between;
  color: rgba(29, 29, 31, 0.4) !important;
  font-size: 10px !important;
  font-family: ui-monospace, monospace;
}

body.library-page .library-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--portal-border);
}

body.library-page .library-pagination-summary {
  color: var(--portal-muted);
  font-size: 13px;
}

body.library-page .library-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body.library-page .library-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: #fff;
  color: var(--portal-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.library-page .library-pagination-btn:hover:not(:disabled) {
  border-color: rgba(0, 113, 227, 0.3);
  color: var(--portal-accent);
  background: rgba(0, 113, 227, 0.05);
}

body.library-page .library-pagination-btn.active {
  border-color: var(--portal-accent);
  background: var(--portal-accent);
  color: #fff;
}

body.library-page .library-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.library-page .library-pagination-ellipsis {
  padding: 0 4px;
  color: var(--portal-muted);
  font-size: 13px;
}

body.library-page .asset-card-actions { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 3000;
  transform: translate(-50%, 18px);
  padding: 11px 18px;
  border-radius: 12px;
  background: #1d1d1f;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Apple lightbox (immersive image view) ── */
.asset-viewer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.9) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.asset-viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.asset-viewer[hidden] {
  display: none !important;
}

.asset-viewer-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease;
}

.asset-viewer-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.asset-viewer-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.asset-viewer-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 90vw;
  height: 100%;
  max-height: 90vh;
}

.asset-viewer-stage > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}

.asset-viewer-toolbar {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.asset-viewer-filename {
  display: flex;
  align-items: center;
  max-width: 200px;
  padding: 8px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.asset-viewer-filename span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-viewer-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.asset-viewer-action svg {
  width: 16px;
  height: 16px;
  stroke: rgba(255, 255, 255, 0.8);
  fill: none;
  flex-shrink: 0;
}

.asset-viewer-action:hover {
  background: #0071e3;
  border-color: #0071e3;
}

.asset-viewer-action:hover svg {
  stroke: #fff;
}

.asset-viewer-action[data-asset-viewer-favorite]:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: transparent;
}

.asset-viewer-action[data-asset-viewer-favorite].is-favorite {
  background: rgba(255, 59, 48, 0.18);
  border-color: rgba(255, 59, 48, 0.35);
}

.asset-viewer-action[data-asset-viewer-favorite].is-favorite svg {
  stroke: #ff6b6b;
  fill: #ff6b6b;
}

@media (max-width: 640px) {
  .asset-viewer-toolbar {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 20px;
    bottom: 20px;
  }

  .asset-viewer-filename {
    width: 100%;
    max-width: none;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .asset-viewer-close {
    top: 16px;
    right: 16px;
  }
}

@media (max-width: 768px) {
  .portal-shell,
  main.container,
  .tools-shell,
  .library-shell {
    width: 92%;
    padding-top: 24px !important;
  }

  .hero-carousel {
    padding: 32px 24px;
  }

  .hero-carousel .slide {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .slide-content {
    align-items: center;
  }

  .slide-visual-wrap {
    justify-content: center;
  }

  .slide-visual {
    width: 100% !important;
    max-width: 280px;
    height: 280px !important;
    margin: 0 auto;
  }

  .hero-actions {
    justify-content: center;
  }

  body.library-page .asset-hover-actions {
    opacity: 1;
  }
}

/* ── Tools page: neutralize tools.css conflicts ── */
body.tools-page .tools-shell {
  width: 85% !important;
  max-width: none !important;
  min-height: auto !important;
  margin: 0 auto !important;
  padding: 40px 0 80px !important;
}

/* 搜索框已移到分类标签行右侧（.tools-tabs-side） */
body.tools-page .tools-tabs-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 1 auto;
  min-width: 0;
}

body.tools-page .tools-search {
  width: min(300px, 32vw) !important;
  height: 40px !important;
  flex: 0 1 auto;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: rgba(0, 0, 0, 0.05) !important;
  box-shadow: none !important;
}

body.tools-page .tools-search:focus-within {
  border-color: var(--portal-accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15) !important;
}

body.tools-page .tools-filter-meta {
  white-space: nowrap;
}

@media (max-width: 760px) {
  body.tools-page .tools-tabs-row {
    flex-wrap: wrap;
  }

  body.tools-page .tools-tabs-side {
    width: 100%;
  }

  body.tools-page .tools-search {
    width: 100% !important;
  }
}

/* 旧手写顶栏（.tools-account）已从 tools.html 移除，相关规则删除 */

body.tools-page .tool-grid {
  gap: 24px !important;
}

/* ===== 最终优先级：压过 apple-design-system.css ===== */
body.home-page .hero-carousel,
body.home-page.has-global-sidebar .hero-carousel {
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 40px 56px !important;
  border-radius: var(--portal-radius-xl) !important;
  background: linear-gradient(to bottom right, #111115, #1c1c24, #252538) !important;
  border: none !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

@media (min-width: 768px) {
  body.home-page .hero-carousel { padding: 56px !important; }
}

body.home-page .hero-carousel .slide,
body.home-page .slide {
  background: transparent !important;
  padding: 0 !important;
}

body.home-page .slide-title {
  background: linear-gradient(90deg, #fff, #fff, #9ca3af) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  font-family: var(--portal-font) !important;
  font-size: clamp(36px, 5vw, 60px) !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.02em !important;
}

body.home-page .slide-desc {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 17px !important;
  font-weight: 300 !important;
  line-height: 1.6 !important;
  max-width: 520px !important;
  margin-bottom: 0 !important;
}

body.home-page .slide-tag {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: fit-content !important;
  margin-bottom: 0 !important;
  padding: 6px 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #5ac8fa !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  text-transform: none !important;
}

body.home-page .slide-visual {
  width: 320px !important;
  height: 320px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 16px !important;
  background: #111 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

body.home-page .slide-visual img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  filter: none !important;
}

body.home-page .home-workflow-gallery-card,
body.home-page .home-workflow-gallery-card.published-workflow-card {
  flex: unset !important;
  width: auto !important;
  aspect-ratio: unset !important;
  padding: 0 !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  border-radius: var(--portal-radius-lg) !important;
  background: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

body.home-page .tutorial-card {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  border-radius: 24px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* ===== 资产库：文件夹卡片区 ===== */
.library-section-title {
  margin: 4px 0 16px;
  color: var(--portal-ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.library-folder-area {
  margin-bottom: 8px;
}

.folder-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 22px;
  margin: 0 0 34px;
}

.folder-card {
  cursor: pointer;
  text-align: center;
  outline: none;
}

.folder-card-shape {
  --folder-bg: #e8e9ee;
  position: relative;
  aspect-ratio: 5 / 4;
}

.folder-card:hover .folder-card-shape,
.folder-card:focus-visible .folder-card-shape {
  --folder-bg: #d9dbe2;
}

.folder-card-tab {
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 22px;
  border-radius: 10px 16px 0 0;
  background: var(--folder-bg);
  transition: background 0.2s ease;
}

.folder-card-body {
  position: absolute;
  inset: 12px 0 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0 16px 16px 16px;
  background: var(--folder-bg);
  transition: background 0.2s ease;
}

.folder-card-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.folder-card-placeholder,
.folder-card-body > svg {
  color: #b3b8c2;
}

.folder-card-placeholder svg,
.folder-card-body > svg {
  width: 40px;
  height: 40px;
}

/* 文件夹封面：用 clip-path 让封面图填满整个文件夹轮廓（含左上页签），
   不再因为矩形封面盖不满不规则形状而在顶部露出灰色。 */
.folder-card-tab { display: none; }
.folder-card:not(.folder-card-new) .folder-card-body {
  inset: 0;
  border-radius: 0;
  clip-path: polygon(0 0, 42% 0, 42% 12px, 100% 12px, 100% 100%, 0 100%);
}

.folder-card-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.folder-card:hover .folder-card-actions,
.folder-card:focus-within .folder-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.folder-card-actions button {
  border: 0;
  border-radius: 10px;
  padding: 7px 14px;
  background: #fff;
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, color 0.15s ease;
}

.folder-card-actions button:hover {
  background: #fee2e2;
  color: #dc2626;
}

.folder-card-name {
  display: block;
  margin-top: 10px;
  color: var(--portal-ink);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-meta {
  display: block;
  margin-top: 3px;
  color: var(--portal-muted);
  font-size: 12px;
}

.folder-card-new .folder-card-body {
  inset: 0;
  border: 1.5px dashed rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  background: transparent;
  color: var(--portal-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.folder-card-new .folder-card-body svg {
  width: 26px;
  height: 26px;
  color: inherit;
}

.folder-card-new:hover .folder-card-body,
.folder-card-new:focus-visible .folder-card-body {
  border-color: rgba(0, 113, 227, 0.45);
  color: var(--portal-accent);
}

/* 文件夹打开视图头部 */
.library-folder-open {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 24px;
}

.library-folder-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.library-folder-back:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background: #fff;
}

.library-folder-back svg {
  width: 14px;
  height: 14px;
}

.library-folder-open-icon {
  display: inline-grid;
  place-items: center;
  color: var(--portal-accent);
}

.library-folder-open-icon svg {
  width: 20px;
  height: 20px;
}

.library-folder-open h2 {
  margin: 0;
  color: var(--portal-ink);
  font-size: 18px;
  font-weight: 700;
}

.library-folder-open-count {
  color: var(--portal-muted);
  font-size: 13px;
}

.library-folder-remove {
  margin-left: auto;
  padding: 8px 16px;
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 999px;
  background: transparent;
  color: #dc2626;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.library-folder-remove:hover {
  background: #fef2f2;
}

/* 批量选择 */
.library-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.library-select-toggle {
  padding: 9px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.library-select-toggle:hover {
  border-color: rgba(0, 0, 0, 0.18);
}

.library-select-toggle.active {
  border-color: rgba(0, 113, 227, 0.45);
  background: #e8f1fd;
  color: var(--portal-accent);
}

.asset-select-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  color: transparent;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.asset-select-check svg {
  width: 13px;
  height: 13px;
}

.grid.is-selecting .asset-select-check {
  display: grid;
}

.grid.is-selecting .asset-hover-actions {
  display: none !important;
}

.grid.is-selecting .asset-card {
  cursor: pointer;
}

.asset-card.is-selected .asset-select-check {
  border-color: var(--portal-accent);
  background: var(--portal-accent);
  color: #fff;
}

.grid.is-selecting .asset-card.is-selected {
  box-shadow: 0 0 0 2px var(--portal-accent);
}

.library-batch-bar {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 3100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 20px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.library-batch-count {
  font-weight: 600;
  white-space: nowrap;
}

.library-batch-bar button {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.library-batch-bar button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.library-batch-bar button.primary {
  background: var(--portal-accent);
}

.library-batch-bar button.primary:hover {
  background: var(--portal-accent-hover);
}

.library-batch-bar button.danger {
  background: rgba(220, 38, 38, 0.85);
}

.library-batch-bar button.danger:hover {
  background: #b91c1c;
}

/* 卡片悬停/查看器里的删除按钮：红色危险态 */
body.library-page .asset-hover-actions .asset-action-danger:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.asset-viewer .asset-viewer-danger:hover {
  background: rgba(220, 38, 38, 0.9) !important;
  color: #fff !important;
}

.library-batch-bar button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.folder-new-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 14px;
  border: 1px solid rgba(0, 113, 227, 0.4);
  border-radius: 999px;
  background: #fff;
}

.folder-new-form input {
  width: 130px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 13px;
}

.folder-new-form button {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--portal-accent);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.folder-new-form button:hover {
  background: var(--portal-accent-hover);
}

/* ===== 资产库：弹层（移动到文件夹 / 删除确认，需盖过 z-index:5000 的大图查看器） ===== */
.library-dialog {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.library-dialog.is-open {
  opacity: 1;
}

.library-dialog-card {
  width: min(380px, 100%);
  padding: 22px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.library-dialog.is-open .library-dialog-card {
  transform: translateY(0);
}

.library-dialog-card h3 {
  margin: 0 0 8px;
  color: var(--portal-ink);
  font-size: 17px;
  font-weight: 700;
}

.library-dialog-card > p {
  margin: 0 0 20px;
  color: var(--portal-muted);
  font-size: 13px;
  line-height: 1.6;
}

.library-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.library-dialog-actions button {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  padding: 9px 18px;
  background: #fff;
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.library-dialog-actions button:hover {
  background: #f3f4f6;
}

.library-dialog-actions button.danger {
  border-color: transparent;
  background: #dc2626;
  color: #fff;
}

.library-dialog-actions button.danger:hover {
  background: #b91c1c;
}

.folder-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  margin: 0 0 14px;
  overflow-y: auto;
}

.folder-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--portal-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.folder-picker-row svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.folder-picker-row:hover {
  background: #f3f4f6;
}

.folder-picker-row.active {
  background: #e8f1fd;
  color: var(--portal-accent);
}

.folder-picker-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-picker-count {
  color: var(--portal-muted);
  font-size: 12px;
}

.folder-picker-remove {
  color: var(--portal-muted);
}

.folder-picker-empty {
  margin: 4px 2px 8px;
  color: var(--portal-muted);
  font-size: 13px;
}

.folder-picker-new {
  display: flex;
  width: 100%;
}

.folder-picker-new input {
  flex: 1;
  width: auto;
}

.library-dialog-input {
  display: flex;
  width: 100%;
  margin-top: 4px;
}

.library-dialog-input input {
  flex: 1;
  width: auto;
}


/* ============================================================
   首页：聊天框 Hero + 快捷入口 + Recent Projects
   宽度/圆角/边框/阴影全部沿用 portal 设计变量，与工作流/教程等区块对齐
   ============================================================ */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.home-hero-title {
  margin: 4px 0 24px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}
.home-hero-title em {
  font-style: normal;
  color: var(--portal-accent);
}

.home-chat-box {
  position: relative;
  width: 100%;
  max-width: 920px;
  padding: 18px 18px 14px;
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-xl);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.home-chat-box:focus-within {
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: 0 8px 26px rgba(0, 113, 227, 0.1);
}
.home-chat-box textarea {
  width: 100%;
  min-height: 92px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #1d1d1f;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
}
.home-chat-box textarea::placeholder { color: var(--portal-muted); }

.home-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.home-chat-tools { display: inline-flex; gap: 8px; }
.home-chat-tool {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #4b5563;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.home-chat-tool.icon { width: 34px; padding: 0; justify-content: center; }
.home-chat-tool:hover { border-color: rgba(0, 113, 227, 0.35); color: var(--portal-accent); }
.home-chat-send {
  height: 38px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.home-chat-send:hover { background: #000; }

/* ── 首页 composer（对齐画布底部输入框样式；网站浅色 UI） ── */
.home-composer { padding: 16px 16px 14px; }
.home-composer-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.home-composer-add {
  flex: none;
  width: 58px;
  height: 80px;
  margin: 2px 6px 0 2px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(150deg, #f4f5f8, #e9ebf0);
  color: #a6abb5;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
  transform: rotate(-7deg);
  transition: transform 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.home-composer-add:hover {
  color: var(--portal-accent);
  transform: rotate(-3deg) translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}
.home-composer textarea { min-height: 84px; }

.home-composer-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.home-pill {
  flex: none;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.home-pill:hover { background: #f2f6fb; border-color: rgba(0, 113, 227, 0.3); }
.home-pill svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-pill.is-primary {
  border-color: rgba(0, 113, 227, 0.3);
  background: rgba(0, 113, 227, 0.08);
  color: var(--portal-accent);
}
.home-pill-caret { width: 13px !important; height: 13px !important; opacity: 0.7; }
.home-pill-sep { width: 1px; height: 14px; background: var(--portal-border); }
.home-spark { color: var(--portal-accent); font-size: 12px; }
.home-ratio-chip {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
}
.home-composer-spacer { flex: 1; }
.home-composer-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--portal-muted);
  font-size: 13px;
}
.home-composer-cost b { color: #1d1d1f; }
.home-composer-send {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--portal-accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.home-composer-send:hover { background: #0060c0; transform: translateY(-1px); }
.home-composer-send svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Agent 模式：隐藏只跟直接生图相关的控件 */
.home-composer[data-composer-mode="agent"] #homeModelButton,
.home-composer[data-composer-mode="agent"] #homeSizeButton,
.home-composer[data-composer-mode="agent"] .home-composer-cost { display: none; }

/* 展开面板 */
.home-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 16px;
  z-index: 30;
  min-width: 240px;
  max-width: calc(100vw - 48px);
  padding: 12px;
  border: 1px solid var(--portal-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  backdrop-filter: saturate(170%) blur(24px);
  -webkit-backdrop-filter: saturate(170%) blur(24px);
  text-align: left;
}
.home-popover[hidden] { display: none; }
.home-popover-model { width: min(430px, calc(100vw - 48px)); max-height: 420px; overflow-y: auto; }
.home-popover-size { width: min(460px, calc(100vw - 48px)); }
.home-popover h5 {
  margin: 2px 2px 8px;
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 500;
}
.home-popover h5 + * { margin-bottom: 10px; }

.home-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.home-option:hover { background: rgba(0, 113, 227, 0.06); }
.home-option.is-selected { background: rgba(0, 113, 227, 0.1); }
.home-option-icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--portal-accent);
}
.home-option-icon svg { width: 17px; height: 17px; fill: currentColor; }
.home-option-main { flex: 1; min-width: 0; }
.home-option-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.home-option-desc { display: block; margin-top: 2px; color: var(--portal-muted); font-size: 12px; }
.home-option-badge {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 113, 227, 0.12);
  color: var(--portal-accent);
  font-size: 10px;
  font-weight: 600;
}
.home-option-badge.locked { background: rgba(203, 128, 20, 0.14); color: #b06a00; }
.home-option-check { color: var(--portal-accent); font-weight: 700; }
.home-option.is-locked { opacity: 0.55; cursor: not-allowed; }
.home-option.is-locked:hover { background: transparent; }

.home-ratio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 6px;
}
.home-ratio-grid button {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #4b5563;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.home-ratio-grid button:hover { background: rgba(0, 113, 227, 0.06); }
.home-ratio-grid button.is-selected {
  border-color: rgba(0, 113, 227, 0.28);
  background: rgba(0, 113, 227, 0.1);
  color: #1d1d1f;
}
.home-res-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.home-res-group button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #4b5563;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.home-res-group button:hover { background: rgba(0, 113, 227, 0.06); }
.home-res-group button.is-selected {
  border-color: rgba(0, 113, 227, 0.28);
  background: rgba(0, 113, 227, 0.1);
  color: #1d1d1f;
}
.home-size-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-size-inputs label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--portal-muted);
  font-size: 12px;
}
.home-size-inputs input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  text-align: right;
}
.home-size-x, .home-size-unit { color: var(--portal-muted); font-size: 12px; }

.home-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 920px;
  margin-top: 16px;
}
.home-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  background: var(--portal-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.home-shortcut:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.home-shortcut .sc-ico {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 19px;
  font-style: normal;
  background: #eef2ff;
}
.home-shortcut .sc-ico.ecom { background: #fee2e2; }
.home-shortcut .sc-ico.poster { background: #cffafe; }
.home-shortcut .sc-ico.video { background: #f5e8ff; }
.home-shortcut .sc-ico.social { background: #dbeafe; }
.home-shortcut .sc-ico.brand { background: #dcfce7; }
.home-shortcut .sc-ico.office { background: #e0f2fe; }
.home-shortcut span { display: flex; flex-direction: column; }
.home-shortcut strong { font-size: 13.5px; font-weight: 600; color: #1d1d1f; }
.home-shortcut small { font-size: 11.5px; color: var(--portal-muted); }

/* ---------- Recent Projects（沿用 portal-section / section-header 布局） ---------- */
.home-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
/* 首页最近项目默认只展示一行，多出的用「查看更多」去项目管理页看 */
.home-project-grid-oneline {
  max-height: 200px; /* 卡片高 200px = 一行 */
  overflow: hidden;
}
.home-project-new,
.home-project-card {
  height: 200px;
  border-radius: var(--portal-radius-lg);
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.home-project-new {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1.5px dashed rgba(0, 0, 0, 0.14);
  background: var(--portal-card);
  color: var(--portal-muted);
  font: inherit;
}
.home-project-new:hover { border-color: rgba(0, 113, 227, 0.4); color: var(--portal-accent); }
.home-project-new .np-plus { font-size: 30px; line-height: 1; }
.home-project-new b { font-size: 14px; font-weight: 600; }

.home-project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--portal-border);
  background: var(--portal-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.home-project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.home-project-card .hp-thumbs {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  background: #eef0f3;
  min-height: 0;
}
.home-project-card .hp-cell { overflow: hidden; background: #f3f4f6; }
.home-project-card .hp-cell.empty { background: #f4f5f7; }
.home-project-card .hp-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-project-card .hp-meta { padding: 12px 14px; }
.home-project-card .hp-meta strong { display: block; font-size: 14px; font-weight: 600; color: #1d1d1f; }
.home-project-card .hp-meta small { font-size: 12px; color: var(--portal-muted); }

@media (max-width: 640px) {
  .home-hero-title { font-size: 23px; }
  .home-project-grid { grid-template-columns: 1fr; }
  /* 手机单列时「一行」只有一张会太少，放开高度正常滚动 */
  .home-project-grid-oneline { max-height: none; overflow: visible; }
}
