:root {
  color-scheme: dark;
  --bg: #070a10;
  --panel: rgba(15, 20, 29, 0.88);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: rgba(244, 247, 251, 0.62);
  --accent: #5bf0c5;
  --accent-strong: #b6ff65;
  --danger: #ff8f99;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; height: 72px; padding: 0 24px; border-bottom: 1px solid var(--panel-border); background: rgba(7, 10, 16, 0.9); backdrop-filter: blur(18px);
}
.brand-area, .account-area { display: flex; align-items: center; gap: 14px; }
.brand-wordmark { height: 40px; width: auto; }
.top-search {
  display: none; width: 300px; height: 40px; border-radius: 12px; background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.42); align-items: center; padding: 0 16px;
}
.top-nav { display: none; gap: 28px; color: rgba(255,255,255,0.78); }
.top-nav a:hover { color: #fff; }
.credit-pill, .tag-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(91,240,197,0.22);
  background: rgba(14, 37, 32, 0.7); color: var(--accent);
}
.tag-pill { padding: 4px 10px; font-size: 12px; background: rgba(255,255,255,0.08); color: #d7deea; border-color: rgba(255,255,255,0.12); }
.account-email { color: rgba(255,255,255,0.76); font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-shell { padding-bottom: 48px; }
.section-wrap { width: min(1280px, calc(100% - 40px)); margin: 0 auto; }
.eyebrow { color: rgba(255,255,255,0.56); text-transform: uppercase; letter-spacing: 0.18em; font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 28px 0 20px; }
.section-head h2 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 40px); }
.inline-link { color: rgba(255,255,255,0.68); }

.primary-button, .ghost-button, .mini-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--panel-border);
  transition: 0.2s ease;
}
.primary-button {
  background: linear-gradient(135deg, #51e9c2, var(--accent-strong)); color: #06130e; font-weight: 700; border: none;
}
.ghost-button, .mini-button {
  background: rgba(255,255,255,0.03); color: #fff;
}
.ghost-button:hover, .mini-button:hover { background: rgba(255,255,255,0.08); }
.disabled { pointer-events: none; opacity: 0.45; }

.panel-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 24px; padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.28);
}
.panel-title { font-size: 28px; font-weight: 700; margin-bottom: 18px; }
.panel-kicker, .bar-kicker { color: rgba(255,255,255,0.48); font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em; }
.feedback-text { color: var(--muted); font-size: 14px; line-height: 1.7; }
.error-box {
  padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 143, 153, 0.28); background: rgba(91, 8, 18, 0.35); color: #ffd4d8;
}

.hero-section {
  position: relative; min-height: 560px; display: flex; align-items: center; overflow: hidden; padding: 72px 0;
}
.hero-backdrop {
  position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.34;
}
.hero-backdrop::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at top, rgba(84,105,255,0.22), transparent 22rem),
    linear-gradient(180deg, rgba(3,4,8,0.08), rgba(4,6,12,0.78) 48%, rgba(6,7,12,1) 100%);
}
.hero-content {
  position: relative; z-index: 2; width: min(980px, calc(100% - 40px)); margin: 0 auto; text-align: center;
}
.hero-title { margin: 18px 0; font-size: clamp(48px, 8vw, 96px); line-height: 1.03; }
.hero-title span { background: linear-gradient(135deg, #ff7c8d, #cb73ff); -webkit-background-clip: text; color: transparent; }
.hero-description { max-width: 760px; margin: 0 auto; color: var(--muted); font-size: 18px; line-height: 1.9; }
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.gallery-grid {
  display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 180px; grid-auto-flow: dense;
}
.gallery-card { position: relative; overflow: hidden; border-radius: 28px; min-height: 180px; }
.gallery-card img { width: 100%; height: 100%; object-fit: cover; }
.gallery-card .gallery-overlay {
  position: absolute; inset: auto 0 0; padding: 18px; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.82));
}
.gallery-card h3 { margin: 10px 0 0; }
.gallery-card p { margin: 8px 0 0; color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.6; }
.span-wide { grid-column: span 2; }
.span-tall { grid-row: span 2; }
.span-feature { grid-column: span 2; grid-row: span 2; }
.span-standard { grid-column: span 1; }

