/* Homepage workbench. Loaded after the shared platform styles. */
.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;
}

.home-page {
  --home-canvas: var(--bg-subtle);
  --home-panel: var(--bg-elevated);
  --home-panel-soft: var(--bg-card);
  --home-text: var(--text);
  --home-muted: var(--text-secondary);
  --home-quiet: var(--text-muted);
  --home-border: var(--border);
  --home-border-strong: var(--border-strong);
  --home-brand: var(--brand);
  --home-brand-strong: var(--brand-strong);
  --home-brand-soft: var(--brand-light);
  --home-ai: #0f766e;
  --home-ai-soft: #eaf7f4;
  --home-danger: #c73d35;
  --home-danger-soft: #fff1f0;
  --home-success: #247a52;
  --home-success-soft: #edf8f2;
  background: var(--home-canvas);
  color: var(--home-text);
}

html.dark-mode .home-page,
[data-theme="dark"] .home-page {
  --home-ai: #41c8b5;
  --home-ai-soft: rgba(65, 200, 181, .12);
  --home-danger: #ff8d86;
  --home-danger-soft: rgba(255, 91, 82, .12);
  --home-success: #6ed3a0;
  --home-success-soft: rgba(72, 185, 126, .13);
}

.home-page .layout { align-items: flex-start; }
.home-page .site-shell__nav .nav-logo .logo-dark { display: none; }
html.dark-mode .home-page .site-shell__nav .nav-logo .logo-light { display: none; }
html.dark-mode .home-page .site-shell__nav .nav-logo .logo-dark { display: block; }
.home-main { min-width: 0; padding-bottom: 56px; }
.home-main > section { scroll-margin-top: 88px; }
.home-eyebrow { display: inline-flex; color: var(--home-ai); font-size: 12px; font-weight: 700; line-height: 1; }
.home-section-heading { margin-bottom: 16px; }
.home-section-heading--split { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.home-section-heading h2 { margin: 8px 0 0; color: var(--home-text); font-size: 21px; line-height: 1.3; letter-spacing: 0; }
.home-section-heading p { margin: 7px 0 0; color: var(--home-muted); font-size: 13px; line-height: 1.55; }
.home-text-link { flex: 0 0 auto; color: var(--home-ai); font-size: 13px; font-weight: 650; text-decoration: none; }
.home-text-link:hover { color: var(--home-brand-strong); }
.home-text-link span { margin-left: 4px; }

/* Primary task surface */
.home-creator {
  padding: 26px;
  border: 1px solid var(--home-border);
  border-radius: 8px;
  background: var(--home-panel);
  box-shadow: var(--shadow-sm);
}
.home-creator__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.home-creator__heading h1 { margin: 8px 0 0; color: var(--home-text); font-size: 30px; line-height: 1.2; letter-spacing: 0; }
.home-creator__heading > p { max-width: 440px; margin: 0; color: var(--home-muted); font-size: 14px; line-height: 1.55; text-align: right; }

.home-mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 3px;
  margin-top: 22px;
  padding: 3px;
  border: 1px solid var(--home-border);
  border-radius: 7px;
  background: var(--home-panel-soft);
}
.home-mode-tabs button {
  min-height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--home-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.home-mode-tabs button:hover { color: var(--home-text); }
.home-mode-tabs button.is-active { background: var(--home-panel); color: var(--home-text); box-shadow: var(--shadow-sm); }
.home-mode-tabs button:focus-visible { outline: 2px solid var(--home-brand); outline-offset: 2px; }

.home-creator__form {
  display: grid;
  grid-template-columns: 118px minmax(280px, 1fr) 148px;
  min-height: 142px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--home-border-strong);
  border-radius: 8px;
  background: var(--home-panel-soft);
}
.home-creator__form.is-reference-hidden { grid-template-columns: minmax(280px, 1fr) 148px; }
.home-creator__form:focus-within { border-color: var(--home-ai); box-shadow: 0 0 0 3px var(--home-ai-soft); }
.home-reference-entry {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 10px 0 10px 10px;
  border: 1px dashed var(--home-border-strong);
  border-radius: 6px;
  background: var(--home-panel);
  color: var(--home-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.home-reference-entry:hover { border-color: var(--home-ai); color: var(--home-ai); background: var(--home-ai-soft); }
.home-reference-entry:focus-visible { outline: 2px solid var(--home-brand); outline-offset: 2px; }
.home-reference-entry svg { width: 23px; height: 23px; }
.home-reference-entry[hidden] { display: none; }
.home-creator__form textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 140px;
  padding: 23px 20px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--home-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
}
.home-creator__form textarea::placeholder { color: var(--home-quiet); }
.home-create-button {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  margin: 10px 10px 10px 0;
  padding: 0 18px;
  border: 1px solid var(--home-brand);
  border-radius: 6px;
  background: var(--home-brand);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.home-create-button:hover { border-color: var(--home-brand-strong); background: var(--home-brand-strong); }
.home-create-button > span { font-size: 15px; font-weight: 750; }
.home-create-button small { color: rgba(255, 255, 255, .82); font-size: 11px; }
.home-create-button svg { position: absolute; width: 18px; height: 18px; align-self: flex-end; }
.home-create-button:focus-visible { outline: 2px solid var(--home-brand); outline-offset: 3px; }

.home-creator__footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-top: 13px; }
.home-quick-prompts { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 7px; }
.home-quick-prompts::before { content: "试试"; color: var(--home-quiet); font-size: 12px; }
.home-quick-prompts button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--home-border);
  border-radius: 999px;
  background: var(--home-panel);
  color: var(--home-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.home-quick-prompts button:hover { border-color: var(--home-ai); color: var(--home-ai); background: var(--home-ai-soft); }
.home-quick-prompts button:focus-visible { outline: 2px solid var(--home-brand); outline-offset: 2px; }
.home-creator__meta { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.home-creator__meta span { padding: 5px 8px; border-radius: 4px; background: var(--home-panel-soft); color: var(--home-muted); font-size: 11px; }

/* Recent tasks */
.home-recent, .home-discovery, .home-workflows, .home-prompt-library { margin-top: 34px; }
.home-recent[hidden] { display: none; }
.home-recent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-task-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  min-width: 0;
  min-height: 88px;
  overflow: hidden;
  border: 1px solid var(--home-border);
  border-radius: 7px;
  background: var(--home-panel);
}
.home-task-card__media { display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--home-panel-soft); color: var(--home-ai); }
.home-task-card__media img, .home-task-card__media video { width: 100%; height: 100%; object-fit: cover; }
.home-task-card__media svg { width: 22px; height: 22px; }
.home-task-card__body { display: flex; min-width: 0; flex-direction: column; padding: 10px; }
.home-task-card__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.home-task-card__type { color: var(--home-text); font-size: 12px; font-weight: 700; }
.home-task-card__status { flex: 0 0 auto; padding: 3px 5px; border-radius: 4px; color: var(--home-muted); background: var(--home-panel-soft); font-size: 10px; }
.home-task-card__status.is-running { color: var(--home-ai); background: var(--home-ai-soft); }
.home-task-card__status.is-success { color: var(--home-success); background: var(--home-success-soft); }
.home-task-card__status.is-failed { color: var(--home-danger); background: var(--home-danger-soft); }
.home-task-card__prompt { overflow: hidden; margin: 7px 0 0; color: var(--home-muted); font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.home-task-card__action { align-self: flex-start; margin-top: auto; color: var(--home-ai); font-size: 11px; font-weight: 650; text-decoration: none; }
.home-task-card__action:hover { color: var(--home-brand-strong); }

/* Template gallery comes directly after recent work. */
.home-page .home-tabs { margin-bottom: 12px; }
.home-page .filter-section { margin-bottom: 12px; }
.home-page .masonry-grid { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)) !important; gap: 12px !important; }
.home-page .creation-card { border: 1px solid var(--home-border); border-radius: 7px !important; background: var(--home-panel); box-shadow: none; }
.home-page .creation-card:hover { border-color: var(--home-border-strong); box-shadow: var(--shadow-md); }
.home-page .creation-card--style .card-img-wrapper { height: auto !important; padding-bottom: 0 !important; aspect-ratio: 1 / 1; background: var(--home-panel-soft); cursor: default; }
.home-page .creation-card--style .card-media-link { position: absolute; inset: 0; display: block; }
.home-page .creation-card--style .card-img-wrapper img { object-fit: contain !important; }
.home-page .card-official-badge { position: absolute; top: 9px; left: 9px; z-index: 3; padding: 4px 7px; border-radius: 4px; background: var(--home-ai); color: #fff; font-size: 10px; font-weight: 700; }
.home-page .card-remix-btn { display: inline-flex !important; z-index: 4; right: 9px; bottom: 9px; border-radius: 5px; background: var(--home-brand); opacity: 1; transform: none; }
.home-page .card-remix-btn:hover { background: var(--home-brand-strong); }

/* Compact task shortcuts */
.home-workflow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.home-workflow-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--home-border);
  border-radius: 7px;
  background: var(--home-panel);
  color: var(--home-text);
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.home-workflow-card:hover { transform: translateY(-1px); border-color: var(--home-ai); box-shadow: var(--shadow-sm); }
.home-workflow-icon { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 6px; background: var(--home-ai-soft); color: var(--home-ai); }
.home-workflow-icon svg { width: 19px; height: 19px; }
.home-workflow-card > span:nth-child(2) { min-width: 0; }
.home-workflow-card strong, .home-workflow-card small { display: block; }
.home-workflow-card strong { font-size: 14px; }
.home-workflow-card small { overflow: hidden; margin-top: 5px; color: var(--home-muted); font-size: 11px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.home-workflow-card > b { color: var(--home-ai); font-size: 11px; font-weight: 650; white-space: nowrap; }
.home-workflow-card.is-recommended { border-color: var(--home-ai); }

/* Prompt library uses progressive disclosure. */
.home-prompt-library__disclosure { overflow: hidden; border: 1px solid var(--home-border); border-radius: 7px; background: var(--home-panel); }
.home-prompt-library__disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; list-style: none; cursor: pointer; }
.home-prompt-library__disclosure > summary::-webkit-details-marker { display: none; }
.home-prompt-library__disclosure > summary h2 { margin: 7px 0 0; color: var(--home-text); font-size: 18px; letter-spacing: 0; }
.home-prompt-library__disclosure > summary p { margin: 6px 0 0; color: var(--home-muted); font-size: 12px; }
.home-prompt-library__toggle { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; color: var(--home-ai); font-size: 12px; font-weight: 650; }
.home-prompt-library__toggle svg { width: 16px; height: 16px; transition: transform .16s ease; }
.home-prompt-library__disclosure[open] .home-prompt-library__toggle svg { transform: rotate(180deg); }
.home-prompt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 20px 20px; }
.home-prompt-pack { padding: 14px; border: 1px solid var(--home-border); border-radius: 6px; background: var(--home-panel-soft); }
.home-prompt-pack__top { display: flex; align-items: flex-start; gap: 10px; }
.home-prompt-pack__index { display: inline-flex; min-width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 5px; background: var(--home-ai-soft); color: var(--home-ai); font-size: 11px; font-weight: 750; }
.home-prompt-pack h3 { margin: 1px 0 0; color: var(--home-text); font-size: 14px; }
.home-prompt-pack__top p { margin: 5px 0 0; color: var(--home-muted); font-size: 11px; line-height: 1.45; }
.home-prompt-use { display: flex; width: 100%; min-height: 36px; align-items: center; justify-content: space-between; margin-top: 14px; padding: 0 9px; border: 1px solid var(--home-border); border-radius: 5px; background: var(--home-panel); color: var(--home-ai); font: inherit; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; }
.home-prompt-use:hover { border-color: var(--home-ai); background: var(--home-ai-soft); }
.home-prompt-use span { font-size: 17px; }
.home-prompt-details { margin-top: 10px; }
.home-prompt-details summary { color: var(--home-muted); font-size: 11px; cursor: pointer; user-select: none; }
.home-prompt-details[open] summary { color: var(--home-ai); }
.home-prompt-sample { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--home-border); }
.home-prompt-sample strong { color: var(--home-text); font-size: 11px; }
.home-prompt-sample p { display: -webkit-box; overflow: hidden; margin: 6px 0; color: var(--home-muted); font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.home-prompt-sample button { min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--home-ai); font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }

