:root {
  --bg: #fff;
  --surface: #fff;
  --sidebar: rgba(127, 78, 255, .2);
  --sidebar-strong: #dfd2ff;
  --soft: #f7f6f9;
  --text: #333;
  --muted: rgba(0, 0, 0, .45);
  --line: #e6e3ea;
  --purple: #8247f5;
  --purple-2: #a081f7;
  --purple-soft: #eee6ff;
  --danger: #e95372;
  --success: #2ab673;
  --shadow: 0 18px 55px rgba(38, 25, 65, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5714 Inter, "PingFang SC", -apple-system, system-ui, "Helvetica Neue", Roboto, "Noto Sans", "Source Han Sans SC", "Microsoft YaHei", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.ui-svg { display: block; width: 1em; height: 1em; }

body.dark {
  --bg: #111015;
  --surface: #19171f;
  --sidebar: #211c31;
  --sidebar-strong: #302641;
  --soft: #211f27;
  --text: #f5f2fa;
  --muted: #ada8b5;
  --line: #312e38;
  --purple-soft: #312452;
  --shadow: 0 18px 60px rgba(0, 0, 0, .4);
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 230px;
  flex-direction: column;
  padding: 12px 12px 10px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 0;
}
.brand {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: 58px;
  color: transparent;
  background: linear-gradient(130deg, #7b45f5, #f06167);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -3px;
  cursor: pointer;
}
.brand { align-items: center; }
.brand-logo { display: block; width: 65.21875px; height: 40px; object-fit: contain; }
.brand b { font-size: 45px; line-height: .9; }
.brand sup { margin: 2px 0 0 3px; font-size: 14px; }
.menu-search {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 5px;
  height: 34px;
  margin: 12px 0 12px;
  padding: 0 9px;
  color: #857e91;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(72, 53, 104, .12);
  border-radius: 4px;
  cursor: pointer;
}
.menu-search span:nth-child(2) { text-align: left; font-size: 12px; }
.search-icon { font-size: 16px; }
kbd { padding: 1px 5px; color: #8e86a0; border: 1px solid rgba(72, 53, 104, .13); border-radius: 4px; font-size: 10px; }
.nav-list { display: grid; gap: 4px; }
.nav-item, .bottom-item {
  display: grid;
  width: 100%;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  min-height: 40px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active, .bottom-item:hover, .bottom-item.active { background: rgba(127, 78, 255, .2); }
.nav-item strong, .bottom-item strong { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 14px; font-weight: 700; line-height: 40px; }
.premium-crown { display: inline-grid; width: 16px; height: 16px; flex: 0 0 16px; place-items: center; vertical-align: middle; }
.premium-crown .ui-svg { width: 16px; height: 16px; }
.nav-icon { display: grid; width: 16px; height: 40px; place-items: center; text-align: center; font-size: 16px; }
.nav-tail { display: grid; width: 14px; place-items: center; color: #333; font-size: 14px; }
.nav-emoji { justify-self: end; font-size: 12px; line-height: 40px; }
.flag-icon { width: 18px; font-size: 14px; }
.model-mark { display: grid; width: 1em; height: 1em; place-items: center; font-size: .78em; font-weight: 700; line-height: 1; }
.mini-badge { padding: 2px 5px; border-radius: 4px; color: white; background: var(--purple); font-size: 9px; font-weight: 800; }
.sidebar-bottom { margin: auto -4px 0; padding-top: 12px; }
.sidebar-bottom .bottom-item { min-height: 39px; padding-inline: 16px; }
.payment-icon { display: grid; width: 24px; height: 16px; place-items: center; }
.payment-icon .ui-svg { width: 24px; height: 16px; }
.upgrade-row { grid-template-columns: 30px 1fr auto; }
.upgrade-row { border-bottom: 1px solid rgba(70, 47, 105, .1); margin-bottom: 5px; }
.legal { display: flex; gap: 10px; padding: 9px 18px 0; color: rgba(0, 0, 0, .45); font-size: 11px; white-space: nowrap; }
.legal a:hover { color: var(--purple); }

.page { min-height: 100vh; margin-left: 230px; }
.topbar {
  position: relative;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 16px;
  background: var(--bg);
}
.topbar-title { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 { flex: 1; margin: 0; color: #333; font-size: 22px; font-weight: 500; line-height: 34.5714px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn, .mobile-menu {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-btn:hover { background: var(--soft); }
.mobile-menu { display: none; font-size: 20px; }
.primary-btn, .generate-btn {
  border: 0;
  border-radius: 7px;
  color: white;
  background: linear-gradient(130deg, var(--purple), #925cf7);
  box-shadow: 0 7px 18px rgba(130, 71, 245, .2);
  cursor: pointer;
  font-weight: 650;
}
.primary-btn { min-height: 34px; padding: 6px 17px; border-radius: 8px; }
.top-actions .primary-btn { width: auto; height: 32px; min-height: 32px; padding: 6px 16px; font-size: 14px; font-weight: 600; line-height: 22px; box-shadow: none; }
.top-actions .primary-btn:hover { transform: none; }
.primary-btn:hover, .generate-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.secondary-btn { padding: 8px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }

/* Home */
.home-content { padding: 0 16px 45px; }
.tool-showcase { position: relative; padding-top: 10px; }
.tool-rail { display: grid; grid-auto-flow: column; grid-auto-columns: 420px; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tool-rail::-webkit-scrollbar { display: none; }
.tool-card { min-width: 0; scroll-snap-align: start; cursor: pointer; }
.tool-thumb { height: 236.25px; overflow: hidden; border-radius: 10px; background: var(--soft); }
.tool-thumb img, .tool-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tool-card h3 { margin: 10px 14px 0; font-size: 16px; font-weight: 700; line-height: 25.1429px; }
.tool-card p { margin: 3px 14px 12px; color: rgba(0, 0, 0, .65); font-size: 13px; line-height: 19.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.dark .topbar h1, body.dark .tool-card p { color: var(--text); }
.rail-arrow { position: absolute; z-index: 2; top: 113.95px; display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: white; background: rgba(0, 0, 0, .55); cursor: pointer; font-size: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.rail-arrow .ui-svg { width: 1em; height: 1em; }
.rail-arrow.left { left: 6px; }
.rail-arrow.right { right: 6px; }
.feed-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 34px 0 15px; }
.feed-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.filter-group { display: flex; padding: 3px; background: var(--soft); border-radius: 8px; }
.filter-btn { padding: 6px 14px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.filter-btn.active { color: white; background: var(--purple); }
.masonry { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.masonry-column { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.feed-card { position: relative; overflow: hidden; border-radius: 12px; background: rgba(0,0,0,.06); cursor: pointer; }
.feed-card img, .feed-card video { display: block; width: 100%; aspect-ratio: var(--ratio); object-fit: cover; }
.feed-card::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(7, 6, 10, .76)); }
.feed-hover { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; visibility: hidden; opacity: 0; background: rgba(0, 0, 0, .3); border-radius: 12px; transition: opacity .16s ease, visibility .16s ease; }
.feed-hover button { width: 84.78px; height: 30px; padding: 8px 12px; color: white; background: rgba(127,78,255,.8); border: 0; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 14px; font-weight: 400; box-shadow: none; }
.feed-card:hover .feed-hover { visibility: visible; opacity: 1; }
.feed-label { position: absolute; z-index: 3; inset: auto 0 0; min-height: 42px; padding: 12px; color: white; font-size: 18px; font-weight: 700; line-height: 18px; pointer-events: none; }
.empty { display: none; padding: 80px 0; color: var(--muted); text-align: center; }

/* Mega navigation */
.mega-menu {
  position: fixed;
  z-index: 1200;
  top: 20px;
  left: 230px;
  width: min(745.453125px, calc(100vw - 243px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 12px;
  display: none;
  color: var(--text);
  background: linear-gradient(rgba(127, 78, 255, .2), rgba(127, 78, 255, .2)), #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
  transform-origin: -6px var(--mega-origin-y, 304px);
  will-change: transform, opacity;
}
.mega-menu.open, .mega-menu.entering, .mega-menu.leaving { display: block; }
.mega-menu[data-group="video"],
.mega-menu[data-group="premium"] { width: min(781.25px, calc(100vw - 243px)); }
.mega-menu[data-group="lipsync"] { width: min(369.328125px, calc(100vw - 243px)); }
.mega-menu[data-group="voice"] { width: min(325.125px, calc(100vw - 243px)); }
.mega-menu[data-group="avatar"] { width: min(302.484375px, calc(100vw - 243px)); }
.mega-menu[data-group="avatarEditor"] { width: min(332.171875px, calc(100vw - 243px)); }
.mega-menu[data-group="toolbox"] { width: min(401.546875px, calc(100vw - 243px)); }
.mega-menu.entering { animation: mega-zoom-in .2s cubic-bezier(.08, .82, .17, 1) both; }
.mega-menu.leaving { animation: mega-zoom-out .2s cubic-bezier(.6, .04, .98, .34) both; pointer-events: none; }
@keyframes mega-zoom-in {
  from { opacity: 0; transform: scale(.8); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes mega-zoom-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(.8); }
}
.mega-grid { display: grid; grid-template-columns: 331px minmax(0, 1fr); gap: 4px 0; }
.mega-menu:is([data-group="lipsync"], [data-group="voice"], [data-group="avatar"], [data-group="avatarEditor"], [data-group="toolbox"]) .mega-grid { grid-template-columns: 1fr; }
.mega-card { display: flex; gap: 8px; align-items: center; height: 56.84375px; padding: 8px; border-radius: 4px; }
.mega-card:hover { background: rgba(255, 255, 255, .42); }
.mega-card-icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, .5); font-size: 19px; }
.mega-card-icon .ui-svg { width: 28px; height: 28px; }
.mega-card-icon .model-mark { font-size: 18px; }
.mega-card b { display: block; font-size: 14px; font-weight: 700; line-height: 22px; }
.mega-card b .premium-crown { margin-left: 2px; transform: translateY(2px); }
.mega-card small { display: block; color: rgba(0, 0, 0, .45); font-size: 12px; line-height: 18.8571px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.dark .mega-menu { background: rgba(57, 37, 104, .92); }
body.dark .mega-card small { color: rgba(255, 255, 255, .56); }

@media (prefers-reduced-motion: reduce) {
  .mega-menu.entering, .mega-menu.leaving { animation-duration: .01ms; }
}

/* Workbench */
.workbench { display: grid; grid-template-columns: minmax(510px, 36.5%) 1fr; min-height: calc(100vh - 68px); border-top: 1px solid transparent; }
.builder-panel { position: relative; display: flex; min-width: 0; flex-direction: column; padding: 5px 18px 86px 16px; border-right: 1px solid var(--line); }
.result-panel { min-width: 0; padding: 4px 20px 50px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; }
.control, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
}
.segmented { display: grid; grid-template-columns: repeat(var(--segments, 3), 1fr); gap: 7px; margin: 4px 0 16px; }
.segment { min-height: 45px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); cursor: pointer; font-size: 12px; }
.segment.active { color: white; background: var(--purple); border-color: var(--purple); }
.upload-zone {
  display: grid;
  min-height: 205px;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed #cbc6d1;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
}
.upload-zone.compact { min-height: 145px; }
.upload-zone:hover { color: var(--purple); border-color: var(--purple); background: var(--purple-soft); }
.upload-icon { display: block; margin-bottom: 4px; color: var(--text); font-size: 31px; font-weight: 300; }
.upload-zone small { display: block; font-size: 11px; }
.upload-preview { width: 100%; height: 160px; object-fit: contain; border-radius: 6px; }
.examples { display: flex; align-items: center; gap: 7px; margin: 10px 0 15px; }
.examples span { margin-right: 5px; }
.examples img { width: 41px; height: 41px; object-fit: cover; border-radius: 4px; cursor: pointer; }
.textarea-wrap { position: relative; margin-bottom: 13px; }
.textarea-wrap label { display: block; margin: 0 0 -19px 12px; color: var(--muted); font-size: 11px; transform: translateY(8px); pointer-events: none; }
textarea { width: 100%; min-height: 142px; padding: 25px 12px 12px; resize: vertical; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; outline: 0; }
textarea:focus, input:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(130, 71, 245, .08); }
.duration-row { margin: 2px 0 16px; }
.duration-row input { width: 100%; accent-color: var(--purple); }
.duration-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.option-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }
.switch { position: relative; width: 40px; height: 22px; border: 0; border-radius: 999px; background: #c9c5ce; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: .2s; }
.switch.on { background: var(--purple); }
.switch.on::after { transform: translateX(18px); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--muted); }
.checkbox-row input { accent-color: var(--purple); }
.generate-wrap { position: absolute; inset: auto 18px 16px 16px; }
.plan-nudge { display: flex; justify-content: space-between; margin-bottom: 7px; padding: 10px 12px; color: #7d55d7; background: var(--purple-soft); border: 1px solid #d8c7ff; border-radius: 6px; font-size: 11px; }
.generate-btn { width: 100%; min-height: 48px; font-size: 17px; }
.generate-btn:disabled { opacity: .58; cursor: default; transform: none; }
.tabs { display: flex; height: 42px; gap: 32px; border-bottom: 1px solid var(--line); }
.tab { position: relative; padding: 0 0 9px; border: 0; color: var(--text); background: transparent; cursor: pointer; font-size: 13px; }
.tab.active { color: var(--purple); }
.tab.active::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--purple); }
.tab-pane { padding: 28px 0; }
.guide-title { margin: 8px 0 27px; text-align: center; font-size: 18px; }
.guide-visual { display: block; width: min(800px, 76%); max-height: 450px; margin: 0 auto 28px; object-fit: cover; border-radius: 7px; }
.guide-section h3 { margin: 20px 0 12px; padding-bottom: 7px; color: var(--purple); border-bottom: 2px solid var(--purple); font-size: 14px; }
.guide-step { display: grid; grid-template-columns: 28px 1fr; gap: 8px; margin-bottom: 14px; padding: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 7px; }
.guide-step b:first-child { display: grid; width: 24px; height: 24px; place-items: center; color: white; background: var(--purple); border-radius: 50%; font-size: 11px; }
.guide-step strong { display: block; margin-bottom: 5px; }
.guide-step p { margin: 0; color: var(--muted); font-size: 12px; }
.result-empty { display: grid; min-height: 55vh; place-items: center; color: var(--muted); text-align: center; }
.empty-illustration { width: 96px; height: 76px; margin: auto; border: 2px solid var(--line); border-radius: 12px; transform: rotate(-4deg); }
.api-box { padding: 20px; background: #191621; color: #ece7f6; border-radius: 8px; overflow-x: auto; white-space: pre; font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Image to Video target layout */
.itv-top-row { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 10px 12px; margin-bottom: 17px; }
.itv-top-row select, .itv-top-row input { height: 32px; }
.target-upload-zone { display: flex; min-height: 236px; flex-direction: column; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; overflow: hidden; }
.target-upload-copy { display: grid; min-height: 160px; flex: 1; place-content: center; text-align: center; }
.target-upload-copy b { color: var(--text); font-size: 31px; font-weight: 300; line-height: 36px; }
.target-upload-copy strong { color: var(--text); font-size: 14px; font-weight: 400; }
.target-upload-copy small { font-size: 12px; line-height: 17px; }
.target-examples { display: flex; min-height: 75px; align-items: center; gap: 8px; padding: 12px; border-top: 1px dashed var(--line); }
.target-examples em { margin-right: auto; color: var(--text); font-style: normal; }
.target-examples img { width: 40px; height: 50px; object-fit: cover; border-radius: 2px; }
.creative-effects { padding: 16px 0 13px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.target-field-row { gap: 60px; margin-bottom: 22px; }
.target-select { position: relative; }
.target-select span { position: absolute; z-index: 1; top: 2px; left: 12px; color: var(--muted); font-size: 11px; pointer-events: none; }
.target-select select { width: 100%; height: 50px; padding: 17px 12px 1px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.target-textarea textarea { min-height: 130px; padding-top: 13px; }
.target-textarea.negative textarea { min-height: 70px; }
.target-textarea label { margin-bottom: -19px; }
.char-count { position: absolute; right: 9px; bottom: 7px; color: var(--muted); font-size: 11px; }
.target-check { margin: 13px 0; color: var(--text); }

/* Upgrade & documents */
.pricing-page { padding: 20px 6vw 70px; }
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 1210px; margin: 5px auto 38px; }
.price-card { display: flex; min-height: 530px; flex-direction: column; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.price-card.featured { border-color: var(--purple); box-shadow: 0 12px 35px rgba(130, 71, 245, .12); }
.price-card h2 { margin: 0 0 8px; font-weight: 500; }
.price { margin-bottom: 14px; font-size: 26px; }
.price small { font-size: 12px; }
.price-card p, .price-card li { color: var(--muted); font-size: 12px; }
.price-card ul { flex: 1; padding-left: 17px; line-height: 2; }
.price-card .primary-btn { width: 100%; margin: 8px 0 10px; }
.compare { max-width: 1210px; margin: auto; }
.compare h2 { text-align: center; }
.compare table { width: 100%; border-collapse: collapse; background: var(--surface); }
.compare th, .compare td { padding: 15px; border: 1px solid var(--line); text-align: center; }
.doc-page { max-width: 980px; margin: auto; padding: 28px 30px 80px; }
.doc-page h1 { font-size: 30px; }
.doc-page h2 { margin-top: 32px; }
.doc-page p, .doc-page li { color: var(--muted); line-height: 1.8; }

/* Modals */
.utility-menu { position: fixed; z-index: 1300; left: 226px; display: none; width: 214px; padding: 4px; background: white; border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.08), 0 3px 6px -4px rgba(0,0,0,.12), 0 9px 28px 8px rgba(0,0,0,.05); transform-origin: 0 50%; }
.utility-menu.open { display: grid; animation: utility-in .18s cubic-bezier(.23,1,.32,1) both; }
.utility-choice { display: flex; min-height: 32px; align-items: center; justify-content: space-between; padding: 5px 12px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; text-align: left; }
.utility-choice:hover, .utility-choice.active { color: var(--purple); background: rgba(127,78,255,.1); }
.utility-flag { margin-left: 24px; font-size: 18px; }
@keyframes utility-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

.modal-layer { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 18px; visibility: hidden; opacity: 0; background: rgba(0, 0, 0, .45); transition: .18s; }
.modal-layer.open { visibility: visible; opacity: 1; }
.dialog { position: relative; width: min(450px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; padding: 20px 24px; background: var(--surface); border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.08), 0 3px 6px -4px rgba(0,0,0,.12), 0 9px 28px 8px rgba(0,0,0,.05); transform: translateY(8px) scale(.98); transition: .18s; }
.modal-layer.open .dialog { transform: translateY(0) scale(1); }
.dialog.wide { width: min(850px, 100%); }
.dialog-close { position: absolute; top: 9px; right: 10px; width: 31px; height: 31px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; }
.dialog-close:hover { background: var(--soft); }
.auth-tabs { display: grid; height: 34px; grid-template-columns: 1fr 1fr; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.auth-tab { padding: 4px 12px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; }
.auth-tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.dialog h2 { margin: 0 0 17px; text-align: center; font-size: 18px; line-height: 22.5px; }
.social-btn { display: flex; width: 100%; height: 40px; align-items: center; justify-content: center; gap: 10px; margin: 0 0 16px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.02); }
.google-mark { font-size: 16px; font-weight: 800; background: conic-gradient(from -40deg,#4285f4,#34a853,#fbbc05,#ea4335,#4285f4); background-clip: text; -webkit-background-clip: text; color: transparent; }
.microsoft-mark { display: grid; width: 16px; height: 16px; grid-template-columns: 1fr 1fr; gap: 1px; }
.microsoft-mark i:nth-child(1) { background:#f25022; }.microsoft-mark i:nth-child(2) { background:#7fba00; }.microsoft-mark i:nth-child(3) { background:#00a4ef; }.microsoft-mark i:nth-child(4) { background:#ffb900; }
.or { display: flex; align-items: center; gap: 12px; margin: 5px 0 20px; color: var(--muted); font-size: 11px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: grid; gap: 16px; }
.auth-input { display: grid; height: 40px; grid-template-columns: 20px 1fr auto; align-items: center; padding: 0 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; }
.auth-input > span .ui-svg { width: 16px; height: 16px; }
.auth-input input { height: 38px !important; padding: 0 0 0 1px !important; border: 0 !important; box-shadow: none !important; }
.password-eye { display: grid; width: 22px; height: 30px; place-items: center; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.password-eye .ui-svg { width: 16px; height: 16px; }
.auth-form .text-link { margin-top: -8px; }
.auth-form .primary-btn { width: 100%; height: 40px; margin-top: 14px; font-size: 16px; }
.text-link { border: 0; color: var(--purple); background: transparent; cursor: pointer; text-align: right; font-size: 12px; }
.agree { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 11px; }
.dialog.search-popover { align-self: start; width: min(500px, calc(100vw - 36px)); margin-top: 82px; padding: 0; overflow: hidden; border-radius: 6px; }
.search-popover .dialog-close { display: none; }
.search-input { display: grid; height: 48px; grid-template-columns: 20px 1fr; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); }
.search-input .ui-svg { width: 16px; height: 16px; }
.search-input input { width: 100%; height: 46px; padding: 0; border: 0; outline: 0; }
.search-results { display: grid; max-height: 500px; overflow-y: auto; padding: 6px 8px 8px; }
.search-result { display: grid; min-height: 54px; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 4px; color: var(--purple); background: transparent; cursor: pointer; text-align: left; }
.search-result:hover { background: var(--soft); }
.search-result b { display: block; color: var(--purple); font-size: 14px; font-weight: 400; line-height: 22px; }
.search-result b .premium-crown { transform: translateY(3px); }
.search-result small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }
.search-result-icon { display: grid; width: 22px; height: 22px; place-items: center; color: var(--purple); font-size: 20px; }
.search-result-icon .ui-svg, .search-result-icon .model-mark { width: 20px; height: 20px; }
.preview-dialog { display: grid; grid-template-columns: 1fr .82fr; width: min(820px, 100%); padding: 0; overflow: hidden; }
.preview-image { min-height: 470px; background-size: cover; background-position: center; }
.preview-copy { display: flex; flex-direction: column; justify-content: center; padding: 35px; }
.preview-copy h2 { text-align: left; font-size: 24px; }
.preview-copy p { color: var(--muted); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; padding: 10px 16px; color: white; background: #211b2c; border-radius: 7px; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { display: none; }

@media (min-width: 1500px) {
  .tool-rail { grid-auto-columns: 420px; }
}
@media (max-width: 1180px) {
  .masonry { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workbench { grid-template-columns: minmax(460px, 44%) 1fr; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .sidebar { transform: translateX(-102%); transition: transform .22s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .page { margin-left: 0; }
  .mobile-menu { display: grid; }
  .scrim { position: fixed; inset: 0; z-index: 28; background: rgba(11, 8, 17, .42); }
  .scrim.show { display: block; }
  .mega-menu { z-index: 35; left: 230px; width: min(650px, calc(100vw - 245px)); }
  .workbench { grid-template-columns: 1fr; }
  .builder-panel { min-height: calc(100vh - 68px); border-right: 0; }
  .result-panel { border-top: 1px solid var(--line); }
  .guide-visual { width: 90%; }
}
@media (max-width: 620px) {
  .topbar { height: 61px; padding: 0 11px; }
  .topbar h1 { font-size: 17px; }
  .top-actions { gap: 3px; }
  .primary-btn { padding: 7px 10px; font-size: 12px; }
  .home-content { padding: 0 10px 35px; }
  .tool-rail { grid-auto-columns: 82vw; }
  .tool-thumb { height: 205px; }
  .rail-arrow { display: none; }
  .feed-head { align-items: flex-start; gap: 12px; }
  .masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .mega-menu, .mega-menu[data-group] { inset: 64px 8px auto; width: auto; max-height: calc(100vh - 76px); border-radius: 8px; transform-origin: 50% 0; }
  .mega-grid { grid-template-columns: 1fr; }
  .workbench { min-height: calc(100vh - 61px); }
  .builder-panel { padding: 4px 11px 88px; }
  .result-panel { padding: 4px 11px 35px; }
  .field-row { grid-template-columns: 1fr; gap: 10px; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  .upload-zone { min-height: 180px; }
  .generate-wrap { inset: auto 11px 13px; }
  .tabs { gap: 24px; }
  .guide-visual { width: 100%; }
  .pricing-page { padding: 10px 12px 55px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .price-card { min-height: auto; }
  .compare { overflow-x: auto; }
  .compare table { min-width: 650px; }
  .preview-dialog { grid-template-columns: 1fr; }
  .preview-image { min-height: 310px; }
  .preview-copy { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