.feature-grid, .workflow-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.workflow-card { padding: 18px; border: 1px solid var(--panel-border); border-radius: 22px; background: rgba(255,255,255,0.03); }
.workflow-step { color: #8aaeff; letter-spacing: 0.18em; font-size: 13px; }
.faq-grid { display: grid; gap: 24px; grid-template-columns: 0.9fr 1.1fr; }
.faq-card summary { cursor: pointer; font-weight: 700; }
.faq-card p { color: var(--muted); line-height: 1.8; }
.cta-card { border-radius: 32px; border: 1px solid var(--panel-border); padding: 28px; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); }
.home-prompt-card { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 24px; margin-top: -44px; position: relative; z-index: 3; }
.home-prompt-card p { color: var(--muted); line-height: 1.8; }
.home-prompt-shell { border-radius: 24px; border: 1px solid rgba(255,255,255,0.08); background: #0b0f16; padding: 18px; }
.home-prompt-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.member-upgrade-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.72fr);
  gap: 24px;
  margin-top: 28px;
  border: 1px solid rgba(214, 178, 104, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(217, 176, 99, 0.12), rgba(255,255,255,0.02) 42%, rgba(91,240,197,0.06)),
    #0c0f17;
  box-shadow: 0 24px 70px rgba(0,0,0,0.36);
  padding: 24px;
}

#member-service {
  scroll-margin-top: 92px;
}

.member-upgrade-copy {
  min-width: 0;
}

.member-upgrade-copy h2 {
  max-width: 760px;
  margin: 10px 0 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.18;
}

.member-upgrade-lead {
  max-width: 820px;
  margin: 0;
  color: rgba(244,247,251,0.72);
  font-size: 16px;
  line-height: 1.9;
}

.member-benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.member-benefit-grid article,
.member-contact-card,
.member-note {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(6, 8, 13, 0.54);
}

.member-benefit-grid article {
  padding: 16px;
}

.member-benefit-grid span {
  display: inline-flex;
  color: #d8b26b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.member-benefit-grid h3 {
  margin: 10px 0 8px;
  font-size: 17px;
}

.member-benefit-grid p,
.member-note p,
.member-offer-row p {
  margin: 0;
  color: rgba(244,247,251,0.66);
  line-height: 1.75;
}

.member-offer-row {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(220px, 0.8fr);
  gap: 14px;
  align-items: stretch;
  margin-top: 16px;
}

.member-price-label {
  color: rgba(244,247,251,0.56);
  font-size: 13px;
}

.member-price {
  margin: 4px 0 6px;
  color: #ead08f;
  font-size: 22px;
  font-weight: 700;
}

.member-price span {
  font-size: clamp(50px, 7vw, 76px);
  line-height: 0.95;
}

.member-contact-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
}

.member-contact-card strong {
  color: #fff;
}

.member-contact-card span {
  color: rgba(244,247,251,0.68);
}

.member-note {
  margin-top: 16px;
  padding: 16px;
}

.member-note strong {
  display: block;
  margin-bottom: 6px;
  color: #ead08f;
}

.member-upgrade-poster {
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(214,178,104,0.28);
  border-radius: 22px;
  background: #06070b;
  max-height: 760px;
}

.member-upgrade-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

body[data-page="studio"] {
  background:
    radial-gradient(circle at 16% 18%, rgba(85, 119, 255, 0.1), transparent 18rem),
    radial-gradient(circle at 84% 14%, rgba(128, 79, 255, 0.08), transparent 18rem),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #070a10;
  background-size: auto, auto, 96px 96px, 96px 96px, auto;
}

body[data-page="studio"] .topbar {
  height: 64px;
  border-bottom-color: rgba(255,255,255,0.08);
  background: rgba(7, 10, 16, 0.94);
}

.page-shell-studio {
  padding-bottom: 0;
}

