:root {
  --bg: #f7f8fb;
  --ink: #101827;
  --muted: #7b8798;
  --line: #e7ebf2;
  --soft: #f2f5f9;
  --white: #fff;
  --orange: #ff5a3d;
  --orange-2: #ffe0a9;
  --purple: #b26dff;
  --blue: #3f8cff;
  --teal: #15a69d;
  --shadow: 0 24px 70px rgba(24, 35, 52, 0.12);
  --radius: 24px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-shell {
  min-height: 100vh;
}

.discover-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.header-inner {
  height: 108px;
  max-width: 1580px;
  margin: 0 auto;
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-link {
  display: flex;
  align-items: center;
  width: 250px;
  min-width: 220px;
  height: 64px;
}

.brand-logo-img {
  display: block;
  width: 100%;
  height: 58px;
  object-fit: contain;
  object-position: left center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.pill-btn,
.benefit-btn,
.avatar-btn {
  min-height: 58px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #1f2937;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(26, 36, 52, 0.04);
}

.benefit-btn {
  position: relative;
  background: linear-gradient(180deg, #ffe4b8, #ffd293);
  border-color: #ffc86e;
}

.benefit-btn span {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 12px;
  background: #e9dcff;
  color: #8b5cf6;
  font-size: 0.78rem;
}

.avatar-btn {
  width: 58px;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, #ff8c57, #ee5d31);
}

.discover-main {
  max-width: 1580px;
  margin: 0 auto;
  padding: 26px 42px 64px;
}

.category-strip {
  height: 96px;
  display: flex;
  align-items: center;
  gap: 22px;
  overflow: hidden;
}

.category-chip {
  min-width: 118px;
  min-height: 56px;
  padding: 0 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  color: #718096;
  font-weight: 900;
  filter: blur(1.6px);
}

.category-chip.active,
.category-chip.soft {
  filter: none;
}

.category-chip.active {
  color: var(--orange);
  background: #fff2ed;
}

.category-chip.soft {
  color: var(--teal);
  background: #e7faf7;
}

.template-center {
  margin-top: 6px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: #07090d;
  box-shadow: 0 24px 70px rgba(10, 17, 28, 0.18);
  color: #fff;
  overflow: hidden;
}

.template-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.template-head p {
  margin: 0 0 5px;
  color: #82f0d0;
  font-weight: 900;
}

.template-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

#templateCount {
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #dce6f2;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 10px;
}

.video-template-card {
  min-width: 0;
  min-height: 292px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #11141b;
  color: #fff;
  overflow: hidden;
  text-align: left;
  display: block;
  position: relative;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
  transition: 180ms ease;
}

.video-template-card.template-wide {
  grid-column: span 2;
}

.video-template-card.template-tall {
  min-height: 410px;
}

.video-template-card.template-small {
  min-height: 250px;
}

.video-template-card:hover,
.video-template-card.active {
  transform: translateY(-3px);
  border-color: rgba(130, 240, 208, 0.72);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42), 0 0 0 2px rgba(130, 240, 208, 0.12);
}

.template-media,
.template-media-el,
.template-fallback {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.template-media {
  position: absolute;
  inset: 0;
}

.template-media-el,
.template-fallback {
  position: absolute;
  inset: 0;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 240ms ease;
}

.video-template-card:hover .template-media-el {
  transform: scale(1.05);
}

.template-shade {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.86) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.32), transparent 48%);
}

.template-topline {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
}

