:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --panel: rgba(18, 22, 22, 0.94);
  --panel-solid: #15191a;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f0e8;
  --muted: #9ea9a4;
  --soft: rgba(244, 240, 232, 0.08);
  --teal: #38d6c6;
  --brand-blue: #86a9e7;
  --amber: #f4ad45;
  --coral: #e96b5d;
  --green: #9cdb72;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #101313 0%, #0d0f10 46%, #101313 100%);
  color: var(--text);
  font-family: "Inter Tight", Inter, "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .public-home {
  display: none;
}

body.public-home-view .public-home {
  display: flex;
}

body.public-home-view .app-shell,
body.public-home-view .hero,
body.public-home-view .workspace,
body.public-home-view .account-bar {
  display: none !important;
}

body.protected-route .public-home {
  display: none;
}

body.legal-route .public-home,
body.legal-route .app-shell,
body.legal-route .hero,
body.legal-route .workspace,
body.legal-route .account-bar {
  display: none !important;
}

body.legal-route .legal-page {
  display: block;
}

.task-brief-box {
  display: none !important;
}

.seed-field {
  display: none !important;
}

.template-panel {
  display: none !important;
}

.history-detail,
.note-editor {
  display: none !important;
}

.video-tools,
.poll-tools {
  display: none !important;
}

.public-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 214, 198, 0.14), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(134, 169, 231, 0.13), transparent 25%),
    linear-gradient(180deg, rgba(56, 214, 198, 0.05), transparent 34%),
    #0d0f10;
}

.legal-page {
  min-height: 100vh;
  display: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 214, 198, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 32%),
    #0b0d0e;
}

.legal-nav .brand-lockup,
.legal-nav .ghost-action {
  text-decoration: none;
}

.legal-nav .public-nav-actions {
  gap: 12px;
}

.legal-nav .ghost-action,
.legal-nav .solid-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1;
}

.legal-nav .ghost-action {
  display: inline-flex;
  align-items: center;
  color: #d8ded9;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
}

.legal-nav .solid-action {
  color: #071312;
  box-shadow: none;
}

.legal-document {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 136px 0 76px;
}

.legal-document[hidden] {
  display: none;
}

.legal-document h1 {
  margin: 8px 0 8px;
  color: var(--text);
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.legal-updated {
  margin: 0 0 28px;
  color: var(--muted);
}

.legal-document section {
  padding: 22px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legal-document h2 {
  margin: 0 0 10px;
  color: #f7f4ee;
  font-size: 1.05rem;
}

.legal-document p {
  margin: 0;
  color: #cdd5d1;
  line-height: 1.85;
  font-size: 0.96rem;
}

.public-nav {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px max(20px, calc((100vw - 1240px) / 2));
  background: rgba(13, 15, 16, 0.68);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px);
}

.public-nav strong {
  font-size: 1rem;
}

.brand-lockup,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-lockup img {
  width: 34px;
  height: 34px;
  display: block;
}

.brand-lockup.compact {
  gap: 8px;
}

.brand-lockup.compact img {
  width: 28px;
  height: 28px;
}

.account-bar .brand-lockup {
  display: inline-flex;
  align-items: center;
}

.public-nav-actions,
.public-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-account-pill {
  max-width: min(340px, 34vw);
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.88rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-action,
.solid-action {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 820;
}

.solid-action {
  border-color: rgba(56, 214, 198, 0.58);
  color: #071211;
  background: linear-gradient(135deg, var(--teal), var(--brand-blue));
}

.ghost-action.large,
.solid-action.large {
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.public-hero {
  position: relative;
  flex: 1 0 auto;
  min-height: max(680px, calc(100vh - 190px));
  display: grid;
  align-items: center;
  overflow: hidden;
}

.public-hero::before,
.public-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.public-hero::before {
  inset: 112px max(22px, calc((100vw - 1240px) / 2)) auto auto;
  width: min(380px, 34vw);
  aspect-ratio: 1;
  border: 1px solid rgba(56, 214, 198, 0.18);
  border-radius: 999px;
  box-shadow: inset 0 0 60px rgba(56, 214, 198, 0.08), 0 0 80px rgba(56, 214, 198, 0.08);
}

.public-hero::after {
  left: max(20px, calc((100vw - 1240px) / 2));
  right: max(20px, calc((100vw - 1240px) / 2));
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 214, 198, 0.44), rgba(244, 173, 69, 0.24), transparent);
}

.public-hero-art,
.public-hero-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.public-hero-art {
  object-fit: cover;
  opacity: 0.42;
}

.public-hero-scrim {
  background:
    linear-gradient(180deg, rgba(13, 15, 16, 0.34), rgba(13, 15, 16, 0.76) 72%, #0d0f10),
    linear-gradient(90deg, rgba(13, 15, 16, 0.86), rgba(13, 15, 16, 0.32) 54%, rgba(13, 15, 16, 0.9));
}

.public-hero-content {
  position: relative;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 118px 0 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 500px);
  gap: 64px;
  align-items: center;
}

.public-hero-content h1 {
  max-width: 980px;
  margin-bottom: 18px;
  font-size: clamp(3.1rem, 5.6vw, 5rem);
  line-height: 1.04;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.public-hero-content p {
  max-width: 760px;
  color: #d8ded9;
  font-size: 1.05rem;
  line-height: 1.75;
}

.public-hero-signals {
  width: min(520px, 100%);
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(16px);
}

.public-hero-signals div {
  padding: 14px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.public-hero-signals div:last-child {
  border-right: 0;
}

.public-hero-signals strong {
  display: block;
  color: var(--teal);
  font-size: 1.28rem;
  line-height: 1;
}

.public-hero-signals span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.public-showcase {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(13, 15, 16, 0.78);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.42), 0 0 70px rgba(56, 214, 198, 0.08);
  backdrop-filter: blur(20px);
}

.showcase-topline {
  height: 42px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.showcase-topline span {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--amber);
}

.showcase-topline span:nth-child(2) {
  background: var(--teal);
}

.showcase-topline span:nth-child(3) {
  background: var(--green);
}

.showcase-stage {
  min-height: 256px;
  margin: 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 214, 198, 0.2);
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(56, 214, 198, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
}

.showcase-stage img {
  width: 76px;
  height: 76px;
  margin-bottom: 14px;
}

.showcase-stage strong {
  display: block;
  font-size: 1.05rem;
}

.showcase-stage span,
.showcase-rows span {
  color: var(--muted);
  font-size: 0.82rem;
}

.showcase-rows {
  display: grid;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.showcase-rows div {
  min-height: 58px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.showcase-rows div:last-child {
  border-bottom: 0;
}

.showcase-rows strong {
  color: var(--text);
  font-size: 0.9rem;
}

.public-notice {
  width: min(1240px, calc(100% - 40px));
  margin: 2px auto 22px;
  padding: 14px 0;
  border-top: 1px solid rgba(244, 173, 69, 0.24);
  border-bottom: 1px solid rgba(244, 173, 69, 0.24);
  display: flex;
  gap: 18px;
  align-items: center;
  color: #d8ded9;
}

.public-notice strong {
  color: var(--amber);
  white-space: nowrap;
}

.public-notice span {
  color: var(--muted);
  line-height: 1.6;
}

.public-faq {
  width: min(960px, calc(100% - 40px));
  margin: 28px auto 26px;
  padding: 28px 0 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.public-faq-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.public-faq-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.public-faq-list {
  display: grid;
  gap: 8px;
}

.public-faq details {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.public-faq summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  color: #f6f3ea;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.public-faq summary::-webkit-details-marker {
  display: none;
}

.public-faq summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 1.2rem;
  line-height: 1;
}

.public-faq details[open] summary::after {
  content: "-";
}

.public-faq p {
  margin: 0;
  padding: 0 16px 16px;
  color: #c9d3ce;
  line-height: 1.75;
}

.account-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 15, 16, 0.92);
  backdrop-filter: blur(18px);
}

.account-bar > div:first-child {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.account-bar.show {
  display: flex;
}

.account-bar strong,
.account-home-link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.account-home-link {
  gap: 8px;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.account-home-link:hover {
  color: var(--green);
}

.account-bar span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1;
}

.account-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.account-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px;
}

.account-menu-wrap::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  height: 16px;
}

.account-avatar-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(105, 224, 211, 0.3);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 50%, #5b35d8 0 45%, transparent 46%),
    conic-gradient(from 12deg, #ff705e, #ff59b5, #6edcff, #7a5cff, #ff705e);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 28px rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.account-avatar-button span,
.account-avatar span {
  color: #fff;
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  display: none;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(25, 27, 28, 0.98);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px);
  z-index: 90;
}

.account-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.account-menu-wrap:hover .account-menu,
.account-menu-wrap:focus-within .account-menu,
.account-menu.open {
  display: block;
}

.account-menu-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 22px 22px 16px;
}