.studio-page {
  position: relative;
  display: grid;
  min-height: calc(100vh - 64px);
  grid-template-columns: 464px minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(11, 13, 22, 0.96), rgba(7, 8, 14, 0.98));
  box-shadow: 0 34px 90px rgba(3, 6, 15, 0.6);
}

.studio-input {
  min-height: calc(100vh - 64px);
  border-right: 1px solid rgba(255,255,255,0.08);
  background: #0b0f15;
  display: flex;
  flex-direction: column;
}

.studio-panel-head {
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 20px 24px;
}

.studio-panel-head h1,
.results-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
}

.studio-input-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px;
}

.field-block {
  margin-bottom: 28px;
}

.field-block label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  color: #fff;
}

.field-block label span {
  color: #ff4c5f;
}

.field-block label em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #5a6370;
  color: #8994a3;
  font-size: 10px;
  font-style: normal;
}

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

.text-input,
.textarea-input,
.select-input {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #2b333f;
  background: #0d1117;
  color: #dbe4ef;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.text-input {
  height: 48px;
  padding: 0 14px;
  font-size: 14px;
}

.textarea-input {
  min-height: 160px;
  resize: vertical;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.75;
}

.select-input {
  height: 48px;
  padding: 0 14px;
  font-size: 14px;
}

.text-input::placeholder,
.textarea-input::placeholder {
  color: #6e7785;
}

.text-input:focus,
.textarea-input:focus,
.select-input:focus {
  border-color: rgba(83,243,183,0.7);
  box-shadow: 0 0 0 1px rgba(83,243,183,0.08);
}

.readonly-row {
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 6px;
  border: 1px solid #2b333f;
  background: #0d1117;
  padding: 0 14px;
  color: #aeb8c5;
  font-size: 14px;
}

.readonly-row strong {
  color: #52ffc1;
  font-size: 14px;
  font-weight: 600;
}

.image-item {
  display: block;
  margin-bottom: 16px;
}

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

.image-preview {
  position: relative;
  display: flex;
  width: 100%;
  height: 180px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #2b333f;
  background: #000;
  color: inherit;
  padding: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.image-preview:hover,
.image-preview.dragover {
  border-color: rgba(83,243,183,0.6);
  box-shadow: 0 0 0 1px rgba(83,243,183,0.12), 0 0 28px rgba(83,243,183,0.12);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.preview-placeholder {
  max-width: 280px;
  padding: 0 18px;
  text-align: center;
  color: #c8d1dc;
  font-size: 14px;
  line-height: 1.7;
}

.preview-placeholder strong {
  display: block;
  margin-bottom: 8px;
  color: #87919f;
  font-size: 28px;
  line-height: 1;
}

.upload-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(83,243,183,0.34);
  background: rgba(10,15,22,0.86);
  padding: 8px 14px;
  color: #dffff5;
  font-size: 13px;
}

.image-url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 12px;
}

.image-url-row .image-url-input {
  flex: 1 1 auto;
  min-width: 0;
}

.image-error,
.image-file-name {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.image-error {
  color: #ff8a98;
}

.image-file-name {
  overflow: hidden;
  color: #7d8796;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-button {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid rgba(255, 84, 103, 0.5);
  background: rgba(85, 13, 26, 0.62);
  color: #ffd7dd;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.remove-button:hover {
  border-color: rgba(255,106,122,0.9);
  background: rgba(132, 18, 37, 0.82);
  color: #fff;
}

.tech-line-button,
.mini-button {
  min-height: 30px;
  border-radius: 4px;
  border-color: #53f3b7;
  background: transparent;
  padding: 0 12px;
  color: #53f3b7;
  font-size: 12px;
}

.template-library {
  border-radius: 8px;
  border: 1px solid #27313e;
  background: #0d1117;
  padding: 16px;
  box-shadow: 0 0 28px rgba(83,243,183,0.04);
}

.template-library.is-collapsed .template-head {
  margin-bottom: 0;
}

.template-library.is-collapsed .template-body {
  display: none;
}

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

.template-head label {
  margin-bottom: 0;
}

.template-head p {
  margin: 6px 0 0;
  color: #8190a3;
  font-size: 12px;
  line-height: 1.5;
}

.template-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.template-toggle {
  min-width: 72px;
  border-color: #2d3847;
  color: #dbe4ef;
}

.template-toggle:hover {
  border-color: rgba(83,243,183,0.55);
}

.template-toggle-icon {
  color: #53f3b7;
  line-height: 1;
}

.template-body {
  display: block;
}

.tag-pill {
  border-radius: 999px;
  border: 1px solid #2b333f;
  background: #0f141c;
  color: #aeb8c5;
}

.template-head .tag-pill {
  border-color: rgba(83,243,183,0.4);
  color: #53f3b7;
}

.template-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0 14px;
  padding-bottom: 4px;
}

