:root {
  --bg: #ffffff;
  --ink: #15171f;
  --ink-2: #333333;
  --muted: #8b8e99;
  --muted-2: rgba(20, 22, 31, 0.7);
  --line: rgba(24, 22, 31, 0.12);
  --line-strong: rgba(24, 22, 31, 0.2);
  --soft: #f0f1f7;
  --purple: #7657ff;
  --create: #15171f;
  --notice: #f4f55c;
  --hot: #8a70ff;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --side: 88px;
  --content-pad-x: clamp(24px, 7.8vw, 149px);
  --content-pad-right: clamp(24px, 8.6vw, 165px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  line-height: 1.5;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

.notice {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  height: 44px;
  min-height: 44px;
  padding: 0 44px 0 16px;
  background: var(--notice);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 400;
}
.notice-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.notice-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  background: #15171f;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}
.notice-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  color: #333;
}
.notice-close:hover { background: rgba(0,0,0,.06); }
body.notice-off .notice { display: none; }

.shell {
  display: flex;
  min-height: calc(100vh - 44px);
  min-height: calc(100dvh - 44px);
}
body.notice-off .shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--side);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 16px;
  background: #fff;
  z-index: 30;
}
.side-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 22px;
  flex: 0 0 auto;
}
.side-logo img { width: 100%; height: 100%; object-fit: cover; }

.side-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex: 1;
  padding: 0 4px;
}
.side-item {
  position: relative;
  width: 64px;
  min-height: 58px;
  margin: 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 0 4px;
  border-radius: 12px;
  color: var(--muted-2);
}
.side-item:hover { background: rgba(240, 241, 247, .7); color: var(--ink); }
.side-item.is-active {
  background: var(--soft);
  color: var(--ink);
}
.side-item.is-active .side-ico { color: var(--purple); }
.side-ico {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}
.side-ico svg { width: 22px; height: 22px; }
.side-label {
  font-size: 12px;
  font-weight: 300;
  line-height: 16px;
  white-space: nowrap;
}
.badge-hot,
.badge-h3 {
  position: absolute;
  top: 4px;
  right: 2px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  color: #fff;
}
.badge-hot { background: var(--hot); }
.badge-h3 { background: var(--purple); }

.side-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 0 8px;
}
.side-price {
  width: 100%;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid rgba(118, 87, 255, .35);
  background: rgba(118, 87, 255, .06);
  color: var(--purple);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}
.side-login {
  min-width: 55px;
  height: 33px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 12px;
}
.side-login:hover { background: var(--soft); }
.side-link { color: var(--muted); font-size: 12px; padding: 2px; }
.side-more {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  letter-spacing: 1px;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 0 var(--content-pad-right) 48px var(--content-pad-x);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 48px;
  height: 56px;
  align-items: end;
}
.mode-tab {
  position: relative;
  display: block;
  height: 56px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  overflow: visible;
  text-align: left;
}
.mode-blob {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180%;
  background: var(--purple);
  border-radius: 80% 80% 0 0;
  z-index: 0;
  pointer-events: none;
}
.mode-shell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 24px;
  border-radius: 16px;
  background: var(--soft);
  color: var(--ink);
}
.mode-tab.is-active .mode-shell {
  height: 56px;
  border-radius: 34px 34px 8px 8px;
  background: transparent;
  color: #f5f6ff;
}
.mode-ico {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: inherit;
}
.mode-ico svg { width: 22px; height: 22px; }
.mode-tab:not(.is-active) .mode-ico { color: #6b6f7a; }
.mode-tab.is-active .mode-ico { color: #f5f6ff; }

.hero {
  text-align: left;
  margin: 40px 0 16px;
}
.hero h1 {
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  line-height: 32px;
}
.hero-sub {
  margin-top: 0;
  font-size: 32px;
  font-weight: 600;
  color: var(--purple);
  line-height: 48px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #fff;
  padding: 16px;
  min-height: 210px;
}
.composer-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex: 1;
}
.ref-box {
  flex: 0 0 85px;
  width: 85px;
  height: 114px;
  border-radius: 12px;
  border: 1px dashed rgba(24, 22, 31, .22);
  background: #fafafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.ref-plus {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--ink);
  line-height: 1;
}
#q {
  flex: 1;
  min-width: 0;
  min-height: 114px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 300;
  line-height: 24px;
  padding: 0;
}
#q::placeholder { color: #a0a3ad; }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bar-left, .bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.model { background: rgba(118, 87, 255, .1); color: var(--purple); }
.pill.ghost { background: transparent; border: 1px solid var(--line); color: #6b6f7a; }
.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}
.credit, .coins {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--soft);
  color: #6b6f7a;
  font-size: 12px;
  font-weight: 600;
}
.coins::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd56a, #f0a020);
}
.btn-create {
  height: 38px;
  min-width: 75px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--create);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.promos {
  display: flex;
  gap: 12px;
  margin: 32px 0 24px;
}
.promo {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 151px;
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  color: #fff;
}
.promo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.promo.dark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.28));
}
.promo.purple::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(72, 42, 180, .72), rgba(118, 87, 255, .25));
}
.promo-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 24px;
  max-width: 78%;
}
.promo-copy strong {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.promo-copy span {
  font-size: 13px;
  opacity: .88;
  line-height: 1.45;
}

.cats {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0 14px;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto;
  position: relative;
  padding: 8px 14px;
  color: #6b6f7a;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  border-radius: 10px;
}
.cat em {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(118, 87, 255, .12);
  color: var(--purple);
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
}
.cat.is-active {
  color: var(--purple);
  font-weight: 500;
}
.cat.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--purple);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.gal-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.card {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #eceef5;
  padding: 0;
}
.card.landscape { aspect-ratio: 16 / 9; }
.card.portrait { aspect-ratio: 9 / 16; }
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.card:hover img { transform: scale(1.03); }
.likes {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.42);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.likes::before { content: "♡"; font-size: 12px; line-height: 1; }