.account-avatar.large {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, #6539df 0 52%, transparent 53%),
    conic-gradient(from -28deg, #5b35d8, #6edcff, #ff5aa7, #5b35d8);
}

.account-menu-head strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head span {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-credit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 22px 18px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(105, 224, 211, 0.13), rgba(255, 91, 179, 0.12)), rgba(255, 255, 255, 0.045);
}

.account-credit-card span {
  color: #b8c3bf;
  font-size: 0.82rem;
}

.account-credit-card strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 950;
}

.account-credit-link {
  min-width: 90px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: #111516;
  background: linear-gradient(135deg, #40dccb, #7cc7ff);
  font-weight: 950;
  cursor: pointer;
}

.account-menu-list {
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.account-menu-list button,
.account-menu-logout {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px 1fr 22px;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 0 22px;
  color: #f0f4f2;
  background: transparent;
  text-align: left;
  font-size: 0.96rem;
  font-weight: 850;
  cursor: pointer;
}

.account-menu-list button:hover,
.account-menu-logout:hover {
  background: rgba(255, 255, 255, 0.055);
}

.account-menu-list svg,
.account-menu-logout svg {
  width: 20px;
  height: 20px;
  color: #dce4e0;
}

.account-menu-list button svg:last-child {
  justify-self: end;
  color: #aeb8b4;
}

.account-menu-logout {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  grid-template-columns: 28px 1fr;
}

.reset-password-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
}

.reset-password-modal.show {
  display: grid;
}

.reset-password-card {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: #191b1c;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.55);
}

.reset-password-card input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  font: inherit;
}

.top-module-tabs {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
}

.top-module-tabs button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.top-module-tabs button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.top-module-tabs svg {
  width: 15px;
  height: 15px;
}

body.asset-library-mode .workspace,
body.asset-library-mode .app-shell,
body.asset-library-mode .hero,
body.asset-library-mode .public-home,
body.asset-library-mode .public-hero,
body.asset-library-mode footer {
  display: none !important;
}

body.studio-image-mode .workspace > .control-panel,
body.studio-image-mode .main-panel,
body.studio-image-mode .history-panel,
body.studio-image-mode .price-card {
  display: none !important;
}

.module-tabs {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.module-tabs a,
.module-tabs button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.module-tabs a.active,
.module-tabs button.active {
  color: #071211;
  background: var(--teal);
}

.module-tabs svg {
  width: 17px;
  height: 17px;
}

.image-workspace-page {
  width: min(1680px, calc(100% - 28px));
  min-height: calc(100vh - 96px);
  margin: 16px auto 28px;
  display: none;
  grid-template-columns: 330px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.studio-image-module {
  grid-column: 1 / -1;
  display: none;
  grid-template-columns: 330px minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: start;
}

.studio-image-module.show {
  display: grid;
}

.image-workspace-page.show {
  display: grid;
}

.image-module-tabs {
  grid-column: 1 / -1;
}

.image-tool-panel,
.image-workspace-main,
.image-creations-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.image-tool-panel {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.image-tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-cost-pill {
  min-width: 86px;
  padding: 11px 14px;
  border: 1px solid rgba(56, 214, 198, 0.42);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(56, 214, 198, 0.08);
  text-align: center;
  font-size: 0.95rem;
  white-space: nowrap;
}

.image-tool-head h1,
.image-workspace-head h2,
.image-creations-panel h2 {
  margin: 0;
}

.tool-back-button {
  width: max-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

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

.image-ref-action {
  min-height: 86px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  font-weight: 850;
}

.image-ref-action:hover {
  border-color: rgba(56, 214, 198, 0.55);
  background: rgba(56, 214, 198, 0.08);
}

.image-page-prompt {
  min-height: 180px;
}

.image-page-generate {
  min-height: 54px;
  justify-content: space-between;
  font-size: 1rem;
}

.image-page-generate.is-submitting {
  cursor: wait;
}

.image-page-generate.is-submitting i {
  display: none;
}

.image-page-generate.is-submitting::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(7, 19, 18, 0.24);
  border-top-color: #071312;
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

.image-workspace-main {
  min-height: auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

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

.image-workspace-nav {
  display: inline-flex;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.image-workspace-nav button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.image-workspace-nav button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.image-canvas {
  min-height: min(58vh, 640px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(56, 214, 198, 0.08), transparent 32%),
    rgba(255, 255, 255, 0.035);
}

.image-page-featured {
  max-width: 100%;
  max-height: 72vh;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}

.image-page-caption {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.image-page-results {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-items: start;
}

.image-creations-panel {
  position: sticky;
  top: 88px;
  padding: 16px;
}

.image-creations-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  margin-top: 14px;
  padding-right: 4px;
}

.image-creation-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  cursor: pointer;
}

.image-creation-item img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #070909;
}

.image-creation-item.preview-unavailable img {
  display: none;
}

.image-creation-item.preview-unavailable::before {
  content: "";
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(56, 214, 198, 0.12), rgba(255, 255, 255, 0.04)),
    #090c0c;
}

.image-creation-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.asset-library-page {
  width: min(1680px, calc(100% - 28px));
  min-height: calc(100vh - 24px);
  margin: 8px auto 16px;
  display: none;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
}

.asset-library-page.show {
  display: grid;
}

.asset-sidebar {
  position: sticky;
  top: 12px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.asset-search {
  height: 38px;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.asset-search input {
  width: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  outline: none;
}

.asset-nav {
  display: grid;
  gap: 6px;
}

.asset-nav button {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.asset-nav button.active,
.asset-nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.asset-nav button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 760;
}

.asset-nav button small {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.asset-project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}

.asset-project-row.active {
  background: rgba(255, 255, 255, 0.09);
}

.asset-project-row.active > button:first-child {
  color: var(--text);
}

.asset-project-row > button:first-child {
  min-width: 0;
  grid-template-columns: 20px minmax(0, 1fr);
  height: auto;
  min-height: 36px;
  padding: 7px 9px;
}

.asset-project-row > button:first-child span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.28;
}

.asset-project-delete {
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  place-items: center;
  padding: 0 !important;
  color: rgba(255, 176, 170, 0.78) !important;
  opacity: 0;
}

.asset-project-row:hover .asset-project-delete,
.asset-project-delete:focus-visible {
  opacity: 1;
}

.asset-project-delete:hover {
  color: #ffb0aa !important;
  background: rgba(255, 82, 82, 0.12) !important;
}

.asset-project-delete svg {
  width: 16px;
  height: 16px;
}

.asset-nav-title {
  margin: 18px 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.asset-main {
  min-width: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
}

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

.asset-library-head h1 {
  font-size: 1.45rem;
}

.asset-toolbar {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.asset-selection-meta {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.asset-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.asset-toolbar select {
  min-height: 38px;
  max-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #202626;
  outline: none;
}

.asset-toolbar select:disabled,
.asset-toolbar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.asset-toolbar .danger-action {
  border-color: rgba(255, 82, 82, 0.36);
  color: #ffb0aa;
}

.asset-date-group {
  display: grid;
  gap: 14px;
  margin-bottom: 30px;
}

.asset-date-group h2 {
  font-size: 1rem;
}

.asset-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asset-day-select {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.76rem;
  font-weight: 820;
}

.asset-day-select.selected {
  color: var(--green);
  border-color: rgba(56, 214, 198, 0.45);
  background: rgba(56, 214, 198, 0.1);
}

.asset-new-project-link {
  margin-top: 2px;
  border: 1px dashed rgba(255, 255, 255, 0.18) !important;
  color: var(--green) !important;
  background: rgba(56, 214, 198, 0.055) !important;
}

.asset-project-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 8, 0.72);
  backdrop-filter: blur(10px);
}

.asset-project-modal.show {
  display: grid;
}

.asset-project-dialog {
  position: relative;
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(56, 214, 198, 0.22);
  border-radius: 8px;
  background: #151a1a;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.44);
}

.asset-project-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.asset-project-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 34px;
}

.asset-project-head h2 {
  font-size: 1.22rem;
}

.asset-project-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green);
  background: rgba(56, 214, 198, 0.12);
}

.asset-project-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 820;
}

.asset-project-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

.asset-project-field input:focus {
  border-color: rgba(56, 214, 198, 0.56);
  box-shadow: 0 0 0 3px rgba(56, 214, 198, 0.1);
}

.asset-project-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.asset-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px;
}