.template-chip {
  flex: 0 0 auto;
  border: 1px solid #2d3847;
  border-radius: 999px;
  background: transparent;
  color: #8f9bad;
  padding: 7px 12px;
  font-size: 12px;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.template-chip:hover,
.template-chip.active {
  border-color: #53f3b7;
  background: rgba(83,243,183,0.1);
  color: #53f3b7;
}

.template-list {
  display: grid;
  max-height: 420px;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.template-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  width: 100%;
  border: 1px solid #27313e;
  border-radius: 6px;
  background: rgba(0,0,0,0.35);
  padding: 8px;
  color: inherit;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.template-item:hover {
  border-color: rgba(83,243,183,0.7);
  background: #102018;
}

.template-item img {
  width: 86px;
  height: 64px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #000;
  object-fit: cover;
}

.template-item h4 {
  overflow: hidden;
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-item p {
  overflow: hidden;
  margin: 6px 0 8px;
  color: #7e8a9a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.has-template-confirm {
  overflow: hidden;
}

.template-confirm {
  position: fixed;
  inset: 0;
  z-index: 118;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 8, 0.58);
  backdrop-filter: blur(8px);
  padding: 18px;
  box-sizing: border-box;
}

.template-confirm-shell {
  width: min(920px, 100%);
  max-height: min(88vh, 820px);
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #2b333f;
  background: #0d1117;
  box-shadow: 0 28px 80px rgba(0,0,0,0.52);
  padding: 18px;
}

.template-confirm-shell h3 {
  margin: 6px 0 10px;
  color: #fff;
  font-size: 18px;
}

.template-confirm-message {
  margin: 0;
  color: #aeb8c5;
  font-size: 13px;
  line-height: 1.7;
}

.template-confirm-name {
  border-radius: 6px;
  border: 1px solid #27313e;
  background: rgba(0,0,0,0.28);
  padding: 12px;
  color: #dbe4ef;
  font-size: 14px;
  font-weight: 600;
}

.template-confirm-body {
  display: grid;
  grid-template-columns: minmax(230px, 330px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.template-confirm-image-button {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #27313e;
  border-radius: 6px;
  background: #05070a;
  cursor: zoom-in;
  padding: 0;
}

.template-confirm-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.template-confirm-copy {
  min-width: 0;
}

.template-confirm-preview {
  margin-top: 14px;
  border-radius: 6px;
  border: 1px solid #27313e;
  background: rgba(0,0,0,0.18);
  padding: 12px;
}

.template-confirm-prompt {
  margin: 8px 0 0;
  color: #dbe4ef;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.template-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.template-confirm-actions .ghost-button,
.template-confirm-actions .primary-button {
  min-height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

.studio-action-bar {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 20px;
  flex: 0 0 auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: #0b0f15;
  padding: 20px;
}

.studio-action-feedback {
  grid-column: 1 / -1;
  min-height: 20px;
  margin-top: -8px;
  color: #ffb7c0;
  font-size: 13px;
  line-height: 1.55;
}

.primary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 6px;
}

.studio-action-bar .ghost-button {
  height: 48px;
  background: #151b25;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.studio-action-bar .primary-button {
  height: 48px;
  background: linear-gradient(90deg,#51f2bb,#c6ff8c);
  color: #06120c;
  font-size: 14px;
  font-weight: 700;
}

.studio-results {
  display: flex;
  min-width: 0;
  min-height: calc(100vh - 64px);
  flex-direction: column;
  overflow: hidden;
  background: #070a10;
  padding: 0 24px 24px;
}

.results-header {
  display: flex;
  height: 80px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  scroll-margin-top: 72px;
}

.results-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.results-tools .ghost-button {
  border-color: #2b333f;
  background: #121822;
  color: #dce4ee;
  font-size: 14px;
}

.result-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
}

.feedback-text {
  color: #7d8796;
  font-size: 13px;
  line-height: 1.6;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preview-stage {
  position: relative;
  display: flex;
  min-height: 58vh;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.preview-stage.has-result {
  cursor: zoom-in;
}

.preview-stage.has-preview-base {
  min-height: 58vh;
  flex: 1 1 auto;
}

.empty-state {
  max-width: 420px;
  padding: 40px;
  text-align: center;
  color: #87919f;
}

.empty-state h3 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
}

.compare-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58vh;
  height: 100%;
  overflow: hidden;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
}

.preview-stage.has-preview-base .compare-stage {
  aspect-ratio: var(--preview-base-aspect);
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
}

.compare-stage.hidden,
.hidden {
  display: none !important;
}

.preview-stage.is-comparing #compare-stage {
  display: flex !important;
}

#compare-output {
  position: relative;
  z-index: 1;
  display: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #000;
}

.compare-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  clip-path: inset(0 50% 0 0);
  pointer-events: none;
}

.compare-overlay img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #000;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 2px;
  background: rgba(255,255,255,0.95);
  pointer-events: none;
  transform: translateX(-1px);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(18,23,34,0.92);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
}

.current-image-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  border-radius: 6px;
  border: 1px solid #2b333f;
  background: #0d1117;
  padding: 16px;
}