.login-modal,
.wa-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-modal[hidden],
.wa-modal[hidden] { display: none; }
.login-backdrop,
.wa-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 23, 31, .45);
}
.login-panel {
  position: relative;
  width: min(400px, 100%);
  border-radius: 20px;
  background: #fff;
  padding: 36px 28px 28px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(21, 23, 31, .18);
}
.login-close,
.wa-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 20px;
  color: #6b6f7a;
}
.login-logo { margin: 0 auto 14px; border-radius: 12px; }
.login-panel h2 { font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.login-sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.btn-google,
.btn-outline {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}
.btn-google {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn-google svg { width: 20px; height: 20px; }
.btn-outline { background: var(--soft); color: var(--ink); }
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-tip { margin-top: 16px; color: var(--muted); font-size: 12px; }

.wa-modal-panel {
  position: relative;
  width: min(420px, 100%);
  height: min(520px, calc(100vh - 48px));
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 64px rgba(21, 23, 31, .22);
}
.wa-modal-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

@media (max-width: 1280px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gal-col:last-child { display: none; }
}
@media (max-width: 980px) {
  :root {
    --content-pad-x: 24px;
    --content-pad-right: 24px;
  }
  .mode-tabs { margin-top: 24px; gap: 12px; }
  .hero h1,
  .hero-sub { font-size: 28px; }
  .hero-sub { line-height: 40px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gal-col:nth-child(n + 3) { display: none; }
  .promos { flex-direction: column; }
}
@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    left: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    min-height: 0;
    height: 64px;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }
  .side-logo,
  .side-bottom,
  .side-item:nth-child(n + 5) { display: none; }
  .side-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
    padding: 0;
  }
  .side-item {
    width: auto;
    min-height: 0;
    padding: 6px 8px;
    margin: 0;
  }
  .main { padding: 12px 14px 88px; }
  .mode-tabs {
    grid-template-columns: 1fr;
    height: auto;
    gap: 8px;
  }
  .mode-tab { height: 48px; }
  .mode-shell {
    height: 48px !important;
    border-radius: 14px !important;
    justify-content: center;
  }
  .mode-tab.is-active .mode-shell {
    background: var(--purple);
    color: #fff;
  }
  .mode-blob { display: none; }
  .composer-body { flex-direction: column; }
  .ref-box {
    width: 100%;
    height: 64px;
    flex-direction: row;
    flex: none;
  }
  .hero h1,
  .hero-sub { font-size: 24px; line-height: 1.25; }
}
@media (max-width: 480px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