.asset-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.asset-card:hover {
  border-color: rgba(56, 214, 198, 0.34);
}

.asset-card.preview-unavailable .asset-media img,
.asset-card.preview-unavailable .asset-media video {
  opacity: 0.18;
}

.asset-preview-unavailable {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(12, 16, 16, 0.24), rgba(12, 16, 16, 0.68));
  font-size: 0.74rem;
  font-weight: 780;
  pointer-events: none;
}

.asset-preview-unavailable svg {
  width: 26px;
  height: 26px;
}

.asset-card.selected {
  border-color: rgba(56, 214, 198, 0.8);
  box-shadow: 0 0 0 2px rgba(56, 214, 198, 0.18);
}

.asset-check {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.asset-card.selected .asset-check {
  color: var(--green);
}

.asset-check svg {
  width: 18px;
  height: 18px;
}

.asset-media,
.asset-media img,
.asset-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.asset-media {
  position: relative;
}

.asset-hover-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  background: #101514;
  transition: opacity 120ms ease;
}

.asset-card.is-video-hovering .asset-hover-video {
  opacity: 1;
}

.asset-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #fff;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.65));
  pointer-events: none;
  transition: opacity 120ms ease;
}

.asset-card.is-video-hovering .asset-play {
  opacity: 0;
}

.asset-play svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.asset-favorite {
  position: absolute;
  z-index: 4;
  left: 8px;
  bottom: 8px;
  color: #ff4b5d;
}

.asset-card-title {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 38px;
  padding: 16px 8px 7px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  font-size: 0.72rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.92;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.asset-card:hover .asset-card-title {
  opacity: 1;
}

.asset-audio {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  place-items: center;
  gap: 8px;
  padding: 12px;
  color: var(--green);
  background: rgba(56, 214, 198, 0.08);
}

.asset-card.is-playing .asset-audio {
  color: #101514;
  background: linear-gradient(135deg, rgba(56, 214, 198, 0.92), rgba(163, 231, 129, 0.9));
}

.asset-audio strong {
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-audio small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.asset-card.is-playing .asset-audio strong,
.asset-card.is-playing .asset-audio small {
  color: #101514;
}

.asset-audio audio {
  display: none;
}

.asset-empty {
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.app-shell.locked {
  filter: none;
  pointer-events: none;
  user-select: none;
}

.auth-gate,
.admin-panel,
.recharge-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 8, 0.72);
  backdrop-filter: blur(10px);
}

.auth-gate.show,
.admin-panel.show,
.recharge-panel.show {
  display: grid;
}

.auth-card,
.admin-sheet {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141819;
  box-shadow: var(--shadow);
}

.recharge-card {
  width: min(560px, calc(100% - 28px));
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17, 20, 20, 0.98);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.recharge-button {
  border-color: rgba(154, 233, 118, 0.35);
}

.earn-button {
  border-color: rgba(82, 211, 194, 0.5);
  background: rgba(82, 211, 194, 0.12);
}

.recharge-rate {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 214, 198, 0.28);
  border-radius: 8px;
  color: var(--green);
  background: rgba(56, 214, 198, 0.07);
  font-weight: 800;
}

.recharge-table {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.recharge-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.65fr;
  gap: 8px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
}

.recharge-option {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.recharge-option:hover,
.recharge-option.selected {
  border-color: rgba(143, 181, 255, 0.75);
  background: rgba(47, 113, 255, 0.14);
}

.recharge-option.selected {
  box-shadow: 0 0 0 1px rgba(143, 181, 255, 0.35) inset;
}

.recharge-row.header {
  color: var(--text);
  font-weight: 800;
  background: transparent;
}

.recharge-row strong,
.recharge-row span:nth-child(4) {
  color: var(--text);
}

.recharge-price {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.recharge-price del {
  color: var(--muted);
  font-size: 0.76rem;
}

.recharge-price strong {
  color: var(--green);
  font-size: 1rem;
}

.recharge-loading,
.recharge-status {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  line-height: 1.55;
}

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

.recharge-status strong,
.recharge-status span {
  display: block;
}

.recharge-status .tool-button {
  margin-top: 10px;
}

.recharge-status a {
  display: inline-block;
  margin-top: 8px;
  color: #8fb5ff;
  font-weight: 800;
}

.payment-qr {
  display: inline-grid;
  gap: 8px;
  justify-items: center;
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-qr img {
  width: 220px;
  height: 220px;
  display: block;
}

.payment-qr small {
  color: #202526;
  font-weight: 800;
}

.recharge-checkout {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 6px;
  padding: 14px;
  border: 1px solid rgba(143, 181, 255, 0.32);
  border-radius: 8px;
  background: rgba(47, 113, 255, 0.1);
}

.recharge-checkout > div:first-child {
  display: grid;
  gap: 3px;
}

.recharge-checkout span {
  color: var(--muted);
  font-size: 0.86rem;
}

.recharge-checkout strong {
  color: var(--text);
  font-size: 1rem;
}

.recharge-pay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.recharge-pay-actions button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(143, 181, 255, 0.45);
  border-radius: 8px;
  color: var(--text);
  background: rgba(47, 113, 255, 0.14);
  font-weight: 800;
}

.recharge-pay-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.recharge-note {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  color: #f4c56b;
  background: rgba(244, 173, 69, 0.1);
  line-height: 1.5;
}

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

.earn-summary > div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.earn-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.35rem;
}

.earn-summary span {
  color: var(--muted);
  font-size: 0.86rem;
}

.earn-link-box,
.earn-rules,
.earn-list {
  margin-top: 14px;
}

.earn-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.earn-link-row input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.earn-rules {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  color: #f4c56b;
  background: rgba(244, 173, 69, 0.1);
  line-height: 1.55;
}

.earn-rules strong,
.earn-section-title {
  color: var(--text);
  font-weight: 900;
}

.earn-record {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.earn-record + .earn-record {
  margin-top: 8px;
}

.earn-record strong,
.earn-record span {
  display: block;
}

.earn-record span {
  color: var(--muted);
}

.earn-record em {
  color: #8fb5ff;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .recharge-row {
    grid-template-columns: 1fr 0.7fr;
  }

  .recharge-row.header {
    display: none;
  }

  .recharge-checkout {
    align-items: stretch;
    flex-direction: column;
  }

  .recharge-pay-actions {
    justify-content: stretch;
  }

  .recharge-pay-actions button {
    flex: 1;
  }

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

  .earn-link-row {
    grid-template-columns: 1fr;
  }
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.auth-card h2 {
  font-size: 1.55rem;
}

.auth-copy,
.auth-message {
  color: var(--muted);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-sheet {
  width: min(1180px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 18px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.admin-stats > div,
.admin-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-stats > div {
  padding: 14px;
}

.admin-stats strong {
  display: block;
  color: var(--teal);
  font-size: 1.45rem;
}

.admin-stats span {
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-settings {
  display: grid;
  grid-template-columns: auto 100px 120px 120px 110px;
  gap: 10px;
  align-items: end;
  padding: 12px;
}

.admin-sheet h3 {
  margin: 0;
}

.admin-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 10px;
}

.admin-search {
  width: min(320px, 45%);
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

.admin-table th {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.admin-table button {
  margin: 0 4px 4px 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.admin-pager {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 2px 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-pager div {
  display: flex;
  gap: 6px;
}

.admin-pager button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.admin-pager button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.credit-adjust {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.credit-adjust input {
  height: 34px;
  min-width: 0;
  padding: 0 8px;
}

.credit-adjust button {
  margin: 0;
  white-space: nowrap;
}

.admin-only,
body:not(.is-admin) .admin-only,
.impersonation-only,
body:not(.is-impersonating) .impersonation-only {
  display: none;
}

body.is-admin .admin-only {
  display: revert;
}

body.is-impersonating .impersonation-only {
  display: inline-flex;
}

body.is-impersonating .account-bar {
  border-bottom-color: rgba(244, 173, 69, 0.55);
}

.provider-admin-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(56, 214, 198, 0.28);
  border-radius: 8px;
  background: rgba(56, 214, 198, 0.06);
}

.provider-admin-card strong {
  display: block;
  color: var(--teal);
  font-size: 1.35rem;
}

.provider-admin-card span,
.provider-admin-card small {
  color: var(--muted);
}

.risk-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.84rem;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 214, 198, 0.12), transparent 260px),
    radial-gradient(circle at 80% 0%, rgba(244, 173, 69, 0.09), transparent 230px),
    linear-gradient(180deg, rgba(56, 214, 198, 0.05), transparent 260px),
    #0d0f10;
}

.hero {
  position: relative;
  width: min(1480px, calc(100% - 32px));
  min-height: 174px;
  margin: 14px auto 0;
  display: grid;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(56, 214, 198, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(56, 214, 198, 0.16), rgba(134, 169, 231, 0.08) 48%, rgba(255, 255, 255, 0.024)),
    rgba(255, 255, 255, 0.018);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 214, 198, 0.52), rgba(134, 169, 231, 0.38), transparent);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  right: max(28px, calc((100vw - 1240px) / 2));
  top: 30px;
  width: min(360px, 38vw);
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 34%, rgba(56, 214, 198, 0.2), transparent 48%),
    radial-gradient(circle at 70% 58%, rgba(134, 169, 231, 0.16), transparent 56%);
  filter: blur(4px);
  opacity: 0.7;
}

.hero-content {
  position: relative;
  width: 100%;
  padding: 30px 28px 28px;
}

.studio-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
}

.studio-mark {
  width: 66px;
  height: 66px;
  display: block;
  filter:
    drop-shadow(0 15px 30px rgba(56, 214, 198, 0.16))
    drop-shadow(0 10px 24px rgba(134, 169, 231, 0.13));
}

.kicker,
.eyebrow {
  margin: 0;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.72rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3.4vw, 3.25rem);
  line-height: 1;
  max-width: 980px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.hero-content p {
  max-width: 760px;
  margin: 16px 0 0;
  color: #d8ded9;
  font-size: 0.98rem;
  line-height: 1.65;
}

.studio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.studio-tags span {
  padding: 7px 10px;
  border: 1px solid rgba(56, 214, 198, 0.24);
  border-radius: 999px;
  color: #d8ded9;
  background: rgba(56, 214, 198, 0.065);
  font-size: 0.78rem;
  font-weight: 800;
}

.workspace {
  width: min(1480px, calc(100% - 32px));
  margin: 14px auto 32px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: start;
}

.control-panel,
.main-panel,
.history-panel > div {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.priority-panel {
  border-top: 0;
  padding-top: 0;
}

.control-panel,
.history-panel > div {
  border-radius: 8px;
  padding: 18px;
}

.main-panel {
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 18px;
}

.history-panel {
  display: grid;
  gap: 16px;
}

.panel-head,
.toolbar,
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar {
  position: sticky;
  top: 74px;
  z-index: 18;
  margin: -4px -4px 0;
  padding: 10px 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 18, 18, 0.96), rgba(15, 18, 18, 0.86));
  backdrop-filter: blur(18px);
}

.main-panel > .toolbar {
  position: static;
  margin: 0;
  padding: 0 2px 16px 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  backdrop-filter: none;
}

.compact {
  align-items: start;
}

.credit-pill {
  min-width: 104px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 214, 198, 0.38);
  border-radius: 18px;
  color: var(--teal);
  text-align: center;
  font-weight: 800;
  background: rgba(56, 214, 198, 0.08);
  white-space: nowrap;
  line-height: 1;
}