.template-topline span {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.54);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.template-cover-a { background: linear-gradient(135deg, #f7c0a8, #62c7d6); }
.template-cover-b { background: linear-gradient(135deg, #ff725e, #ffd06f); }
.template-cover-c { background: linear-gradient(135deg, #b26dff, #4aa3ff); }
.template-cover-d { background: linear-gradient(135deg, #222c3d, #b5a48e); }
.template-cover-e { background: linear-gradient(135deg, #f4b6c5, #7c4f99); }
.template-cover-f { background: linear-gradient(135deg, #101827, #d3b48a); }

.template-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 70px 14px 14px;
  display: grid;
  gap: 6px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.84) 58%, rgba(0, 0, 0, 0.96));
}

.template-copy b,
.template-copy small,
.template-copy i,
.template-copy em {
  overflow-wrap: anywhere;
}

.template-copy b {
  font-size: 1.06rem;
  line-height: 1.25;
}

.template-copy small {
  color: rgba(232, 238, 246, 0.82);
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.template-copy i,
.template-copy em {
  color: #82f0d0;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.template-copy em {
  color: rgba(255, 255, 255, 0.72);
}

.hero-stage {
  position: relative;
  min-height: 720px;
  display: grid;
  align-items: end;
  padding: 68px 0 40px;
}

.blur-gallery {
  position: absolute;
  inset: 0 0 128px;
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 22px;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.tile {
  height: 270px;
  border-radius: 32px;
  filter: blur(14px);
  opacity: 0.72;
}

.tile.tall {
  height: 350px;
}

.peach { background: linear-gradient(145deg, #ffd0b9, #9a5c45); }
.cyan { background: linear-gradient(145deg, #d9f9ff, #63c7d9); }
.rose { background: linear-gradient(145deg, #f7b5c7, #6e3541); }
.violet { background: linear-gradient(145deg, #d4c7ff, #7b67c7); }
.slate { background: linear-gradient(145deg, #18212f, #b58d7f); }
.sand { background: linear-gradient(145deg, #f3d6b5, #9a8067); }
.coral { background: linear-gradient(145deg, #ffb8a5, #7d3d36); }
.blue { background: linear-gradient(145deg, #abd8ff, #3f72b5); }

.composer-card {
  position: relative;
  z-index: 2;
  width: min(1380px, calc(100vw - 96px));
  margin: 0 auto;
  border: 3px solid transparent;
  border-radius: 28px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #bd6dff, #49a1ff) border-box;
  box-shadow: 0 30px 80px rgba(21, 33, 52, 0.18);
}

.composer-card::before {
  content: none;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 34px 0;
}

.composer-head p {
  margin: 0 0 8px;
  color: var(--teal);
  font-weight: 900;
}

.composer-head h1 {
  margin: 0;
  font-size: 1.8rem;
}

.mode-badge {
  height: 34px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #fff0cf;
  color: #a36600;
  font-size: 0.84rem;
  font-weight: 900;
}

.mode-badge.live {
  background: #ddf8ee;
  color: #16855c;
}

.prompt-wrap {
  position: relative;
  padding: 22px 34px 0;
}

#promptInput {
  width: 100%;
  min-height: 280px;
  border: 0;
  outline: 0;
  resize: vertical;
  color: #202938;
  font-size: 1.18rem;
  line-height: 1.72;
}

#promptInput::placeholder {
  color: #a5afbd;
}

.prompt-helper {
  position: absolute;
  top: 34px;
  right: 46px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f2f5fb;
  color: #526173;
  font-weight: 900;
}

.reference-panel {
  display: none;
  margin: 10px 34px 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed #d7dfeb;
  background: #f8fafc;
}

.reference-panel.show {
  display: block;
}

.reference-head,
.reference-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reference-head {
  justify-content: space-between;
  margin-bottom: 10px;
  color: #526173;
  font-weight: 900;
}

.reference-row {
  margin-top: 8px;
}

.reference-url {
  flex: 1;
}

.remove-reference {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  border: 1px solid var(--line);
  font-weight: 900;
}

.composer-toolbar {
  min-height: 104px;
  padding: 22px 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #edf1f6;
  flex-wrap: wrap;
}

.model-select-wrap {
  position: relative;
  min-width: min(390px, 100%);
}

.model-trigger,
.composer-toolbar select,
.mention-btn,
.share-check,
#seedInput {
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid #dfe5ee;
  background: #fff;
  color: #364254;
  font-weight: 800;
}

.model-trigger {
  width: 100%;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.model-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f2f5fb;
}

.chevron {
  color: #6b7280;
}

.composer-toolbar select {
  padding: 0 38px 0 16px;
}

.mention-btn {
  width: 50px;
  font-size: 1.25rem;
  background: #fafbfe;
}

.share-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: #7b8798;
}

.share-check input {
  width: 20px;
  height: 20px;
}

#seedInput {
  width: 108px;
  padding: 0 12px;
}

.generate-btn {
  margin-left: auto;
  min-height: 58px;
  padding: 0 24px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--orange);
  color: #fff;
  font-size: 1.12rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(255, 90, 61, 0.24);
}

.generate-btn b {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
}

.model-menu {
  position: absolute;
  left: -112px;
  bottom: calc(100% + 24px);
  width: min(620px, calc(100vw - 48px));
  max-height: 570px;
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid #e7edf5;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 86px rgba(20, 32, 52, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
  backdrop-filter: blur(22px);
}

.model-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.model-menu-title {
  margin-bottom: 16px;
  color: #526173;
  font-size: 1.15rem;
  font-weight: 900;
}

.model-option {
  width: 100%;
  min-height: 98px;
  padding: 14px 10px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.model-option:hover,
.model-option.active {
  background: #f7f9fc;
}

.horse-icon,
.seed-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid #e5ebf3;
  background: #fff;
  font-size: 2rem;
}

.seed-icon {
  color: #4a8cff;
}

.model-option strong,
.model-option small {
  display: block;
}

.model-option strong {
  font-size: 1.2rem;
  line-height: 1.35;
}

.model-option em {
  margin-left: 10px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #ff745f;
  color: #fff;
  font-size: 0.72rem;
  font-style: normal;
}

.model-option small {
  margin-top: 8px;
  color: #8290a1;
  font-size: 0.92rem;
}

.diagnosis-card {
  position: absolute;
  right: 64px;
  top: 96px;
  z-index: 4;
  width: 330px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(231, 235, 242, 0.92);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 20px 54px rgba(25, 36, 56, 0.12);
  backdrop-filter: blur(18px);
}

#promptScore {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

#promptScore strong {
  font-size: 2rem;
}

#promptScore span,
.empty-note {
  color: var(--muted);
}

.check-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #eef2f7;
  color: #526173;
}

.check-item b {
  color: var(--teal);
}

.check-item.warn b {
  color: #d97706;
}

#optimizedPrompt {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dfe5ee;
  border-radius: 16px;
  resize: vertical;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(380px, 0.55fr);
  gap: 22px;
  margin-top: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(21, 33, 52, 0.08);
  overflow: hidden;
}

.panel-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.mini-btn,
.save-btn {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 12px;
  background: #f2f5f9;
  color: #364254;
  font-weight: 900;
}

.save-btn {
  background: var(--teal);
  color: #fff;
}

#selectedTask,
.admin-form,
#taskTable {
  padding: 20px 22px;
}

.admin-lock {
  display: none;
  padding: 22px;
  background: #fbfcff;
}

.admin-lock.show,
#adminControls.show {
  display: block;
}

#adminControls {
  display: none;
}

.admin-lock strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.admin-lock p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form input {
  min-height: 46px;
  padding: 0 13px;
}

.task-summary {
  display: grid;
  gap: 7px;
}

.status {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef3f8;
  color: #526173;
  font-size: 0.78rem;
  font-weight: 900;
}

.status.good {
  background: #ddf8ee;
  color: #16855c;
}

.status.work {
  background: #e4efff;
  color: #2563eb;
}

.status.bad {
  background: #fde8e8;
  color: #dc2626;
}

.result-video {
  width: 100%;
  margin-top: 14px;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  background: #111827;
}

.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px dashed #dbe3ee;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
}

.empty-state.compact {
  min-height: 88px;
  margin-top: 14px;
}

.task-mini-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-mini-grid span {
  padding: 10px;
  border-radius: 12px;
  background: #f2f5f9;
  text-align: center;
  font-weight: 900;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: #526173;
  font-size: 0.84rem;
  font-weight: 900;
}

input,
select,
textarea {
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fff;
  color: #111827;
}

.admin-form input,
.admin-form select {
  min-height: 42px;
  padding: 0 12px;
}

.deploy-box {
  margin: 0 22px 22px;
  padding: 14px;
  border-radius: 16px;
  background: #111827;
  color: #e5eef8;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.billing-section {
  margin-top: 22px;
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.billing-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.billing-head p,
.credit-pack-head p {
  margin: 0 0 6px;
  color: var(--orange);
  font-weight: 900;
}

.billing-head h2,
.credit-pack-head h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  letter-spacing: 0;
}

.balance-card {
  min-width: 220px;
  padding: 16px;
  border-radius: 16px;
  background: #101827;
  color: #fff;
  display: grid;
  gap: 4px;
}

.balance-card span,
.balance-card small {
  color: rgba(255, 255, 255, 0.72);
}

.balance-card strong {
  font-size: 2rem;
}

.billing-alert {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.billing-alert span {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
}

.plan-grid,
.credit-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.plan-grid,
.credit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.plan-card,
.credit-card {
  position: relative;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fbfcff;
  display: grid;
  gap: 12px;
}

.plan-card.highlight {
  border-color: #ff896f;
  background: linear-gradient(180deg, #fff7f4, #fff);
  box-shadow: 0 18px 36px rgba(255, 90, 61, 0.12);
}

.plan-badge {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ffe8df;
  color: #d94022;
  font-size: 0.78rem;
  font-weight: 900;
}

.plan-card h3,
.credit-card h4 {
  margin: 0;
  font-size: 1.18rem;
}

.plan-card p,
.credit-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.plan-price {
  color: #111827;
  font-size: 2rem;
  font-weight: 950;
}

.plan-price small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.plan-card > strong,
.credit-card > strong {
  color: var(--teal);
  font-size: 1.08rem;
}

.plan-card > small {
  color: var(--muted);
}

.plan-card ul {
  margin: 0;
  padding-left: 18px;
  color: #405166;
  line-height: 1.75;
}

.credit-pack-head {
  margin-top: 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.credit-pack-head span {
  color: var(--muted);
  font-weight: 900;
}

.credit-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.credit-card div span {
  font-size: 1.35rem;
  font-weight: 950;
}

.tasks-view {
  margin-top: 22px;
}

.task-row {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 120px minmax(160px, 1fr) minmax(180px, 1fr) 120px;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-bottom: 10px;
}

.task-row.active {
  border-color: #67a6ff;
  box-shadow: 0 0 0 3px rgba(63, 140, 255, 0.13);
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 39, 0.52);
  backdrop-filter: blur(10px);
}

.payment-modal.show {
  display: grid;
}

.payment-dialog {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
  display: grid;
  gap: 12px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f3f6fa;
  color: #374151;
  font-size: 1.2rem;
}

.modal-kicker {
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 900;
}

.payment-dialog h3,
.payment-dialog p {
  margin: 0;
}

.payment-dialog p,
.payment-dialog small {
  color: var(--muted);
  line-height: 1.55;
}

.payment-qr {
  min-height: 180px;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed #cfd8e5;
  background:
    linear-gradient(90deg, rgba(16, 24, 39, 0.04) 25%, transparent 25% 50%, rgba(16, 24, 39, 0.04) 50% 75%, transparent 75%),
    #f8fafc;
  background-size: 28px 28px;
  display: grid;
  place-items: center;
  color: #111827;
  text-align: center;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.payment-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 16px;
  background: #111827;
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .header-inner {
    height: auto;
    min-height: 92px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .diagnosis-card {
    position: relative;
    top: auto;
    right: auto;
    width: min(1380px, calc(100vw - 96px));
    margin: 18px auto 0;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    background: #f4f7fb;
  }

  .discover-main {
    width: 100%;
    max-width: 100vw;
    padding: 14px 14px 42px;
  }

  .header-inner {
    min-height: 82px;
    padding: 14px;
    gap: 10px;
    flex-direction: row;
    align-items: center;
  }

  .header-actions {
    width: auto;
    max-width: none;
    margin-left: auto;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: visible;
    padding: 0;
  }

  .brand-link {
    width: clamp(148px, 48vw, 190px);
    min-width: 0;
    height: 48px;
  }

  .brand-logo-img {
    height: 44px;
  }

  .pill-btn,
  .benefit-btn,
  .avatar-btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.9rem;
  }

  .desktop-action {
    display: none;
  }

  .mobile-primary-action {
    background: #101827;
    border-color: #101827;
    color: #fff;
    box-shadow: 0 10px 22px rgba(16, 24, 39, 0.16);
  }

  .category-strip {
    height: 64px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .category-strip::-webkit-scrollbar,
  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .category-chip {
    flex: 0 0 auto;
    min-width: auto;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    filter: none;
    font-size: 0.92rem;
  }

  .template-center {
    width: auto;
    max-width: none;
    margin-right: 0;
    padding: 18px 12px;
    border-radius: 20px;
  }

  .template-grid,
  .video-template-card {
    width: 100%;
    max-width: 100%;
  }

  .template-head,
  .template-head > div,
  .template-head h2 {
    max-width: 100%;
    min-width: 0;
  }

  .template-head h2 {
    font-size: 1.08rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .template-head p {
    font-size: 0.9rem;
  }

  #templateCount {
    min-height: 32px;
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .template-topline {
    left: 10px;
    right: 10px;
  }

  .template-topline span {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .hero-stage {
    min-height: auto;
    padding: 22px 0 24px;
    display: block;
  }

  .blur-gallery {
    display: none;
  }

  .composer-card,
  .diagnosis-card {
    width: 100%;
  }

  .composer-card {
    border-width: 2px;
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(21, 33, 52, 0.14);
  }

  .composer-head {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 20px;
  }

  .composer-head h1 {
    font-size: 1.32rem;
    line-height: 1.25;
  }

  .composer-head p {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .mode-badge {
    height: auto;
    min-height: 30px;
    padding: 6px 11px;
    font-size: 0.78rem;
  }

  .composer-toolbar,
  .composer-head,
  .prompt-wrap {
    padding-left: 18px;
    padding-right: 18px;
  }

  .prompt-wrap {
    padding-top: 16px;
  }

  #promptInput {
    min-height: 220px;
    font-size: 1rem;
    line-height: 1.65;
    padding-top: 42px;
  }

  .prompt-helper {
    top: 18px;
    right: 18px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .composer-toolbar {
    min-height: auto;
    padding-top: 16px;
    padding-bottom: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .model-select-wrap,
  .generate-btn {
    grid-column: 1 / -1;
  }

  .model-select-wrap,
  .composer-toolbar select,
  #seedInput {
    width: 100%;
  }

  .model-trigger,
  .composer-toolbar select,
  .mention-btn,
  .share-check,
  #seedInput {
    min-height: 46px;
    border-radius: 13px;
    font-size: 0.92rem;
  }

  .mention-btn {
    width: 100%;
  }

  .share-check {
    justify-content: center;
  }

  .generate-btn {
    margin-left: 0;
    justify-content: center;
    min-height: 54px;
    border-radius: 15px;
  }

  .model-menu {
    left: 0;
    right: auto;
    bottom: calc(100% + 12px);
    width: min(100%, calc(100vw - 28px));
    max-height: min(70vh, 520px);
    padding: 14px;
    border-radius: 18px;
  }

  .model-option {
    min-height: 82px;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
  }

  .horse-icon,
  .seed-icon {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }

  .model-option strong {
    font-size: 1rem;
  }

  .model-option small {
    font-size: 0.84rem;
  }

  .diagnosis-card {
    margin-top: 16px;
    padding: 14px;
    border-radius: 18px;
  }

  #promptScore strong {
    font-size: 1.5rem;
  }

  .section-grid {
    margin-top: 16px;
    gap: 16px;
  }

  .panel {
    border-radius: 18px;
  }

  .panel-head {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .billing-section {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .billing-head,
  .credit-pack-head {
    flex-direction: column;
    align-items: stretch;
  }

  .balance-card {
    min-width: 0;
  }

  #selectedTask,
  .admin-form,
  #taskTable {
    padding: 16px;
  }

  .reference-panel {
    margin-left: 18px;
    margin-right: 18px;
    border-radius: 16px;
  }

  .reference-head,
  .reference-row {
    align-items: stretch;
  }

  .reference-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .admin-form,
  .task-row,
  .task-mini-grid,
  .plan-grid,
  .credit-grid,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .video-template-card.template-wide {
    grid-column: span 1;
  }

  .video-template-card,
  .video-template-card.template-small {
    min-height: 318px;
  }

  .video-template-card.template-tall {
    min-height: 390px;
  }

  .template-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .discover-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-inner {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-link {
    width: clamp(138px, 50vw, 168px);
  }

  .brand-logo-img {
    height: 40px;
  }

  .mobile-primary-action {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .template-center {
    border-radius: 18px;
    padding: 16px 10px;
  }

  .video-template-card,
  .video-template-card.template-small {
    min-height: 304px;
  }

  .video-template-card.template-tall {
    min-height: 360px;
  }

  .template-copy {
    padding: 64px 12px 12px;
  }

  .template-copy b {
    font-size: 1rem;
  }

  .template-copy small {
    font-size: 0.82rem;
  }

  .composer-card {
    border-radius: 18px;
  }

  .composer-toolbar {
    grid-template-columns: 1fr;
  }

  .payment-dialog {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .payment-actions {
    grid-template-columns: 1fr;
  }

  .mention-btn,
  .share-check {
    display: none;
  }

  .prompt-helper {
    position: static;
    width: 100%;
    margin-bottom: 10px;
  }

  #promptInput {
    padding-top: 0;
    min-height: 210px;
  }

  .task-row {
    gap: 8px;
  }
}