body.has-image-lightbox {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 8, 0.88);
  backdrop-filter: blur(12px);
  padding: 24px;
}

.image-lightbox-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.image-lightbox-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  border: 1px solid #2b333f;
  background: rgba(13, 17, 23, 0.92);
  padding: 12px 14px;
}

.image-lightbox-title {
  display: inline-flex;
  margin-right: 12px;
  color: #fff;
  font-size: 16px;
}

.image-lightbox-meta {
  color: #8f9bad;
  font-size: 12px;
}

.image-lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.image-lightbox-zoom {
  min-width: 58px;
  color: #8f9bad;
  font-size: 12px;
  text-align: right;
}

.image-lightbox-actions .ghost-button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.image-lightbox-zoom-in,
.image-lightbox-zoom-out {
  min-width: 36px;
  padding: 0;
}

.image-lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 24px 70px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.08);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.image-lightbox-stage.is-zoomed {
  cursor: grabbing;
}

.image-lightbox-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  transition: transform 90ms ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.bar-kicker {
  color: #7d8796;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.recent-history {
  margin-top: auto;
  padding-top: 20px;
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.recent-head .panel-title {
  margin: 0;
  font-size: 14px;
}

.recent-head a {
  color: #8eb1ff;
  font-size: 12px;
}

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

.history-card {
  border: 1px solid #2b333f;
  border-radius: 8px;
  background: #0f141c;
  padding: 12px;
}

.history-card-top {
  display: grid;
  grid-template-columns: 144px 1fr;
  gap: 14px;
  align-items: start;
}

.history-thumb {
  position: relative;
  display: flex;
  width: 144px;
  height: 96px;
  align-items: center;
  justify-content: center;
  overflow: visible;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: #000;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.history-card h4 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 14px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.history-lines {
  color: #7d8796;
  font-size: 12px;
  line-height: 1.6;
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.history-card button,
.history-card a {
  min-height: 34px;
  border-radius: 6px;
  font-size: 12px;
}

.history-hide {
  color: #ffb2bc;
  border-color: rgba(255,143,153,0.22);
}

.history-delete {
  color: #ffd0d6;
  border-color: rgba(255,84,103,0.34);
  background: rgba(59, 16, 24, 0.38);
}

.history-card button:disabled,
.history-card a.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.history-card-failed {
  border-color: rgba(255, 102, 120, 0.35);
}

.history-status-thumb {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  color: #aeb8c5;
  text-align: center;
  overflow: hidden;
}

.history-source-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.62;
  filter: saturate(0.72) contrast(0.9);
}

.history-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(58, 8, 18, 0.48);
  backdrop-filter: blur(1px);
}