.credit-pill span {
  display: inline;
  font-size: 1.1rem;
}

.control-panel .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.control-panel .panel-head > div {
  min-width: 0;
}

#modelTitle {
  max-width: 100%;
  overflow: visible;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 1.18rem;
  line-height: 1.08;
  text-overflow: clip;
  white-space: normal;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(154, 233, 118, 0.45);
  color: var(--green);
  background: rgba(154, 233, 118, 0.12);
  font-size: 0.68rem;
  font-weight: 900;
  vertical-align: middle;
}

.model-warning {
  padding: 9px 10px;
  border: 1px solid rgba(244, 173, 69, 0.34);
  border-radius: 8px;
  color: #f4c56b;
  background: rgba(244, 173, 69, 0.09);
  font-size: 0.82rem;
  line-height: 1.45;
}

.model-warning[hidden] {
  display: none;
}

.model-enhance-button {
  width: 100%;
  justify-content: center;
}

.field-group {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.label {
  color: #dce5df;
  font-size: 0.84rem;
  font-weight: 760;
  white-space: nowrap;
  word-break: keep-all;
}

select,
input,
textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

select option {
  color: #f4f0e8;
  background: #1f2422;
}

select,
input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 268px;
  resize: vertical;
  padding: 14px;
  line-height: 1.65;
}