@media (max-width: 1180px) {
  .home-recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-workflow-grid, .home-prompt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-creator__form { grid-template-columns: 104px minmax(240px, 1fr) 138px; }
}

@media (max-width: 900px) {
  .home-creator__heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .home-creator__heading > p { max-width: none; text-align: left; }
  .home-creator__footer { flex-direction: column; }
  .home-creator__meta { justify-content: flex-start; }
  .home-creator__form { grid-template-columns: 94px minmax(220px, 1fr); }
  .home-creator__form.is-reference-hidden { grid-template-columns: minmax(220px, 1fr); }
  .home-create-button { grid-column: 1 / -1; min-height: 52px; flex-direction: row; align-items: center; justify-content: center; margin: 0 10px 10px; }
  .home-create-button svg { position: static; align-self: auto; }
}

@media (max-width: 767px) {
  .home-page .layout { padding: 12px 14px 88px; }
  .home-main { padding-bottom: 0; }
  .home-creator { padding: 18px 14px; }
  .home-creator__heading h1 { font-size: 24px; }
  .home-mode-tabs { display: grid; width: 100%; box-sizing: border-box; }
  .home-mode-tabs button { min-width: 0; padding: 0 8px; }
  .home-creator__form { grid-template-columns: 78px minmax(0, 1fr); min-height: 128px; }
  .home-creator__form.is-reference-hidden { grid-template-columns: minmax(0, 1fr); }
  .home-reference-entry { margin: 8px 0 8px 8px; }
  .home-reference-entry span { max-width: 60px; line-height: 1.35; }
  .home-creator__form textarea { min-height: 128px; padding: 17px 14px; font-size: 14px; }
  .home-create-button { margin: 0 8px 8px; }
  .home-creator__meta { display: none; }
  .home-recent, .home-discovery, .home-workflows, .home-prompt-library { margin-top: 28px; }
  .home-section-heading--split { align-items: flex-start; flex-direction: column; gap: 8px; }
  .home-section-heading h2 { font-size: 19px; }
  .home-recent-grid { display: flex; margin-right: -14px; overflow-x: auto; padding-right: 14px; scroll-snap-type: x proximity; }
  .home-task-card { flex: 0 0 270px; scroll-snap-align: start; }
  .home-workflow-grid { grid-template-columns: 1fr; }
  .home-workflow-card { min-height: 78px; }
  .home-prompt-grid { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .home-prompt-library__disclosure > summary { align-items: flex-start; padding: 16px 14px; }
  .home-prompt-library__toggle { font-size: 0; }
  .home-prompt-library__toggle svg { width: 20px; height: 20px; }
  .home-page .masonry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 9px !important; }
  .home-page .creation-card--style .card-img-wrapper { aspect-ratio: 1 / 1 !important; }
  .home-page .creation-card .card-content { padding: 9px 10px 11px !important; }
  .home-page .card-remix-btn { right: 7px; bottom: 7px; padding: 6px 8px; font-size: 11px; }
  .home-page .card-official-badge { top: 7px; left: 7px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-page *, .home-page *::before, .home-page *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