.history-status-thumb strong {
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 20px;
  line-height: 1;
  background: rgba(20, 8, 12, 0.32);
}

.history-status-thumb span {
  font-size: 12px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
}

.history-status-thumb.is-failed {
  background: #000;
  color: #ff9ba8;
}

.history-status-thumb.is-running {
  background: #000;
  color: #a8c7ff;
}

.history-status-thumb.is-running .history-status-overlay {
  background: rgba(12, 23, 43, 0.42);
}

.history-status-pill {
  border-color: rgba(255,255,255,0.14);
}

.history-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 12;
  width: 320px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.98);
  border: 1px solid rgba(255,255,255,0.12);
  color: #d7dfeb;
  line-height: 1.7;
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: 0.16s ease;
}

.history-thumb:hover .history-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.history-more {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.studio-results .history-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.studio-results .history-card {
  min-width: 0;
  padding: 10px;
}

.studio-results .history-card-top {
  display: block;
}

.studio-results .history-thumb {
  width: 100%;
  height: 86px;
  margin-bottom: 10px;
}

.studio-results .history-meta {
  gap: 5px;
  margin-bottom: 7px;
}

.studio-results .history-meta .tag-pill {
  padding: 3px 7px;
  font-size: 11px;
}

.studio-results .history-card h4 {
  overflow: hidden;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-results .history-lines {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-results .history-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}

.studio-results .history-card button,
.studio-results .history-card a {
  min-height: 30px;
  padding: 0 6px;
  font-size: 11px;
}

.auth-wrap { min-height: calc(100vh - 72px); display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: min(520px, 100%); display: grid; gap: 14px; }
.auth-logo { height: 56px; width: auto; margin-bottom: 4px; }
.auth-card h1 { margin: 0; font-size: 36px; }
.auth-card p { margin: 0 0 8px; color: var(--muted); line-height: 1.8; }
.auth-link { text-align: center; color: var(--accent); }

.admin-card { max-width: 760px; }

@media (min-width: 980px) {
  .top-search, .top-nav { display: flex; }
}

@media (max-width: 1100px) {
  .studio-page, .faq-grid, .feature-grid, .workflow-grid, .history-grid, .member-upgrade-card, .member-benefit-grid, .member-offer-row { grid-template-columns: 1fr; }
  .home-prompt-card { grid-template-columns: 1fr; margin-top: 12px; }
  .member-upgrade-poster { max-height: 620px; }
  .studio-input { min-height: auto; border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .studio-results { min-height: auto; }
  .history-card-top { grid-template-columns: 1fr; }
  .history-thumb { width: 100%; height: 180px; }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 16px; }
  body[data-page="studio"] .topbar { height: auto; }
  .account-area { width: 100%; justify-content: flex-end; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 160px; }
  .span-wide, .span-feature, .span-tall { grid-column: span 1; grid-row: span 1; }
  .current-image-bar, .section-head, .results-header, .field-grid, .result-status-row { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .section-wrap { width: min(100%, calc(100% - 24px)); }
  .preview-stage, .compare-stage { min-height: 360px; }
  .studio-results { padding: 0 12px 20px; }
  .studio-input-scroll { padding: 18px; }
  .studio-action-bar { grid-template-columns: 1fr; gap: 10px; }
  .image-url-row { display: grid; grid-template-columns: 1fr 48px; }
  .image-lightbox { padding: 12px; }
  .image-lightbox-toolbar { align-items: stretch; flex-direction: column; }
  .image-lightbox-actions { justify-content: stretch; }
  .image-lightbox-actions .ghost-button { flex: 1 1 auto; }
  .template-confirm-body { grid-template-columns: 1fr; }
  .template-confirm-image-button { max-height: 320px; }
}