select:focus,
input:focus,
textarea:focus {
  border-color: rgba(56, 214, 198, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 214, 198, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.segment,
.aspect,
.tool-button,
.icon-button,
.upload-button,
.template-actions button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.segment {
  height: 36px;
  border-color: transparent;
}

.segment.active {
  color: #071312;
  background: var(--teal);
}

.segment:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.aspect:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.aspect-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.aspect {
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--muted);
}

.aspect span {
  display: block;
  width: 26px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.aspect[data-aspect="4:3"] span {
  width: 22px;
  height: 17px;
}

.aspect[data-aspect="1:1"] span {
  width: 19px;
  height: 19px;
}

.aspect[data-aspect="3:4"] span {
  width: 17px;
  height: 22px;
}

.aspect[data-aspect="9:16"] span {
  width: 14px;
  height: 25px;
}

.aspect.active {
  color: var(--amber);
  border-color: rgba(244, 173, 69, 0.55);
  background: rgba(244, 173, 69, 0.12);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce5df;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.seed-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}

.tool-button,
.upload-button,
.template-actions button {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.upload-button {
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
  text-decoration: none;
}

.upload-button span,
.tool-button span {
  white-space: nowrap;
}

.upload-button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.reference-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.reference-button-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}

.reference-action-tip {
  color: #8fb8ff;
  font-size: 0.8rem;
  font-weight: 760;
  white-space: nowrap;
}

.generate-image-button {
  border-color: rgba(80, 160, 255, 0.72);
  color: #eaf3ff;
  background: #246bfe;
  box-shadow: 0 12px 30px rgba(36, 107, 254, 0.18);
}

.generate-image-button:hover {
  background: #2f78ff;
}

.primary-action {
  color: #071312;
  border-color: rgba(56, 214, 198, 0.75);
  background: var(--teal);
}

#markGenerating {
  box-shadow: 0 16px 34px rgba(56, 214, 198, 0.16);
}

.toolbar-actions,
.template-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.main-panel .toolbar-actions {
  display: grid;
  grid-template-columns: minmax(150px, max-content) minmax(170px, max-content) minmax(104px, max-content);
  justify-content: start;
  align-items: center;
  gap: 12px;
  overflow: visible;
}

.main-panel .toolbar-actions .tool-button {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.summary-box,
.sync-box,
.usage-box,
.price-card,
.presets-card,
.favorites-card,
.history-card,
.reference-panel,
.output-panel,
.video-panel,
.template-panel {
  border-top: 1px solid var(--line);
}

.summary-box {
  padding-top: 16px;
}

.sync-box {
  margin-top: 18px;
  padding-top: 16px;
}

.usage-box {
  margin-top: 18px;
  padding-top: 16px;
}

#configSummary,
.prompt-meta,
.preset-empty {
  color: var(--muted);
  line-height: 1.6;
}

.remote-balance {
  margin-top: 12px;
  display: grid;
  gap: 5px;
}

.remote-balance span {
  color: var(--green);
  font-size: 1.28rem;
  font-weight: 860;
}

.remote-balance small {
  color: var(--muted);
  line-height: 1.45;
}

.usage-total {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.usage-balance {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(56, 214, 198, 0.34);
  border-radius: 8px;
  background: rgba(56, 214, 198, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.usage-balance span {
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 800;
}

.usage-balance strong {
  color: var(--green);
  font-size: 1.42rem;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.usage-balance strong span,
.usage-balance strong em {
  color: inherit;
  font: inherit;
}

.usage-balance strong em {
  font-style: normal;
}

.usage-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.usage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.usage-actions button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 760;
}

.prompt-layout {
  display: block;
}

.prompt-editor {
  position: relative;
  min-width: 0;
}

.prompt-source-hidden {
  display: none;
}

.prompt-rich-editor {
  position: relative;
  width: 100%;
  min-height: 340px;
  max-height: 560px;
  overflow: auto;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font: inherit;
  font-size: 1rem;
  line-height: 1.62;
  white-space: pre-wrap;
  outline: none;
}

.prompt-rich-editor:focus {
  border-color: rgba(56, 214, 198, 0.48);
  box-shadow: 0 0 0 3px rgba(56, 214, 198, 0.08);
}

.prompt-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 255, 255, 0.34);
  pointer-events: none;
}

.prompt-token-chip {
  display: inline-flex;
  align-items: center;
  max-width: 160px;
  min-height: 26px;
  margin: 0 3px;
  padding: 1px 11px 2px;
  border: 1px solid rgba(56, 214, 198, 0.28);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 780;
  line-height: 1.3;
  vertical-align: baseline;
  user-select: none;
  cursor: pointer;
}

.prompt-token-chip:hover {
  border-color: rgba(56, 214, 198, 0.54);
  background: rgba(56, 214, 198, 0.16);
}

.prompt-token-chip::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 7px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.68);
}

.prompt-chip-menu {
  position: absolute;
  z-index: 32;
  min-width: 132px;
  max-width: min(180px, calc(100% - 24px));
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  border: 1px solid rgba(56, 214, 198, 0.24);
  border-radius: 8px;
  background: rgba(13, 18, 17, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.prompt-chip-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.prompt-chip-menu button:hover,
.prompt-chip-menu button.active {
  background: rgba(56, 214, 198, 0.12);
}

.prompt-chip-menu-thumb {
  width: 28px;
  height: 28px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.prompt-chip-menu-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prompt-chip-menu-thumb svg {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.prompt-chip-menu strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.84rem;
}

.template-panel {
  padding-top: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}

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

.prompt-editor-head .label {
  min-width: max-content;
}

.prompt-editor-head #charCount {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.prompt-meta {
  display: block;
  justify-content: flex-start;
  margin-top: 10px;
  font-size: 0.84rem;
}

.prompt-reference-picker {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(56, 214, 198, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.prompt-reference-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
}

.prompt-reference-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-reference-chip {
  min-width: 116px;
  max-width: 180px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(56, 214, 198, 0.22);
  border-radius: 8px;
  color: var(--text);
  background: rgba(15, 22, 20, 0.78);
  cursor: pointer;
}

.prompt-reference-chip:hover {
  border-color: rgba(56, 214, 198, 0.5);
  background: rgba(56, 214, 198, 0.08);
}

.chip-thumb {
  width: 32px;
  height: 32px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

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

.chip-thumb svg {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.chip-text {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

.chip-text strong,
.chip-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-text strong {
  color: var(--green);
  font-size: 0.82rem;
}

.chip-text small {
  color: var(--muted);
  font-size: 0.72rem;
}

.prompt-mention-menu {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 50px;
  z-index: 20;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(56, 214, 198, 0.22);
  border-radius: 8px;
  background: rgba(15, 22, 20, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.mention-option {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 86px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mention-option:hover,
.mention-option.active {
  background: rgba(56, 214, 198, 0.11);
}

.mention-thumb {
  width: 38px;
  height: 38px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
}

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

.mention-thumb svg {
  width: 20px;
  height: 20px;
  color: var(--green);
}

.mention-token {
  color: var(--green);
  font-weight: 900;
  font-size: 0.86rem;
}

.mention-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mention-info strong {
  font-size: 0.82rem;
}

.mention-info small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.field-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.reference-panel,
.output-panel,
.video-panel {
  padding-top: 16px;
}

.site-footer {
  width: min(1240px, calc(100% - 40px));
  margin: 28px auto 36px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.public-footer {
  width: min(1240px, calc(100% - 40px));
  margin-top: auto;
  margin-bottom: 0;
  padding: 36px 0 42px;
  display: grid;
  grid-template-columns: 300px 150px 250px;
  align-items: start;
  justify-content: center;
  gap: clamp(42px, 5vw, 72px);
  border-top-color: rgba(255, 255, 255, 0.08);
}

.image-studio-body {
  background: #0d0f10;
}

.image-studio-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.image-studio-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.image-studio-head h1 {
  margin: 4px 0 10px;
  font-size: clamp(2.2rem, 6vw, 5.2rem);
}

.image-studio-head p {
  max-width: 720px;
  color: var(--muted);
}

.image-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  margin-top: 18px;
}

.image-generator-panel,
.image-result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.image-mode-tabs {
  margin-bottom: 16px;
}

.image-studio-body textarea {
  min-height: 180px;
}

.edit-only {
  display: none;
}

.image-edit-mode .edit-only {
  display: grid;
}

.image-upload-inline {
  justify-self: start;
}

.image-safety {
  margin: 16px 0;
}

.image-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.image-task-meta {
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.image-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 360px;
}

.image-result-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
}

.image-result-preview {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: center;
  background: #101413;
}

.image-result-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #101413;
}

.image-result-card figcaption {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
}

.image-ref-list {
  display: grid;
  gap: 8px;
}

.image-ref-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-ref-item img {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
}

.image-ref-item span {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-ref-item button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.image-generator-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 8, 0.74);
  backdrop-filter: blur(10px);
}

.image-generator-modal.show {
  display: grid;
}

.image-generator-sheet {
  width: min(1120px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141819;
  box-shadow: var(--shadow);
}

.image-generator-content {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 16px;
  margin-top: 16px;
}

.image-generator-form,
.image-generator-result {
  min-width: 0;
}

.image-generator-modal textarea {
  min-height: 150px;
}

.image-generator-modal .image-url-input {
  min-height: 72px;
  margin-top: 10px;
}

.topaz-enhancer-sheet {
  width: min(980px, 100%);
}

.topaz-mode-row,
.topaz-source-actions,
.topaz-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.topaz-mode-row .tool-button.active {
  border-color: rgba(49, 115, 255, 0.78);
  color: #ffffff;
  background: linear-gradient(135deg, #3482ff, #1f5cff);
  box-shadow: 0 14px 30px rgba(31, 92, 255, 0.22);
}

.topaz-cost {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 1.25rem;
}

.topaz-video-card video {
  width: 100%;
  border-radius: 8px;
  background: #080b0c;
}

.topaz-result-grid {
  min-height: 220px;
}

.image-upload-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.image-upload-box .field-hint {
  flex: 1 1 240px;
}

.site-footer strong {
  color: var(--text);
  font-size: 0.96rem;
}

.footer-brand-column {
  max-width: 300px;
}

.footer-brand-column p {
  max-width: 260px;
  margin: 12px 0 44px;
  color: #d8ded9;
  line-height: 1.65;
}

.footer-copy {
  color: #c1cbc6;
}

.footer-brand {
  display: flex;
  margin-bottom: 6px;
}

.footer-brand img {
  width: 26px;
  height: 26px;
  display: block;
}

.footer-contact {
  justify-content: flex-start;
}

.footer-menu {
  display: grid;
  justify-items: start;
  gap: 14px;
  color: #d8ded9;
}

.footer-menu strong {
  margin-bottom: 8px;
  color: #f6f3ea;
  font-size: 1rem;
}

.footer-menu a,
.footer-menu span {
  color: #d8ded9;
  text-decoration: none;
  line-height: 1.4;
}

.footer-menu a:hover {
  color: var(--teal);
}

.studio-footer-note {
  display: none;
}

.inline-toggle {
  margin: 0;
}

.video-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 14px;
}

.poll-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, 0.65fr);
  gap: 8px;
  margin-top: 8px;
}

.video-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.save-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.save-dir-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.save-dir-row .label {
  margin: 0;
  white-space: nowrap;
}

.poll-status {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-chip {
  min-width: 92px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-weight: 840;
  background: rgba(255, 255, 255, 0.06);
}

.status-chip.generating {
  color: #10110c;
  border-color: rgba(244, 173, 69, 0.6);
  background: var(--amber);
}

.status-chip.complete {
  color: #0c1110;
  border-color: rgba(156, 219, 114, 0.68);
  background: var(--green);
}

.status-chip.failed {
  color: #fff;
  border-color: rgba(233, 107, 93, 0.68);
  background: rgba(233, 107, 93, 0.7);
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #060707;
}

#resultVideo,
.preview-stage .stage-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#resultVideo {
  display: none;
  object-fit: contain;
  background: #050606;
}

#resultVideo.has-video {
  display: block;
}

.stage-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    #0b0e0e;
}

.image-result-grid .stage-placeholder {
  grid-column: 1 / -1;
  position: static;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.stage-placeholder strong {
  color: var(--text);
  font-size: 1.08rem;
}

.stage-placeholder span {
  max-width: 420px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.image-status-card.is-failed,
.media-feed-loading.is-failed {
  width: min(100%, 560px);
  min-height: 180px;
  justify-self: center;
  padding: 24px;
  border: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 126, 126, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(31, 15, 16, 0.72), rgba(10, 11, 11, 0.96));
}

.image-status-card.is-failed span,
.media-feed-loading.is-failed span,
.preview-soft-empty span {
  max-width: 460px;
  padding: 0 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
}

.image-preview-fallback {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.image-preview-fallback[hidden] {
  display: none;
}

.image-preview-fallback svg {
  width: 30px;
  height: 30px;
  color: rgba(56, 214, 198, 0.82);
}

.image-preview-fallback strong,
.preview-soft-empty strong {
  color: var(--text);
}

.image-preview-fallback span {
  max-width: 280px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.preview-stage.has-video .stage-placeholder {
  display: none;
}

.loader-ring {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--teal);
  border-radius: 999px;
  opacity: 0.35;
}

.preview-stage.generating .loader-ring {
  opacity: 1;
  animation: spin 900ms linear infinite;
}

.preview-stage.failed .loader-ring {
  opacity: 1;
  border-top-color: var(--coral);
  animation: none;
}

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

.saved-video {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.media-feed {
  margin-top: 20px;
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: none;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 10px;
}

.media-feed-card {
  position: relative;
  width: min(1040px, 100%);
  border-radius: 14px;
  overflow: hidden;
  background: #101313;
}

.media-feed-card.is-generating {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #090b0b;
}

.media-feed-card.is-generating.is-video .media-feed-stage {
  aspect-ratio: 16 / 9;
  min-height: 360px;
}

.media-feed-card.is-generating:not(.is-failed) .media-feed-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-feed-card.is-generating.is-image:not(.is-failed) .media-feed-stage {
  aspect-ratio: auto;
  min-height: 0;
}

.media-feed-card.is-failed .media-feed-stage {
  background:
    linear-gradient(180deg, rgba(28, 13, 14, 0.72), rgba(8, 9, 9, 0.98));
}

.media-feed-head {
  display: grid;
  gap: 10px;
  padding: 14px 14px 16px;
  color: var(--muted);
  font-size: 0.7rem;
}

.media-feed-meta {
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  text-align: left;
}

.media-feed-meta span {
  max-width: 100%;
  min-height: 19px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  color: #d8ded9;
  background: rgba(255, 255, 255, 0.075);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.68rem;
}

.media-feed-title {
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1.35;
  cursor: pointer;
}

.media-feed-stage {
  position: relative;
  min-height: 180px;
  background: #070808;
}

.media-feed-actions {
  position: absolute;
  right: 10px;
  top: 96px;
  z-index: 4;
  display: grid;
  grid-template-columns: 34px;
  gap: 8px;
}

.media-feed-card.is-failed .media-feed-actions {
  top: 96px;
}

.media-feed-actions button {
  min-width: 0;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f6f3ea;
  background: rgba(13, 16, 16, 0.72);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.media-feed-actions span {
  display: none;
}

.media-feed-actions button:hover {
  border-color: rgba(67, 210, 197, 0.62);
  background: rgba(25, 32, 31, 0.92);
  transform: translateX(-1px);
}

.media-feed-actions button:last-child:hover {
  border-color: rgba(255, 116, 116, 0.65);
  color: #ffd1d1;
}

.media-feed-actions svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  padding: 24px;
  overflow: auto;
  background: rgba(4, 6, 7, 0.82);
  backdrop-filter: blur(16px);
}

.image-lightbox.show {
  display: block;
}

.image-lightbox-sheet {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.image-lightbox-stage {
  margin-top: 14px;
  display: grid;
  place-items: center;
  min-height: min(72vh, 760px);
  border-radius: 10px;
  background: #050606;
  overflow: hidden;
}

.image-lightbox-stage img {
  max-width: 100%;
  max-height: 78vh;
  display: block;
  object-fit: contain;
}

.image-lightbox-details {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.image-lightbox-details div,
.image-lightbox-prompt {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.image-lightbox-details span,
.image-lightbox-prompt span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
}

.image-lightbox-details strong,
.image-lightbox-prompt p {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.image-lightbox-prompt {
  margin-top: 8px;
}

.image-lightbox-strip {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.image-lightbox-strip button {
  width: 76px;
  height: 76px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a0c0d;
  overflow: hidden;
  cursor: pointer;
}

.image-lightbox-strip button.active {
  border-color: var(--teal);
}

.image-lightbox-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-feed-stage video,
.media-feed-stage img {
  width: 100%;
  display: block;
  background: #070808;
}

.media-feed-stage video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.media-feed-stage img {
  max-height: 72vh;
  object-fit: contain;
}

.media-feed-stage img[data-feed-image-preview] {
  cursor: zoom-in;
  pointer-events: auto;
}

.media-feed-loading,
.media-feed-empty,
.media-feed-more {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.media-feed-card.is-generating:not(.is-failed) .media-feed-loading {
  position: static;
  width: 100%;
  min-height: clamp(150px, 22vw, 220px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  transform: none;
}

.media-feed-card.is-generating.is-video:not(.is-failed) .media-feed-loading {
  min-height: inherit;
}

.preview-soft-empty {
  width: min(100%, 520px);
  justify-self: center;
}

.media-feed-card.preview-unavailable .media-feed-stage {
  min-height: 260px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.media-feed-card.preview-unavailable .media-feed-select {
  top: 96px;
}

.media-feed-card.preview-unavailable .media-feed-actions {
  top: 96px;
}

.media-feed-card.preview-unavailable .media-feed-actions {
  opacity: 0.34;
  transition: opacity 160ms ease;
}

.media-feed-card.preview-unavailable:hover .media-feed-actions {
  opacity: 1;
}

.media-feed-card.preview-unavailable .preview-soft-empty {
  min-height: 220px;
  padding: 72px 18px 26px;
}

.media-feed-card.is-generating .loader-ring {
  opacity: 1;
  animation: spin 900ms linear infinite;
}

.media-feed-select {
  position: absolute;
  left: 12px;
  top: 96px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.history-table-wrap {
  max-height: 260px;
  overflow: auto;
  margin-top: 14px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.history-card-row {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  cursor: pointer;
}

.history-card-row:hover {
  border-color: rgba(56, 214, 198, 0.38);
  background: rgba(56, 214, 198, 0.06);
}

.history-card-main,
.history-card-meta {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-card-main {
  min-width: 0;
}

.history-card-meta {
  margin-top: 6px;
  min-width: 0;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.history-actions,
.favorite-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  display: flex;
  align-items: center;
}

.history-more {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.history-more:hover {
  color: var(--text);
  border-color: rgba(56, 214, 198, 0.45);
}

.history-menu {
  position: fixed;
  right: auto;
  top: auto;
  z-index: 70;
  min-width: 168px;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161b1b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.history-menu.open {
  display: grid;
  gap: 3px;
}

.preset-menu.open {
  display: grid;
  gap: 3px;
}

.history-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
}

.history-menu button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.history-credits {
  display: none;
}

.history-model {
  display: inline-flex;
  max-width: 88px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--text);
  font-weight: 800;
}

.history-title {
  display: block;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.favorites-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.favorite-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.favorite-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #070909;
  cursor: pointer;
}

.favorite-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.favorite-body {
  display: grid;
  gap: 4px;
  padding: 10px 44px 12px 12px;
}

.favorite-body strong {
  color: var(--text);
  font-size: 0.96rem;
}

.favorite-body span {
  color: var(--muted);
  font-size: 0.78rem;
}

.favorite-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.favorite-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.favorites-modal-card {
  width: min(1040px, calc(100vw - 34px));
}

.favorites-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: min(72vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.favorites-panel .favorite-card {
  min-width: 0;
}

.favorites-panel .favorite-preview {
  min-height: 150px;
}

.history-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.history-status-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.history-status-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.history-status-icon.complete {
  color: var(--green);
  border-color: rgba(156, 219, 114, 0.72);
  background: rgba(156, 219, 114, 0.1);
}

.history-status-icon.failed {
  color: var(--coral);
  border-color: rgba(233, 107, 93, 0.72);
  background: rgba(233, 107, 93, 0.1);
}

.history-status-icon.generating {
  border-color: rgba(56, 214, 198, 0.55);
}

.history-status-icon.generating .mini-spinner {
  width: 12px;
  height: 12px;
}

.mini-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

.history-detail {
  margin-top: 10px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
  line-height: 1.55;
  word-break: break-word;
}

.history-detail-page,
.directory-picker {
  position: fixed;
  inset: 0;
  display: none;
  overflow: auto;
  padding: 28px;
  background: rgba(5, 7, 8, 0.78);
  backdrop-filter: blur(14px);
}

.history-detail-page {
  z-index: 90;
}

.directory-picker {
  z-index: 65;
}

.history-detail-page.show,
.directory-picker.show {
  display: block;
}

.history-detail-sheet,
.directory-picker-sheet {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.directory-picker-sheet {
  width: min(780px, 100%);
}

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

.detail-head h2 {
  margin: 3px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
  margin-top: 16px;
}

.detail-video-panel,
.detail-meta-panel,
.detail-prompt {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050606;
}

.detail-video.empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
}

.detail-meta-panel {
  display: grid;
  align-content: start;
  padding: 12px;
  gap: 8px;
}

.detail-row {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-row span {
  color: var(--muted);
  font-size: 0.75rem;
}

.detail-row strong {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
}

.detail-prompt {
  margin-top: 14px;
  padding: 12px;
}

.detail-section-title {
  color: var(--text);
  font-weight: 820;
}

.detail-prompt pre {
  min-height: 120px;
  margin-top: 10px;
}

.directory-current {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  word-break: break-all;
}

.directory-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.directory-list {
  display: grid;
  gap: 8px;
  max-height: min(58vh, 520px);
  margin-top: 12px;
  overflow: auto;
}

.directory-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.directory-item:hover {
  border-color: rgba(123, 211, 190, 0.5);
  background: rgba(123, 211, 190, 0.1);
}

.directory-empty {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
}

.note-editor {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.note-editor .label {
  grid-column: 1 / -1;
}

.note-editor.show {
  display: grid;
}

.ref-grid {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.ref-empty {
  grid-column: 1 / -1;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.ref-group {
  display: grid;
  gap: 9px;
}

.ref-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.ref-group-head strong {
  color: var(--text);
}

.ref-group-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(58px, 1fr));
  gap: 8px;
}

.ref-group-frames .ref-group-grid {
  grid-template-columns: repeat(2, minmax(82px, 112px));
  justify-content: start;
}

.ref-group-video .ref-group-grid,
.ref-group-audio .ref-group-grid {
  grid-template-columns: repeat(4, minmax(72px, 96px));
  justify-content: start;
}

.ref-slot {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
}

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

.media-ref-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px;
  color: var(--text);
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}

.media-ref-icon svg {
  width: 28px;
  height: 28px;
  color: var(--green);
}

.media-ref-icon small {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-slot button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  color: #111;
  background: rgba(255, 255, 255, 0.88);
}

.ref-slot .frame-pick-button {
  position: static;
  width: auto;
  height: auto;
  padding: 7px 9px;
  border: 1px solid rgba(56, 214, 198, 0.35);
  border-radius: 7px;
  color: var(--text);
  background: rgba(56, 214, 198, 0.09);
  font-size: 0.75rem;
  font-weight: 800;
}

.ref-group-video .ref-slot,
.ref-group-audio .ref-slot {
  aspect-ratio: 1.25;
}

.add-ref-slot {
  border-style: solid;
  cursor: pointer;
  color: var(--green);
  font-weight: 850;
}

.add-ref-slot:hover {
  border-color: rgba(56, 214, 198, 0.6);
  background: rgba(56, 214, 198, 0.08);
}

.frame-drop-slot {
  border-style: solid;
  border-color: rgba(56, 214, 198, 0.28);
}

.ref-badge {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #08110f;
  background: rgba(123, 211, 190, 0.92);
  font-size: 0.68rem;
  font-weight: 850;
}

pre {
  margin: 14px 0 0;
  min-height: 168px;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #e7efe9;
  background: #101314;
  line-height: 1.55;
}

.matrix {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.matrix-row {
  display: grid;
  grid-template-columns: 58px 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.matrix-row > div {
  padding: 9px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 0.82rem;
}

.matrix-row.header > div {
  color: var(--text);
  font-weight: 800;
  background: transparent;
}

.matrix-row .selected {
  color: #0c1110;
  background: var(--green);
  font-weight: 860;
}

.preset-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.preset-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.preset-apply {
  width: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  padding: 0;
  min-width: 0;
}

.preset-actions {
  position: relative;
}

.preset-title {
  display: block;
  font-weight: 800;
}

.preset-meta {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retention-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 173, 69, 0.28);
  border-radius: 8px;
  color: #f4c56b;
  background: rgba(244, 173, 69, 0.08);
  font-size: 0.82rem;
  line-height: 1.5;
}

.preset-editor-sheet {
  width: min(980px, calc(100vw - 34px));
}

.preset-editor-grid {
  display: grid;
  gap: 14px;
}

.preset-editor-grid textarea {
  min-height: 240px;
}

.preset-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.preset-edit-media-grid {
  grid-template-columns: 1fr;
}

.preset-media-group {
  display: grid;
  gap: 8px;
}

.preset-media-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 112px));
  gap: 8px;
}

.preset-media-group-frames .preset-media-slots {
  grid-template-columns: repeat(2, minmax(86px, 112px));
}

.preset-edit-slot {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.preset-edit-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-add-media {
  border: 0;
  color: var(--green);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}

.preset-replace-media,
.preset-remove-media {
  position: absolute;
  top: 5px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  color: #111;
  background: rgba(255, 255, 255, 0.9);
}

.preset-replace-media {
  left: 5px;
  font-size: 0.72rem;
  font-weight: 850;
}

.preset-remove-media {
  right: 5px;
  font-size: 1rem;
}

.preset-media-item {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.preset-media-item span,
.preset-media-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.preset-media-item img,
.preset-media-item video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #060808;
}

.preset-media-item audio {
  width: 100%;
}

.preset-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 9999;
  width: max-content;
  max-width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 16px 20px;
  border: 1px solid rgba(56, 214, 198, 0.5);
  border-radius: 12px;
  color: var(--text);
  background: rgba(12, 18, 18, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  font-size: 1rem;
  font-weight: 840;
  line-height: 1.45;
  text-align: center;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 1180px) {
  .studio-image-module {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .image-creations-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .image-creations-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }

  .public-hero-content {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .public-showcase {
    max-width: 560px;
  }

  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .history-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .studio-image-module {
    grid-template-columns: 1fr;
  }

  .image-tool-panel,
  .image-creations-panel {
    position: static;
  }

  .asset-library-page {
    grid-template-columns: 1fr;
    margin-top: 8px;
  }

  .asset-sidebar {
    position: static;
  }

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

  .asset-library-head {
    align-items: stretch;
    flex-direction: column;
  }

  .account-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions,
  .account-actions .tool-button {
    width: 100%;
  }

  .account-actions {
    justify-content: space-between;
  }

  .account-menu-wrap {
    margin-left: auto;
  }

  .admin-stats,
  .admin-settings {
    grid-template-columns: 1fr;
  }

  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-search {
    width: 100%;
  }

  .admin-pager {
    align-items: stretch;
    flex-direction: column;
  }

  .recharge-row {
    grid-template-columns: 1fr 1fr;
  }

  .recharge-row.header {
    display: none;
  }

  .public-nav {
    padding: 14px 16px;
  }

  .public-hero {
    min-height: auto;
  }

  .public-hero-content {
    width: min(100% - 24px, 640px);
    padding: 104px 0 42px;
  }

  .public-hero-content h1 {
    white-space: normal;
  }

  .public-actions,
  .public-nav-actions {
    flex-wrap: wrap;
  }

  .public-notice {
    width: min(100% - 24px, 640px);
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .hero {
    min-height: auto;
  }

  .workspace,
  .prompt-layout,
  .history-panel,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    width: min(100% - 20px, 640px);
  }

  .hero-content {
    width: min(100% - 24px, 640px);
  }

  .studio-title {
    align-items: flex-start;
  }

  .studio-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

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

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

  .toolbar,
  .section-row,
  .video-options,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding-left: 0;
    padding-bottom: 36px;
  }

  .footer-brand-column p {
    margin-bottom: 26px;
  }

  .toolbar {
    top: 92px;
  }

  .reference-actions {
    justify-items: start;
  }

  .reference-button-row {
    flex-wrap: wrap;
  }

  .footer-contact {
    justify-content: flex-start;
  }

  .save-dir-row {
    grid-template-columns: 1fr;
  }

  .history-detail-page,
  .directory-picker {
    padding: 10px;
  }

  .directory-actions {
    flex-direction: column;
  }

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

  .image-studio-grid,
  .image-result-grid,
  .image-generator-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .field-grid {
    grid-template-columns: 1fr;
  }

  .matrix-row {
    grid-template-columns: 48px 1fr 1fr;
  }

  .toolbar-actions,
  .template-actions,
  .video-tools,
  .tool-button,
  .upload-button {
    width: 100%;
  }

  .video-tools {
    grid-template-columns: 1fr;
  }

  .poll-tools {
    grid-template-columns: 1fr;
  }
}

.ui-hidden-block {
  display: none !important;
}

.duration-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

@media (min-width: 1181px) {
  body {
    font-size: 13px;
  }

  .app-shell {
    background: #0d0f10;
    font-size: 13px;
  }

  .app-shell .hero {
    display: none;
  }

  .account-bar {
    padding: 8px 16px;
    gap: 18px;
    background:
      linear-gradient(90deg, rgba(4, 7, 7, 0.98) 0%, rgba(12, 54, 49, 0.92) 28%, rgba(37, 54, 35, 0.72) 62%, rgba(8, 10, 10, 0.98) 100%),
      rgba(13, 15, 16, 0.94);
  }

  .account-bar > div:first-child {
    gap: 12px;
  }

  .account-home-link {
    font-size: 0.92rem;
  }

  .account-bar span {
    font-size: 0.78rem;
  }

  .top-module-tabs {
    display: none;
  }

  .workspace > .module-tabs {
    display: inline-flex;
    width: max-content;
    padding: 5px;
    border-color: var(--line);
    background: #0d0f10;
  }

  .workspace > .module-tabs button {
    min-height: 36px;
    padding: 0 14px;
    color: var(--muted);
    background: transparent;
  }

  .workspace > .module-tabs button.active {
    color: #071211;
    background: var(--teal);
  }

  .workspace {
    width: calc(100% - 24px);
    margin: 10px 12px 28px;
    grid-template-columns: 430px minmax(0, 1fr) 390px;
    gap: 12px;
  }

  .price-card {
    display: none !important;
  }

  .summary-box,
  .usage-box {
    display: none !important;
  }

  .control-panel {
    position: sticky;
    top: 58px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
  }

  .control-panel,
  .main-panel,
  .history-panel > div {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  }

  .control-panel,
  .history-panel > div {
    padding: 16px;
  }

  .main-panel {
    padding: 16px;
    gap: 16px;
  }

  .video-panel {
    max-width: none;
    border-top: 0;
    padding-top: 0;
  }

  .preview-stage {
    display: none;
  }

  .video-panel .video-tools,
  .video-panel .poll-tools,
  .video-panel .video-options,
  .video-panel .save-hint,
  .video-panel .save-dir-row {
    display: none !important;
  }

  .saved-video {
    display: none;
  }

  .studio-image-module .image-canvas,
  .studio-image-module .image-page-caption,
  .studio-image-module .image-page-results {
    display: none;
  }

  .studio-image-module .image-media-feed {
    margin-top: 0;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-items: start;
    align-content: start;
    justify-content: start;
    gap: 22px;
  }

  .video-panel > .media-feed {
    min-height: min(760px, calc(100vh - 185px));
    max-height: calc(100vh - 132px);
  }

  .media-feed-actions button {
    width: 32px;
    min-width: 0;
    height: 32px;
    padding: 0;
  }

  .media-feed-actions span {
    display: none;
  }

  .studio-image-module .image-media-feed .media-feed-card {
    width: 100%;
    max-width: 360px;
  }

  .studio-image-module .image-media-feed .media-feed-head {
    display: grid;
    gap: 10px;
    align-items: start;
  }

  .studio-image-module .image-media-feed .media-feed-meta {
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .studio-image-module .image-media-feed .media-feed-meta span {
    width: 100%;
    justify-content: center;
  }

  .studio-image-module .image-media-feed .media-feed-stage {
    min-height: 0;
    display: grid;
    place-items: center;
  }

  .studio-image-module .image-media-feed .media-feed-card.preview-unavailable .media-feed-stage {
    min-height: 240px;
    aspect-ratio: 1 / 1;
  }

  .studio-image-module .image-media-feed .media-feed-card.preview-unavailable .preview-soft-empty {
    min-height: 220px;
    padding-top: 74px;
  }

  .studio-image-module .image-media-feed .media-feed-card.preview-unavailable .media-feed-select,
  .studio-image-module .image-media-feed .media-feed-card.preview-unavailable .media-feed-actions {
    top: 90px;
  }

  .studio-image-module .image-media-feed .media-feed-card.is-generating .media-feed-stage {
    aspect-ratio: auto;
    min-height: 0;
  }

  .studio-image-module .image-media-feed .media-feed-stage img {
    width: 100%;
    height: auto;
    max-height: min(62vh, 520px);
    object-fit: contain;
  }

  .studio-image-module .image-media-feed .media-feed-actions {
    right: 8px;
    top: 90px;
    grid-template-columns: 30px;
    gap: 6px;
  }

  .studio-image-module .image-media-feed .media-feed-actions button {
    min-width: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
  }

  .studio-image-module .image-media-feed .media-feed-actions span {
    display: none;
  }

  #resultVideo {
    object-fit: cover;
  }

  .control-panel .toolbar {
    position: static;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    background: transparent;
  }

  .control-panel .toolbar h2,
  .control-panel .section-row h2 {
    font-size: 0.92rem;
  }

  .control-panel .toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .control-panel .primary-action {
    min-height: 38px;
  }

  .prompt-rich-editor,
  textarea#prompt {
    min-height: 170px;
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .prompt-meta {
    font-size: 0.74rem;
  }

  .prompt-reference-picker {
    padding: 10px;
  }

  .prompt-reference-chip {
    min-width: 92px;
    max-width: 132px;
  }

  .reference-panel {
    margin-top: 14px;
  }

  .ref-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .history-table-wrap {
    max-height: 40vh;
    overflow-y: auto;
  }

  .history-list {
    display: grid;
    gap: 8px;
  }

  .history-card-row {
    min-height: 86px;
    padding: 12px 42px 12px 12px;
    border-radius: 8px;
  }

  .history-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .history-model {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }

  .ref-group-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
  }

  .ref-group-image .ref-slot,
  .ref-group-video .ref-slot,
  .ref-group-audio .ref-slot,
  .ref-group-frames .ref-slot {
    width: 86px;
    min-width: 86px;
    aspect-ratio: 1.08;
  }

  h1 {
    font-size: clamp(1.8rem, 2.6vw, 2.8rem);
  }

  h2 {
    font-size: 0.98rem;
  }

  .kicker,
  .eyebrow,
  .label {
    font-size: 0.68rem;
  }

  .workspace .eyebrow {
    display: none;
  }

  .workspace .section-row h2,
  .workspace .toolbar h2,
  .workspace .history-panel h2,
  .workspace .presets-card h2,
  .workspace .reference-panel h2,
  .workspace .video-panel h2 {
    color: var(--amber);
    white-space: nowrap;
    word-break: keep-all;
  }

  .site-footer {
    width: calc(100% - 24px);
    margin: auto 12px 28px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(18, 22, 22, 0.72);
    align-items: flex-start;
    font-size: 0.76rem;
  }

  .studio-footer-note {
    display: block;
    max-width: 840px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.65;
  }

  .footer-contact {
    padding-top: 4px;
    font-size: 0.76rem;
  }
}

.duration-label-row strong {
  color: var(--green);
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
}

.duration-slider {
  accent-color: var(--green);
  padding: 0;
}

.duration-ticks {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}
