:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --card: #fffdf9;
  --card-soft: #fff8ef;
  --ink: #111827;
  --muted: #8a8f9c;
  --line: rgba(251, 146, 60, 0.35);
  --line-soft: rgba(251, 191, 36, 0.4);
  --orange: #ff9828;
  --yellow: #ffd21f;
  --shadow: 0 20px 34px rgba(148, 163, 184, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 10px 18px;
  background: #f7f8fb;
  border-right: 1px solid rgba(229, 231, 235, 0.95);
}

.brand {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 30px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 0;
  object-fit: cover;
  box-shadow: 0 0 28px rgba(255, 168, 44, 0.26);
}

.brand span {
  color: #fb9829;
  font-size: 11px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 18px;
  width: 100%;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: #1f2937;
  background: rgba(229, 231, 235, 0.5);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

.nav-item::before {
  display: none;
}

.ico {
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -3px;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.ico.building { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 21h18M5 21V5a2 2 0 0 1 2-2h7v18M14 8h5v13M8 7h2M8 11h2M8 15h2'/%3E%3C/svg%3E"); }
.ico.zap { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2 3 14h8l-1 8 11-14h-8l1-6Z'/%3E%3C/svg%3E"); }
.ico.dollar { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 6v12M15 8.5c-1-.8-5-1-5 1.5 0 3 5 1.5 5 4.5 0 2.5-4 2.3-6 1'/%3E%3C/svg%3E"); }
.ico.users { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-8 0v2M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM20 21v-2a4 4 0 0 0-3-3.8M4 21v-2a4 4 0 0 1 3-3.8'/%3E%3C/svg%3E"); }
.ico.prompt, .ico.negative { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 5h16v10H8l-4 4V5Z'/%3E%3C/svg%3E"); }
.ico.refresh { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 12a9 9 0 0 1 15-6l2 2M21 12a9 9 0 0 1-15 6l-2-2M18 3v5h-5M6 21v-5h5'/%3E%3C/svg%3E"); }
.ico.pen { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m16 3 5 5L8 21H3v-5L16 3Z'/%3E%3C/svg%3E"); }
.ico.square { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='5' width='14' height='14' rx='2'/%3E%3C/svg%3E"); }
.ico.layers { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 2 9 5-9 5-9-5 9-5Z'/%3E%3Cpath d='m3 12 9 5 9-5'/%3E%3Cpath d='m3 17 9 5 9-5'/%3E%3C/svg%3E"); }
.ico.sparkle { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3l1.6 5.4L19 10l-5.4 1.6L12 17l-1.6-5.4L5 10l5.4-1.6L12 3ZM19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15Z'/%3E%3C/svg%3E"); }
.ico.upload-cloud { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 18a5 5 0 0 0 0-10 7 7 0 0 0-13 3 4 4 0 0 0 1 7h12Z'/%3E%3Cpath d='M12 16V9M9 12l3-3 3 3'/%3E%3C/svg%3E"); }
.ico.upload { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E"); }
.ico.cube { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 2 9 5-9 5-9-5 9-5ZM3 7v10l9 5 9-5V7M12 12v10'/%3E%3C/svg%3E"); }
.ico.trend { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m3 17 6-6 4 4 8-8M15 7h6v6'/%3E%3C/svg%3E"); }
.ico.expand { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 3H3v5M21 8V3h-5M3 16v5h5M16 21h5v-5'/%3E%3C/svg%3E"); }
.ico.community { mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10v4M12 7v10M17 10v4M4 21h16M6 3h12l3 5H3l3-5Z'/%3E%3C/svg%3E"); }

.nav-item.active {
  color: #111827;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(254, 215, 170, 0.45);
}

.login-button {
  width: 100%;
  min-height: 36px;
  margin-top: auto;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
  box-shadow: 0 10px 22px rgba(255, 160, 34, 0.26);
}

.socials {
  display: flex;
  gap: 18px;
  margin-top: 18px;
}

.socials button {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  color: transparent;
  background: #eceff5;
  font-size: 0;
}

.socials button::first-letter {
  color: transparent;
}

.main-area {
  width: 100%;
  max-width: 1520px;
  padding: 18px clamp(18px, 3.2vw, 56px) 34px;
  justify-self: center;
}

.mode-card,
.prompt-card,
.asset-card,
.preview-card,
.community-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.mode-card {
  height: 66px;
  padding: 10px 12px;
  background: linear-gradient(90deg, #fff 0%, #fff6e8 100%);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #111827;
  font-weight: 600;
}

.tab.active {
  background: #fff;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.08);
}

.prompt-card {
  margin-top: 14px;
  min-height: 304px;
  padding: 16px 12px 14px;
  background: linear-gradient(90deg, #fff 0%, #fff7ec 100%);
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.section-title .ico,
h2 .ico {
  margin-right: 0;
}

textarea {
  width: 100%;
  height: 128px;
  min-height: 128px;
  padding: 14px 16px;
  border: 1px solid #ecdbae;
  border-radius: 14px;
  outline: none;
  resize: vertical;
  color: #111827;
  background: #fff;
  line-height: 1.55;
  font-size: 14px;
}

textarea::placeholder {
  color: #7b8190;
}

#negativePrompt {
  height: 112px;
  min-height: 112px;
  margin: 0 0 10px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: #f5c66b;
  box-shadow: 0 0 0 3px rgba(255, 191, 76, 0.15);
}

.negative-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #d9dee8;
  transition: background 0.18s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: #ffb344;
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.hidden {
  display: none;
}

.pop-menu.hidden {
  display: none;
}

.prompt-actions {
  display: grid;
  grid-template-columns: 116px 84px 82px 78px 116px 1fr;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.pill-button,
.generate-button,
.soft-button,
.primary-small {
  min-height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(129, 86, 30, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.soft-button,
.primary-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0 14px;
}

.primary-small {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(90deg, #fff7e8, #fff);
  color: #9a5a0f;
  font-weight: 800;
}

.pill-button {
  padding: 0 10px;
  width: 116px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-button.size-pill {
  width: 82px;
}

.pill-button.count-pill {
  width: 78px;
}

#optimizePrompt {
  width: 120px;
}

.pill-button.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.right-actions {
  display: grid;
  grid-template-columns: minmax(220px, 280px);
  justify-content: end;
  align-items: end;
  gap: 8px;
}

.generate-button {
  color: #111827;
  background: #fff;
  border-color: rgba(251, 191, 36, 0.4);
  min-height: 50px;
  font-weight: 600;
  width: 100%;
}

.hint {
  justify-self: end;
  margin: 0;
  color: #8b765c;
  font-size: 13px;
}

.generation-status {
  justify-self: stretch;
  min-height: 0;
  max-width: 280px;
  padding: 0;
  overflow: hidden;
  color: #8b765c;
  line-height: 1.35;
  text-align: right;
  white-space: normal;
}

.generation-status:empty {
  display: none;
}

.generation-status[data-tone="success"] {
  color: #15803d;
}

.generation-status[data-tone="error"] {
  color: #dc2626;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 14px;
}

.asset-card {
  height: 380px;
  padding: 20px 14px;
  background: linear-gradient(90deg, #fff 0%, #fff7ec 100%);
}

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  width: 146px;
  height: 108px;
  overflow: hidden;
  border: 1px dashed #decaa9;
  border-radius: 16px;
  background: #fffdf8;
}

.upload-box.dragging {
  border-color: #ff9828;
  background: #fff4dc;
  box-shadow: 0 0 0 4px rgba(255, 152, 40, 0.12);
}

.upload-box input {
  display: none;
}

.upload-icon {
  color: #d29b55;
  font-size: 22px;
}

.upload-icon .ico {
  margin-right: 0;
}

.upload-box strong {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 600;
}

.reference-preview {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  background: #fff;
}

.reference-preview.filled {
  display: block;
}

.reference-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #9a3412;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  margin-bottom: 10px;
}

.model-label {
  margin: 0;
}

.model-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 30px;
  max-width: 112px;
  padding: 0 10px;
  border: 1px solid rgba(251, 191, 36, 0.42);
  border-radius: 10px;
  background: #fffaf2;
  color: #c7791f;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.model-select-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.model-select-row img {
  grid-column: 1;
  grid-row: 1;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 9px;
}

.model-select-row strong {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111827;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
}

.model-select-row::after {
  content: "⌄";
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
  color: #6b7280;
  pointer-events: none;
}

.model-select-row select {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: 46px;
  opacity: 0;
  cursor: pointer;
}

.quality-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: start;
  gap: 12px;
  margin-top: 24px;
  min-height: 74px;
}

.quality-row strong {
  display: block;
  margin-bottom: 12px;
}

.quality-row small {
  display: block;
  max-width: 210px;
  color: #7e828d;
  font-size: 14px;
  line-height: 1.45;
}

.quality-row input {
  width: 44px;
  height: 24px;
  accent-color: #ffb344;
  justify-self: end;
}

.preview-card {
  min-height: 380px;
  height: auto;
  padding: 20px 24px;
  background: #fff;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.clear-history {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 10px;
  background: #fffaf2;
  color: #c7791f;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(320px, 40vh, 460px);
  min-height: 320px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #f0ddbd;
  border-radius: 16px;
  background: #fff;
}

.preview-grid {
  position: absolute;
  inset: 12px;
  margin: auto;
  z-index: 3;
  display: grid;
  gap: 14px;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.preview-image-card {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(45deg, rgba(248, 250, 252, 0.8) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(248, 250, 252, 0.8) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(248, 250, 252, 0.8) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(248, 250, 252, 0.8) 75%),
    #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.06);
}

.preview-image-card img {
  position: absolute;
  inset: 8px;
  width: 100%;
  height: 100%;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.preview-grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.preview-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

.preview-grid[data-count="3"],
.preview-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.preview-image-card[data-status="pending"],
.preview-image-card[data-status="loading"] {
  border-color: #f0ddbd;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.95)),
    repeating-linear-gradient(135deg, rgba(251, 191, 36, 0.18) 0 1px, transparent 1px 14px);
}

.preview-image-card[data-status="loading"]::before {
  content: "";
  position: absolute;
  width: 54px;
  height: 54px;
  border: 4px solid rgba(251, 191, 36, 0.2);
  border-top-color: #f59e0b;
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

.preview-image-card[data-status="error"] {
  border-color: #fecdd3;
  background: #fff1f2;
}

.slot-status {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 42px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #92400e;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 10px 24px rgba(146, 64, 14, 0.1);
}

.slot-status strong {
  font-size: 13px;
  white-space: nowrap;
}

.slot-status small {
  margin-top: 2px;
  color: #c7791f;
  font-size: 12px;
  font-weight: 800;
}

.preview-image-card[data-status="loading"] .slot-status {
  margin-top: 88px;
}

.preview-image-card[data-status="error"] .slot-status {
  color: #be123c;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.image-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.preview-image-card:hover .image-actions,
.history-item:hover .history-actions {
  opacity: 1;
  transform: translateY(0);
}

.image-action {
  min-width: 52px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(8px);
}

.history-strip {
  display: flex;
  gap: 10px;
  min-height: 82px;
  margin-top: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
}

.history-strip:empty {
  display: none;
}

.history-item {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 14px;
}

.history-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  overflow: hidden;
  padding: 0;
  border: 1px solid #f0ddbd;
  border-radius: 14px;
  background: #fff;
}

.history-thumb.active {
  border-color: #ff9828;
  box-shadow: 0 0 0 3px rgba(255, 152, 40, 0.16);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-count {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 34px;
  min-height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
}

.history-actions {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.history-action {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  padding: 0 4px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.preview-stage > img {
  width: min(60%, 380px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.preview-stage > img[src*="showcase"] {
  display: none;
}

.preview-stage::after {
  content: "生成的图像或视频将显示在这里";
  position: absolute;
  z-index: 1;
  color: #b1b4bb;
  font-size: 14px;
}

.preview-stage.has-image > img {
  opacity: 1;
}

.preview-stage.has-image::after {
  display: none;
}

.preview-stage.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, transparent, rgba(255, 205, 118, 0.16), transparent);
  animation: scan 1.4s ease-in-out infinite;
}

.preview-stage:has(.preview-grid)::after {
  display: none;
}

.preview-card p {
  margin: 12px 0 0;
  color: #9da1aa;
  text-align: center;
}

.community-card {
  margin-top: 28px;
  padding: 24px;
  background: #fff;
}

.footer {
  padding: 34px 0 0;
  color: #6b7280;
  text-align: center;
  font-size: 14px;
}

.footer p {
  margin: 6px 0;
}

.community-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.community-head p {
  margin: 8px 0 0;
  color: #8d929d;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.gallery button {
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #f7f8fb;
}

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

.community-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 44%) 1fr;
  gap: 22px;
  width: min(980px, calc(100vw - 36px));
  max-height: calc(100vh - 44px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: auto;
}

.community-modal > img {
  width: 100%;
  border-radius: 16px;
  object-fit: cover;
}

.close-community {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.community-copy {
  min-width: 0;
  padding-right: 12px;
}

.community-copy h2 {
  margin-bottom: 12px;
}

.community-copy pre {
  max-height: 430px;
  margin: 0 0 16px;
  padding: 14px;
  overflow: auto;
  border: 1px solid #f0ddbd;
  border-radius: 14px;
  background: #fffaf2;
  color: #1f2937;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: transparent;
}

#communityDialog {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(6px);
}

.settings-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.field-label {
  display: block;
  margin: 0 0 8px;
  color: #8a8f9c;
  font-size: 13px;
  font-weight: 800;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #f1f3f7;
  font-size: 22px;
}

.key-grid {
  display: grid;
  gap: 12px;
  margin: 10px 0 12px;
}

.key-field {
  display: grid;
  gap: 6px;
}

.key-field span {
  color: #111827;
  font-size: 14px;
  font-weight: 800;
}

.key-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7ef;
  border-radius: 12px;
  background: #fff;
}

.model-results {
  min-height: 24px;
  margin-top: 14px;
  color: #777d89;
  font-size: 14px;
}

.pop-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 400px;
  padding: 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 34px rgba(107, 114, 128, 0.2);
}

.pop-menu button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #fff8ef;
  color: #111827;
  font-size: 16px;
}

.size-menu {
  grid-template-columns: 1fr;
  width: 374px;
  gap: 10px;
}

.size-tier-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.size-tier-tabs button {
  min-height: 40px;
  font-weight: 800;
}

.size-submenu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.size-submenu button {
  min-height: 42px;
  padding: 0 10px;
  font-size: 15px;
  white-space: nowrap;
}

.size-menu button.active {
  background: #ffedd5;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.38);
}

.count-menu {
  grid-template-columns: repeat(2, 1fr);
  width: 150px;
}

@media (max-width: 1180px) {
  .prompt-actions {
    grid-template-columns: 116px 84px 82px 78px 120px 1fr;
  }

  .right-actions {
    grid-template-columns: minmax(180px, 1fr);
  }

  .lower-grid {
    gap: 28px;
  }

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

.style-size-menu {
  width: 400px;
}

.size-menu button[disabled] {
  cursor: not-allowed;
  opacity: 0.35;
}

@keyframes scan {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px;
    overflow-x: auto;
  }

  .brand {
    display: flex;
    margin: 0 12px 0 0;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .brand span {
    font-size: 18px;
  }

  .side-nav {
    display: flex;
    gap: 10px;
    width: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 42px;
  }

  .login-button {
    width: 86px;
    margin: 0 0 0 auto;
  }

  .socials {
    display: none;
  }

  .main-area {
    padding: 18px 12px 32px;
  }

  .lower-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (max-width: 720px) {
  .prompt-actions {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .right-actions {
    grid-column: 1 / -1;
    grid-template-columns: minmax(160px, 1fr);
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-card {
    min-height: 520px;
    padding: 22px 14px;
  }

  .preview-stage {
    min-height: 320px;
    height: 320px;
  }

  .community-modal {
    grid-template-columns: 1fr;
  }
}
