:root {
  --bg: #eef2ff;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --ink: #17213b;
  --muted: #73809d;
  --line: rgba(111, 125, 170, 0.16);
  --primary: #6d5dfc;
  --primary-dark: #5142da;
  --primary-soft: #f0efff;
  --pink: #ff7bbd;
  --blue: #6cc7ff;
  --green: #66d7a7;
  --warning: #f7b955;
  --shadow: 0 28px 80px rgba(58, 70, 135, 0.18);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(139, 126, 255, 0.24), transparent 30%),
    radial-gradient(circle at 78% 0%, rgba(255, 202, 236, 0.55), transparent 32%),
    linear-gradient(135deg, #f4f6ff 0%, #eef3ff 45%, #fff7fb 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.desktop-frame {
  position: relative;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  width: min(1380px, calc(100vw - 48px));
  min-height: calc(100vh - 72px);
  margin: 36px auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.window-dots {
  position: absolute;
  top: 28px;
  left: 38px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.window-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.window-dots span:nth-child(1) {
  background: #ff5f57;
}

.window-dots span:nth-child(2) {
  background: #ffbd2e;
}

.window-dots span:nth-child(3) {
  background: #28c840;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 88px 16px 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand {
  padding: 0 22px;
}

.brand-symbol {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--primary);
}

.brand-symbol svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  filter: drop-shadow(0 6px 12px rgba(109, 93, 252, 0.28));
}

.brand strong,
.mobile-brand strong {
  font-size: 22px;
  letter-spacing: -0.01em;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 12px;
  color: #31405f;
  font-weight: 700;
  text-decoration: none;
}

.side-nav a.is-active,
.side-nav a:hover {
  background: linear-gradient(135deg, #7b68ff, #5d46f5);
  color: #fff;
  box-shadow: 0 16px 34px rgba(98, 76, 247, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.nav-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 16px;
}

.upgrade-card,
.profile-card,
.create-card,
.result-panel,
.works-section,
.history-section,
.admin-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(63, 78, 134, 0.1);
  backdrop-filter: blur(20px);
}

.upgrade-card {
  margin-top: auto;
  padding: 18px;
}

.upgrade-card strong,
.upgrade-card p {
  display: block;
  margin: 0;
}

.upgrade-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.upgrade-card button,
.save-button,
.generate-button {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7f75ff);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(109, 93, 252, 0.25);
}

.upgrade-card button {
  width: 100%;
  min-height: 38px;
  margin-top: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.avatar,
.small-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd6b6, #87d9ff);
  color: #28324a;
  font-weight: 900;
}

.avatar {
  width: 40px;
  height: 40px;
}

.small-avatar {
  width: 34px;
  height: 34px;
}

.profile-card small {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 900;
}

.chevron {
  margin-left: auto;
  color: var(--muted);
}

.topbar {
  position: absolute;
  top: 22px;
  right: 28px;
  left: 268px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.mobile-brand {
  display: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  pointer-events: auto;
}

.credit-pill,
.bell-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--primary-dark);
  font-weight: 900;
}

.credit-pill {
  gap: 7px;
  padding: 0 14px;
}

.bell-button {
  width: 34px;
  color: var(--ink);
}

main {
  min-width: 0;
  padding: 82px 34px 28px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view .user-panel {
  display: none;
}

.view .user-panel.is-active {
  display: block;
}

.user-layout {
  display: block;
  width: 100%;
  max-width: none;
}

.creator-column {
  min-width: 0;
}

.creator-column .flow-screen {
  display: none;
}

.creator-column[data-create-flow="input"] [data-flow-screen="input"],
.creator-column[data-create-flow="progress"] [data-flow-screen="progress"],
.creator-column[data-create-flow="result"] [data-flow-screen="result"] {
  display: block;
}

.admin-hero p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.create-card {
  position: relative;
  overflow: hidden;
  padding: 34px 28px 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.input-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 6px 42px;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  gap: 18px;
}

.input-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 130px;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.input-toggle #blindModeButton {
  min-width: 142px;
}

.input-toggle button.is-active {
  background: linear-gradient(135deg, #806dff, #634bf6);
  color: white;
  box-shadow: 0 14px 28px rgba(109, 93, 252, 0.32);
}

.prompt-panel {
  display: none;
}

.prompt-panel.is-active {
  display: block;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 160px;
  padding: 16px;
  line-height: 1.7;
  resize: vertical;
}

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

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(109, 93, 252, 0.55);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

.voice-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 270px;
  text-align: center;
}

.voice-stage.is-hidden {
  display: none;
}

.ambient-wave {
  position: absolute;
  inset: 44px 18px 20px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.ambient-wave::before,
.ambient-wave::after {
  display: none;
  content: none;
}

.ambient-wave::after {
  width: 176px;
  height: 176px;
  border-style: solid;
  border-color: rgba(109, 93, 252, 0.13);
}

.ambient-wave span {
  display: none;
}

.ambient-wave span:first-child {
  left: 12px;
  transform: scaleY(0.65);
}

.ambient-wave span:last-child {
  right: 12px;
  transform: scaleY(0.65) rotate(180deg);
}

.mic-button {
  position: relative;
  display: block;
  z-index: 2;
  width: 112px;
  height: 112px;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8f82ff, #604cff);
  color: white;
  font-size: 40px;
  box-shadow: 0 20px 44px rgba(109, 93, 252, 0.34);
}

.mic-button::before {
  content: none;
}

.mic-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 46px;
  height: 42px;
  border: 0;
  border-radius: 0;
  transform: translate(-50%, -50%);
}

.mic-dot i {
  display: block;
  width: 6px;
  border-radius: 999px;
  background: #fff;
}

.mic-dot i:nth-child(1),
.mic-dot i:nth-child(4) {
  height: 20px;
}

.mic-dot i:nth-child(2),
.mic-dot i:nth-child(3) {
  height: 34px;
}

.record-wave-button {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
  width: min(430px, 78vw);
  min-height: 94px;
  border: 0;
  border-radius: 46px;
  background: linear-gradient(135deg, #7b6cff, #5e50e8);
  box-shadow: 0 18px 38px rgba(109, 93, 252, 0.32);
}

.record-wave-button i {
  display: block;
  width: 7px;
  height: 18px;
  border-radius: 999px;
  background: white;
  transition: height 0.08s linear;
}

.mic-button.is-recording {
  display: none;
}

.record-wave-button.is-active {
  display: flex;
}

.record-wave-button.is-active::after {
  position: absolute;
  inset: -10px;
  content: "";
  border: 2px solid rgba(109, 93, 252, 0.22);
  border-radius: 56px;
  animation: micPulse 1.3s ease-in-out infinite;
}

@keyframes micPulse {
  0% {
    transform: scale(0.92);
    opacity: 1;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

.voice-stage strong {
  min-height: 0;
  margin-top: 0;
}

.voice-stage small,
.voice-stage p {
  position: relative;
  z-index: 2;
  color: var(--muted);
}

.voice-stage small:empty,
.voice-stage p:empty {
  display: none;
}

.voice-stage p {
  margin: 8px 0 0;
}

.reference-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.reference-card {
  position: relative;
  overflow: hidden;
  width: 86px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}

.reference-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.reference-card button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 33, 59, 0.72);
  color: white;
}

.quick-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: end;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.ratio-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.ratio-card {
  display: grid;
  min-height: 126px;
  place-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-weight: 800;
}

.ratio-card.is-active {
  border-color: rgba(109, 93, 252, 0.78);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 16px 32px rgba(109, 93, 252, 0.16);
}

.ratio-shape {
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1;
}

.ratio-card strong {
  font-size: 13px;
}

.ratio-card small {
  color: #8290b4;
  font-size: 11px;
  font-weight: 800;
}

.quick-settings label span,
.settings-grid label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.advanced-button {
  display: grid;
  min-height: 126px;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  color: var(--primary-dark);
  font-weight: 900;
}

.advanced-button span {
  font-size: 30px;
}

.advanced-button small {
  color: var(--muted);
  font-size: 11px;
}

#referenceInput {
  display: none;
}

.generate-button {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b99cff, #674cff 48%, #54baff);
  font-size: 18px;
}

.generate-button small {
  color: rgba(255, 255, 255, 0.76);
}

.result-panel,
.progress-panel,
.works-section,
.history-section,
.admin-card {
  margin-top: 28px;
  padding: 22px;
}

.progress-panel {
  min-height: 640px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(63, 78, 134, 0.1);
  backdrop-filter: blur(20px);
}

.progress-core {
  display: grid;
  min-height: 590px;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.progress-core .progress-icon {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8f82ff, #604cff);
  color: #fff;
  font-size: 32px;
  box-shadow: 0 18px 38px rgba(109, 93, 252, 0.28), 0 0 0 24px rgba(109, 93, 252, 0.06);
}

.progress-core strong {
  font-size: 28px;
}

.progress-core p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

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

.section-head h2,
.admin-hero h1 {
  margin: 0;
}

.section-head span,
.section-head button,
.generation-meta,
.admin-hero span {
  color: var(--primary-dark);
}

.section-head button,
.result-actions button,
.back-user {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-actions button {
  padding: 0 14px;
}

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

.poster-stage {
  position: relative;
  display: grid;
  min-height: 580px;
  margin-top: 16px;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(109, 93, 252, 0.08), rgba(255, 255, 255, 0.72)),
    #f8faff;
}

#posterImage {
  display: none;
  max-width: min(100%, 360px);
  max-height: 64vh;
  border-radius: 14px;
  box-shadow: 0 20px 46px rgba(41, 52, 92, 0.22);
}

#posterImage.has-output {
  display: block;
}

.blind-gallery {
  display: none;
  width: 100%;
  gap: 16px;
  padding: 18px;
}

.blind-gallery.is-active {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.blind-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 14px 30px rgba(62, 72, 124, 0.12);
}

.blind-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--primary-soft);
}

.blind-card div {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.blind-card strong {
  font-size: 14px;
}

.blind-card div button {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
}

.empty-result {
  display: grid;
  max-width: 310px;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-result strong {
  color: var(--ink);
}

.empty-result.is-hidden {
  display: none;
}

.progress-track {
  overflow: hidden;
  width: min(270px, 72vw);
  height: 10px;
  margin-top: 10px;
  border-radius: 999px;
  background: #e1e5ff;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  transition: width 0.35s ease;
}

.progress-track.large {
  width: min(560px, 82vw);
  height: 14px;
}

.progress-panel.flow-screen,
.result-panel.flow-screen {
  margin-top: 0;
}

.restart-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #b99cff, #674cff 48%, #54baff);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(109, 93, 252, 0.2);
}

.generation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}

.work-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 14px 32px rgba(62, 72, 124, 0.1);
}

.poster-art {
  position: relative;
  display: grid;
  min-height: 210px;
  align-content: start;
  padding: 18px;
  color: white;
}

.poster-art strong {
  max-width: 80%;
  font-size: 22px;
  line-height: 1.05;
}

.poster-art small {
  margin-top: 6px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.poster-art::after {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  content: "";
}

.summer {
  background: linear-gradient(160deg, #4ec9ff, #33b596);
}

.coffee {
  background: linear-gradient(160deg, #ead1b7, #8d5b38);
}

.yoga {
  background: linear-gradient(160deg, #c8efcf, #5ca86c);
}

.future {
  background: linear-gradient(160deg, #081a4d, #4b74ff);
}

.sports {
  background: linear-gradient(160deg, #62a8ff, #3b6fd8);
}

.food {
  background: linear-gradient(160deg, #ffba66, #fb7048);
}

.music {
  background: linear-gradient(160deg, #0f0b2e, #8c40ff);
}

.product {
  background: linear-gradient(160deg, #eaf3ff, #9ab9df);
  color: #233252;
}

.reading {
  background: linear-gradient(160deg, #d6c09b, #5a4633);
}

.works-section,
.history-section {
  max-width: none;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.work-filter {
  display: inline-flex;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(109, 93, 252, 0.08);
}

.work-filter button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.work-filter button.is-active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(109, 93, 252, 0.14);
}

.work-card {
  position: relative;
  overflow: hidden;
}

.download-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  background: rgba(23, 38, 64, 0.9);
  color: #d9e8ff;
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.download-corner:hover {
  background: #2f80ff;
  color: #fff;
}

.download-corner:disabled {
  display: none;
}

.result-download {
  top: 14px;
  right: 14px;
  left: auto;
}

.favorite-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(23, 33, 59, 0.12);
}

.favorite-toggle.is-active {
  background: linear-gradient(135deg, #fff1b8, #ffd36f);
  color: #805300;
}

.work-card img,
.work-pending {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.work-pending {
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-align: center;
}

.work-card > div:not(.work-pending) {
  padding: 12px;
}

.work-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.work-action-row .mini-action {
  margin-top: 0;
}

.work-action-row .reproduce-action {
  border-color: rgba(77, 120, 255, 0.72);
  background: rgba(47, 108, 255, 0.18);
  color: #dce8ff;
}

.work-card strong,
.work-card span {
  display: block;
}

.work-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.mini-action {
  min-height: 32px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.72);
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-hero h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.back-user {
  padding: 0 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.save-button {
  min-height: 46px;
  margin-top: 18px;
  padding: 0 20px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 20px;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.record-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

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

.record-item span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 1180px) {
  .desktop-frame {
    grid-template-columns: 1fr;
    width: min(430px, 100vw);
    min-height: 100vh;
    margin: 0 auto;
    border-radius: 0;
  }

  .window-dots,
  .sidebar {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    padding: 18px 20px 10px;
    background: rgba(248, 249, 255, 0.88);
    backdrop-filter: blur(16px);
  }

  .mobile-brand {
    display: inline-flex;
  }

  .mobile-brand strong {
    font-size: 17px;
  }

  main {
    padding: 18px 18px 96px;
  }

  .view .user-layout {
    display: block;
  }

  .create-card {
    padding: 18px;
    border-radius: 24px;
  }

  .input-toggle {
    width: 100%;
    gap: 6px;
  }

  .input-toggle button {
    flex: 1;
    min-width: 0;
    font-size: 13px;
  }

  .input-toggle #blindModeButton {
    min-width: 0;
  }

  .voice-stage {
    min-height: 224px;
  }

  .mic-button {
    width: 96px;
    height: 96px;
  }

  .quick-settings {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .advanced-button {
    grid-column: auto;
  }

  .ratio-picker {
    grid-template-columns: repeat(5, minmax(94px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .progress-panel,
  .result-panel {
    margin-top: 0;
  }

  .blind-gallery.is-active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .poster-art {
    min-height: 170px;
    padding: 12px;
  }

  .poster-art strong {
    font-size: 16px;
  }

  .works-section,
  .history-section {
    margin-right: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .work-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 10px;
  }

  .work-card {
    flex: 0 0 128px;
  }

  .history-section {
    margin-top: 16px;
  }

  .admin-hero,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .mobile-tabbar {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: min(398px, calc(100vw - 24px));
    transform: translateX(-50%);
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 48px rgba(58, 70, 135, 0.22);
    backdrop-filter: blur(20px);
  }

  .mobile-tabbar a,
  .mobile-tabbar button {
    display: grid;
    min-height: 42px;
    place-items: center;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
  }

  .mobile-tabbar a.is-active {
    color: var(--primary-dark);
  }

  .mobile-tabbar button {
    width: 54px;
    height: 54px;
    align-self: center;
    justify-self: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8c7cff);
    color: white;
    font-size: 30px;
    box-shadow: 0 12px 24px rgba(109, 93, 252, 0.34);
  }
}

@media (max-width: 380px) {
  main {
    padding-inline: 12px;
  }

  .quick-settings {
    grid-template-columns: 1fr;
  }

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

/* Dark theme pass */
:root {
  --bg: #050506;
  --panel: rgba(17, 18, 22, 0.94);
  --panel-strong: #15161b;
  --ink: #f4f7fb;
  --muted: #8d96a6;
  --line: rgba(255, 255, 255, 0.1);
  --primary: #7b61ff;
  --primary-dark: #b5a7ff;
  --primary-soft: rgba(123, 97, 255, 0.16);
  --pink: #ff5faa;
  --blue: #35a7ff;
  --green: #45d38b;
  --warning: #f0b74d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
}

body {
  background:
    radial-gradient(circle at 70% 4%, rgba(123, 97, 255, 0.18), transparent 26%),
    radial-gradient(circle at 8% 0%, rgba(53, 167, 255, 0.1), transparent 26%),
    linear-gradient(135deg, #050506 0%, #090a0d 48%, #050506 100%);
  color: var(--ink);
}

.desktop-frame {
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(8, 9, 12, 0.96);
  box-shadow: var(--shadow);
}

.sidebar {
  border-right-color: rgba(255, 255, 255, 0.08);
  background: rgba(7, 8, 11, 0.98);
}

.brand,
.mobile-brand,
.brand strong,
.mobile-brand strong,
.section-head h2,
.admin-hero h1,
.empty-result strong,
.work-card strong,
.record-item strong,
.profile-card strong,
.upgrade-card strong {
  color: var(--ink);
}

.side-nav a {
  border-radius: 8px;
  color: #a4adbd;
}

.side-nav a.is-active,
.side-nav a:hover {
  background: linear-gradient(135deg, #714fff, #2d7bff);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.upgrade-card,
.profile-card,
.create-card,
.result-panel,
.progress-panel,
.works-section,
.history-section,
.admin-card {
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.profile-card,
.record-item,
.work-card,
.blind-card,
.reference-card,
.table-wrap {
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: var(--panel-strong);
}

textarea,
input,
select {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(5, 6, 8, 0.86);
  color: var(--ink);
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(123, 97, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.16);
}

.input-toggle {
  margin-left: 0;
}

.input-toggle button,
.section-head button,
.result-actions button,
.back-user,
.mini-action,
.blind-card div button,
.save-button,
.upgrade-card button {
  border-radius: 6px;
}

.input-toggle button.is-active,
.save-button,
.upgrade-card button {
  background: linear-gradient(135deg, #714fff, #2d7bff);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

.mic-button,
.progress-core .progress-icon {
  background: linear-gradient(135deg, #714fff, #2d7bff);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.record-wave-button {
  border-radius: 10px;
  background: linear-gradient(135deg, #714fff, #2d7bff);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.record-wave-button.is-active::after {
  border-radius: 12px;
}

.quick-settings {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.ratio-card,
.advanced-button {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(9, 10, 14, 0.9);
  color: #a4adbd;
}

.ratio-card.is-active {
  border-color: rgba(123, 97, 255, 0.86);
  background: rgba(123, 97, 255, 0.16);
  color: #d7d0ff;
  box-shadow: none;
}

.ratio-shape {
  border-radius: 4px;
}

.advanced-button {
  color: #d7d0ff;
}

.generate-button,
.restart-button {
  border-radius: 8px;
  background: linear-gradient(90deg, #714fff, #2d7bff);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.poster-stage {
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(123, 97, 255, 0.08), rgba(53, 167, 255, 0.05)),
    #07080b;
}

#posterImage,
.reference-card img,
.blind-card img,
.work-card img,
.poster-art {
  border-radius: 6px;
}

.blind-card,
.work-card {
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

.progress-track {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-track span {
  background: linear-gradient(90deg, #714fff, #35a7ff);
}

.generation-meta,
.section-head span,
.section-head button,
.admin-hero span,
.work-card span,
.record-item span,
.voice-stage small,
.voice-stage p,
.upgrade-card p,
.ratio-card small,
.advanced-button small,
th {
  color: var(--muted);
}

.credit-pill,
.bell-button {
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(17, 18, 22, 0.94);
  color: #d7d0ff;
}

table {
  background: rgba(10, 11, 15, 0.8);
}

td,
th {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.work-filter {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.work-filter button {
  border-radius: 6px;
}

.work-filter button.is-active {
  background: rgba(123, 97, 255, 0.2);
  color: #d7d0ff;
  box-shadow: none;
}

.favorite-toggle {
  background: rgba(8, 9, 12, 0.82);
  color: #a4adbd;
  box-shadow: none;
}

.favorite-toggle.is-active {
  background: #ffc857;
  color: #15110a;
}

.mobile-tabbar {
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(10, 11, 15, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.mobile-tabbar a,
.mobile-tabbar button {
  border-radius: 8px;
}

.mobile-tabbar a.is-active {
  color: #d7d0ff;
}

.mobile-tabbar button {
  background: linear-gradient(135deg, #714fff, #2d7bff);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
}

@media (max-width: 1180px) {
  .desktop-frame {
    background: #050506;
  }

  .topbar {
    background: rgba(5, 6, 8, 0.92);
  }

  .works-section,
  .history-section {
    background: transparent;
    box-shadow: none;
  }
}

/* design-taste-frontend optimization pass */
:root {
  --bg: #050607;
  --panel: #101216;
  --panel-strong: #151820;
  --ink: #f5f7fb;
  --muted: #8b95a7;
  --line: rgba(255, 255, 255, 0.11);
  --primary: #2f80ff;
  --primary-dark: #8dbcff;
  --primary-soft: rgba(47, 128, 255, 0.14);
  --pink: #2f80ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  font-family: Aptos, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 78% 6%, rgba(47, 128, 255, 0.16), transparent 28%),
    #050607;
  background-size: 44px 44px, 44px 44px, auto, auto;
}

.desktop-frame {
  grid-template-columns: 220px minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  border-radius: 10px;
  background: #08090c;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
}

.window-dots {
  top: 22px;
  left: 28px;
}

.window-dots span {
  width: 10px;
  height: 10px;
}

.sidebar {
  gap: 24px;
  padding: 76px 14px 22px;
  background: #07080a;
}

.brand {
  padding: 0 14px;
}

.brand-symbol {
  color: var(--primary);
}

.brand strong,
.mobile-brand strong {
  font-size: 21px;
  letter-spacing: 0;
}

.side-nav {
  gap: 6px;
}

.side-nav a {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 4px;
  color: #9da7b8;
  font-size: 15px;
}

.side-nav a.is-active,
.side-nav a:hover {
  background: #172640;
  color: #f8fbff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: var(--primary-dark);
  font-size: 13px;
}

main {
  padding: 72px 30px 30px;
}

.topbar {
  top: 18px;
  right: 22px;
  left: 242px;
}

.credit-pill,
.bell-button,
.small-avatar {
  min-height: 32px;
  border-radius: 4px;
}

.small-avatar,
.avatar {
  background: #1a2a42;
  color: #d9e8ff;
}

.upgrade-card,
.profile-card,
.create-card,
.result-panel,
.progress-panel,
.works-section,
.history-section,
.admin-card {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}

.upgrade-card,
.profile-card {
  padding: 14px;
}

.is-create-tab .upgrade-card,
.is-create-tab .profile-card {
  transform: translateY(-36px);
}

.upgrade-card button,
.save-button,
.generate-button,
.restart-button {
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: none;
}

.upgrade-card button:hover,
.save-button:hover,
.generate-button:hover,
.restart-button:hover {
  background: #4a94ff;
}

.create-card,
.result-panel,
.progress-panel {
  position: relative;
  border-top: 1px solid rgba(47, 128, 255, 0.45);
}

.create-card {
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(47, 128, 255, 0.08), transparent 120px),
    var(--panel);
}

.input-toggle {
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #090b0f;
}

.input-toggle button {
  min-width: 150px;
  min-height: 38px;
  border-radius: 3px;
  color: #9da7b8;
}

.input-toggle #blindModeButton {
  min-width: 150px;
}

.input-toggle button.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.prompt-panel {
  margin-top: 18px;
}

textarea,
input,
select {
  border-radius: 3px;
  background: #080a0e;
}

.voice-stage {
  min-height: 330px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    #090b0f;
}

.voice-stage.is-hidden {
  display: none;
}

.mic-button,
.progress-core .progress-icon {
  width: 104px;
  height: 104px;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.record-wave-button {
  min-height: 82px;
  border-radius: 4px;
  background: var(--primary);
  box-shadow: none;
}

.reference-strip {
  margin: 16px 0 0;
}

.reference-card,
.work-card,
.blind-card,
.record-item,
.table-wrap {
  border-radius: 4px;
  background: var(--panel-strong);
  box-shadow: none;
}

.quick-settings {
  gap: 10px;
  padding-top: 18px;
  border-top: 0;
}

.ratio-picker {
  gap: 10px;
}

.ratio-card,
.advanced-button {
  min-height: 142px;
  border-radius: 4px;
  background: #090b0f;
}

.ratio-card.is-active {
  background: #101d31;
  box-shadow: inset 0 0 0 1px rgba(47, 128, 255, 0.42);
}

.ratio-shape {
  border-radius: 3px;
  font-size: 13px;
  font-weight: 900;
}

.ratio-card strong {
  font-size: 15px;
}

.ratio-card small {
  color: #c1c9d8;
  font-size: 14px;
  font-weight: 900;
}

.generate-button {
  min-height: 58px;
  margin-top: 14px;
  font-size: 17px;
}

.result-panel,
.progress-panel,
.works-section,
.history-section,
.admin-card {
  padding: 22px;
}

.poster-stage {
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(47, 128, 255, 0.06), transparent 40%),
    #090b0f;
}

#posterImage,
.blind-card img,
.work-card img,
.reference-card img,
.poster-art {
  border-radius: 3px;
}

.section-head {
  align-items: flex-start;
}

.section-head span,
.admin-hero span {
  color: var(--primary-dark);
  font-size: 13px;
}

.section-head button,
.result-actions button,
.back-user,
.mini-action,
.blind-card div button {
  border-radius: 3px;
  background: #172640;
  color: #d9e8ff;
}

.section-head button:hover,
.result-actions button:hover,
.back-user:hover,
.mini-action:hover,
.blind-card div button:hover {
  background: #203756;
}

.progress-core {
  min-height: 610px;
}

.progress-core strong {
  font-size: 26px;
  letter-spacing: 0;
}

.progress-track,
.progress-track.large {
  height: 8px;
  border-radius: 3px;
}

.progress-track span {
  background: var(--primary);
}

.generation-meta {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.work-grid {
  gap: 14px;
}

.work-filter {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #090b0f;
}

.work-filter button {
  min-height: 30px;
  border-radius: 3px;
}

.work-filter button.is-active {
  background: #172640;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #172640;
  color: #d9e8ff;
  font-weight: 900;
}

.pagination button:hover {
  background: #203756;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.favorite-toggle {
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 3px;
}

.download-corner {
  top: 6px;
  left: 6px;
}

.result-download {
  top: 12px;
  right: 12px;
  left: auto;
}

table {
  background: #090b0f;
}

th,
td {
  padding: 12px;
}

.settings-grid {
  gap: 12px;
}

.admin-hero {
  margin-bottom: 18px;
}

.admin-hero h1 {
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: 0;
}

.admin-hero p {
  max-width: 680px;
}

.mobile-tabbar {
  border-radius: 4px;
}

.mobile-tabbar a,
.mobile-tabbar button {
  border-radius: 3px;
}

@media (max-width: 1180px) {
  body {
    background: #050607;
    overflow-x: hidden;
  }

  .desktop-frame {
    display: grid;
    grid-template-columns: 1fr;
    width: 100vw;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    border: 0;
    border-radius: 0;
    background: #050607;
    box-shadow: none;
  }

  .window-dots,
  .sidebar {
    display: none;
  }

  main {
    width: 100%;
    min-width: 0;
    padding: 14px 14px 92px;
  }

  .topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 14px 14px 10px;
    background: #050607;
  }

  .mobile-brand {
    display: inline-flex;
  }

  .mobile-brand strong {
    font-size: 16px;
  }

  .top-actions {
    gap: 8px;
  }

  .user-layout,
  .creator-column,
  .view .user-layout {
    width: 100%;
    max-width: none;
  }

  .create-card {
    padding: 16px;
  }

  .input-toggle {
    width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .input-toggle::-webkit-scrollbar {
    display: none;
  }

  .input-toggle button {
    flex: 0 0 auto;
    min-width: 128px;
  }

  .input-toggle #blindModeButton {
    min-width: 128px;
  }

  .voice-stage {
    min-height: 260px;
  }

  .quick-settings {
    grid-template-columns: 1fr;
  }

  .ratio-picker {
    grid-template-columns: repeat(5, minmax(94px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .ratio-picker::-webkit-scrollbar {
    display: none;
  }

  .advanced-button {
    min-height: 112px;
  }

  .progress-panel,
  .result-panel,
  .works-section,
  .history-section,
  .admin-card {
    width: 100%;
    margin-top: 0;
    padding: 16px;
  }

  .progress-core {
    min-height: 420px;
  }

  .poster-stage {
    min-height: 420px;
  }

  .is-create-tab .upgrade-card,
  .is-create-tab .profile-card {
    transform: none;
  }

  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .blind-gallery.is-active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .work-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .work-card {
    flex: 0 0 136px;
  }

  .admin-hero,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .mobile-tabbar {
    position: fixed;
    top: calc(100svh - 78px);
    left: 12px;
    right: 12px;
    bottom: auto;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: auto;
    transform: none;
    padding: 8px;
  }

  .mobile-tabbar a,
  .mobile-tabbar button {
    min-height: 42px;
  }

  .mobile-tabbar button {
    width: 48px;
    height: 48px;
  }
}

/* interaction fixes */
.view .user-panel:not(.is-active) {
  display: none !important;
}

.voice-stage {
  display: block;
}

.mic-button,
.record-wave-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.record-wave-button {
  width: min(430px, calc(100% - 48px));
}

.voice-stage strong {
  position: absolute;
  left: 24px;
  right: 24px;
  top: calc(50% + 64px);
  text-align: center;
}

.voice-stage small {
  position: absolute;
  left: 50%;
  top: calc(50% + 78px);
  transform: translateX(-50%);
  display: none;
}

.voice-stage.is-recording small {
  display: block;
}

.voice-stage p {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  margin: 0;
  text-align: center;
}

.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  background: #101216;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-left-color: #ff5f57;
}

.toast.is-success {
  border-left-color: #38d180;
}

.error-modal {
  display: none;
}

.error-modal.is-visible {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
}

.error-dialog {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: #101216;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.modal-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(18, 24, 36, 0.96);
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 1180px) {
  .toast {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 1180px) {
  main {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-tabbar {
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    transform: none !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(7, 8, 11, 0.98);
  }

  .mobile-tabbar a {
    min-height: 46px;
  }
}

/* i18n and long-label resilience */
.language-switcher {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.language-button {
  display: inline-flex;
  min-width: 54px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px;
  background: rgba(17, 18, 22, 0.94);
  color: #d9e8ff;
  font-weight: 900;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: none;
  width: 156px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #101216;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.48);
}

.language-menu.is-open {
  display: grid;
  gap: 4px;
}

.language-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.language-menu button:hover,
.language-menu button.is-active {
  background: #172640;
  color: #f8fbff;
}

.side-nav a,
.input-toggle button,
.ratio-card,
.advanced-button,
.generate-button,
.restart-button,
.section-head,
.result-actions button,
.work-filter button,
.pagination,
.pagination span,
.settings-grid label span,
.admin-hero,
.record-item,
.work-card,
.work-card > div,
.blind-card,
.blind-card div,
th,
td {
  min-width: 0;
}

.side-nav a,
.input-toggle button,
.advanced-button strong,
.advanced-button small,
.generate-button span,
.restart-button,
.result-actions button,
.work-filter button,
.pagination span,
.settings-grid label span,
.record-item span,
.work-card span,
.blind-card button,
th,
td {
  overflow-wrap: anywhere;
  word-break: normal;
}

.ratio-card strong,
.ratio-card small,
.advanced-button strong,
.advanced-button small,
.mobile-tabbar a,
.language-button {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-head {
  min-width: 0;
}

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

.result-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.settings-grid input {
  min-width: 0;
}

@media (max-width: 1180px) {
  .topbar {
    gap: 10px;
  }

  .top-actions {
    min-width: 0;
    flex-shrink: 0;
  }

  .language-button {
    min-width: 44px;
    padding: 0 8px;
    font-size: 12px;
  }

  .language-menu {
    right: -40px;
    width: min(160px, calc(100vw - 24px));
  }

  .credit-pill {
    padding: 0 10px;
  }

  .bell-button,
  .small-avatar {
    width: 32px;
    min-width: 32px;
  }

  .input-toggle button {
    min-width: min(148px, 44vw);
  }

  .input-toggle #blindModeButton {
    min-width: min(148px, 44vw);
  }

  .result-actions {
    width: 100%;
  }

  .result-actions button {
    flex: 1 1 130px;
  }
}

/* Outfit workflow */
.outfit-create-card .input-toggle,
.outfit-create-card .voice-stage,
.outfit-create-card .quick-settings,
.outfit-create-card .quick-settings .advanced-button,
.outfit-create-card #referenceInput,
.outfit-create-card > #referenceList { display: none !important; }
.outfit-create-card { gap: 22px; }
.outfit-heading { max-width: 720px; }
.outfit-heading > span { color: #4358d8; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.outfit-heading h1 { margin: 8px 0 10px; color: #172033; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; }
.outfit-heading p { margin: 0; color: #667085; font-size: 15px; line-height: 1.7; }
.outfit-upload-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 16px; }
.outfit-upload-zone { min-width: 0; padding: 18px; border: 1px solid #dde2ec; border-radius: 16px; background: #fbfcfe; }
.upload-zone-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.upload-index { color: #4358d8; font-size: 13px; font-weight: 800; }
.upload-zone-head div { display: grid; gap: 2px; }
.upload-zone-head strong { color: #1f2937; font-size: 15px; }
.upload-zone-head small, .outfit-prompt-label small, .outfit-scope small { color: #7b8495; }
.upload-drop { display: grid; width: 100%; min-height: 142px; place-items: center; align-content: center; gap: 6px; border: 1px dashed #aeb8cb; border-radius: 14px; background: #fff; color: #283249; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.upload-drop:hover, .upload-drop:focus-visible, .upload-drop.has-files { border-color: #4358d8; background: #f4f6ff; }
.upload-drop:active { transform: translateY(1px); }
.upload-drop small { color: #7b8495; font-size: 12px; }
.upload-plus { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #e9edff; color: #3449c7; font-size: 24px; line-height: 1; }
#personInput, #garmentInput { display: none; }
.person-list, .garment-list { margin-top: 12px; }
.outfit-preview { position: relative; width: 86px; min-width: 86px; overflow: visible; }
.outfit-preview img { width: 86px; height: 100px; border-radius: 12px; object-fit: cover; }
.outfit-preview > span { display: block; max-width: 86px; margin-top: 6px; overflow: hidden; color: #5f6878; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.outfit-preview button { top: -7px; right: -7px; }
.outfit-prompt-label { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: -12px; }
.outfit-status { min-height: 22px; margin: -10px 0 0; color: #4358d8; font-size: 13px; line-height: 1.6; }
.outfit-scope { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid #dde2ec; border-radius: 16px; background: #fbfcfe; }
.outfit-scope > div:first-child { display: grid; gap: 3px; }
.outfit-scope strong { color: #1f2937; font-size: 14px; }
.scope-segment { display: grid; grid-template-columns: repeat(3, minmax(72px, 1fr)); min-width: 268px; padding: 4px; border: 1px solid #c8d1e4; border-radius: 14px; background: #eef2f8; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .72); }
.scope-segment button { position: relative; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: #566174; font-weight: 800; cursor: pointer; transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease; }
.scope-segment button:hover, .scope-segment button:focus-visible { color: #263454; }
.scope-segment button.is-active { background: linear-gradient(135deg, #2f6cff, #4358d8); color: #fff; box-shadow: 0 10px 24px rgb(47 108 255 / .32), inset 0 0 0 1px rgb(255 255 255 / .28); }
.scope-segment button.is-active::before { content: "✓"; display: inline-grid; width: 16px; height: 16px; margin-right: 6px; place-items: center; border-radius: 999px; background: rgb(255 255 255 / .2); color: #fff; font-size: 11px; line-height: 1; vertical-align: 1px; }
.scope-segment button:active { transform: translateY(1px); }
.outfit-create-card .prompt-panel { display: block; opacity: 1; pointer-events: auto; transform: none; }
@media (max-width: 760px) {
  .outfit-upload-grid { grid-template-columns: 1fr; }
  .outfit-prompt-label { align-items: flex-start; flex-direction: column; gap: 3px; }
  .outfit-scope { align-items: stretch; flex-direction: column; }
  .scope-segment { width: 100%; min-width: 0; }
}

/* Outfit home rewrite */
:root {
  --bg: #050914;
  --panel: rgba(9, 16, 31, 0.82);
  --panel-strong: #0d1629;
  --ink: #f4f7ff;
  --muted: #8f9bb7;
  --line: rgba(130, 154, 205, 0.2);
  --primary: #2f6cff;
  --primary-dark: #2553d7;
  --primary-soft: rgba(47, 108, 255, 0.14);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
}

body {
  min-height: 100dvh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, rgba(47, 108, 255, 0.22), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(66, 91, 255, 0.16), transparent 32%),
    #050914;
  background-size: 64px 64px, 64px 64px, auto, auto, auto;
  color: var(--ink);
}

.desktop-frame {
  width: 100vw;
  min-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  grid-template-columns: 190px minmax(0, 1fr);
}

.window-dots {
  display: none;
}

.sidebar {
  gap: 22px;
  padding: 28px 14px 38px;
  border-right: 1px solid rgba(93, 115, 161, 0.22);
  background:
    radial-gradient(circle at 18% 6%, rgba(47, 108, 255, 0.22), transparent 24%),
    rgba(4, 9, 20, 0.8);
}

.brand {
  padding: 0 16px 10px;
}

.brand-symbol {
  color: #40a2ff;
}

.brand-symbol svg {
  filter: drop-shadow(0 0 15px rgba(47, 108, 255, 0.78));
}

.brand strong,
.mobile-brand strong {
  color: #f4f7ff;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.side-nav {
  gap: 8px;
}

.side-nav a {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #9aa7c3;
  font-size: 14px;
}

.side-nav a.is-active,
.side-nav a:hover {
  border-color: rgba(83, 137, 255, 0.6);
  background: linear-gradient(135deg, #1e5dff, #183d99);
  color: #fff;
  box-shadow: 0 18px 38px rgba(31, 93, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.upgrade-card,
.profile-card {
  border-color: rgba(130, 154, 205, 0.18);
  border-radius: 6px;
  background: rgba(12, 18, 31, 0.86);
  box-shadow: none;
}

.upgrade-card button {
  border-radius: 5px;
  background: linear-gradient(135deg, #3f7cff, #1f5bff);
}

.profile-card {
  color: #f4f7ff;
}

.profile-card small {
  background: rgba(47, 108, 255, 0.25);
  color: #bcd0ff;
}

.topbar {
  top: 14px;
  right: 14px;
  left: 190px;
  z-index: 5;
  justify-content: flex-end;
  pointer-events: none;
}

.top-actions {
  pointer-events: auto;
}

.credit-pill,
.language-button,
.bell-button,
.small-avatar {
  border: 1px solid rgba(130, 154, 205, 0.22);
  border-radius: 6px;
  background: rgba(13, 22, 41, 0.82);
  color: #dce7ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.small-avatar {
  color: #fff;
  background: linear-gradient(135deg, #1f5bff, #14234a);
}

main {
  padding: 64px 14px 38px 22px;
}

.view .user-panel.is-active {
  display: block;
}

.user-layout {
  max-width: none;
}

.creator-column {
  width: 100%;
}

.create-card.outfit-home {
  display: grid;
  gap: 14px;
  min-height: 610px;
  padding: 28px 18px 18px;
  border: 1px solid rgba(130, 154, 205, 0.22);
  border-radius: 7px;
  background:
    radial-gradient(circle at 18% 0%, rgba(47, 108, 255, 0.13), transparent 28%),
    linear-gradient(180deg, rgba(12, 20, 36, 0.88), rgba(5, 10, 21, 0.86));
  box-shadow: none;
  backdrop-filter: blur(22px);
}

.outfit-home-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.14fr) minmax(360px, 0.86fr);
  gap: 24px;
  align-items: stretch;
}

.outfit-home-left {
  display: grid;
  align-content: start;
  gap: 28px;
  padding: 0 0 0 8px;
}

.outfit-heading {
  max-width: 620px;
}

.outfit-heading > span {
  color: #4d78ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
}

.outfit-heading h1 {
  margin: 10px 0 12px;
  color: #edf3ff;
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.06em;
  text-shadow: 0 0 28px rgba(47, 108, 255, 0.22);
}

.outfit-heading p {
  max-width: 620px;
  color: #8e9ab5;
  font-size: 14px;
  line-height: 1.7;
}

.generation-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(130, 154, 205, 0.2);
  border-radius: 12px;
  background: rgba(3, 8, 18, 0.5);
}

.generation-mode-tabs button {
  display: grid;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #a5b1ca;
  text-align: left;
  cursor: pointer;
}

.generation-mode-tabs button strong {
  color: #d9e3f8;
  font-size: 14px;
}

.generation-mode-tabs button small {
  overflow: hidden;
  color: #7f8ba4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-mode-tabs button:hover,
.generation-mode-tabs button:focus-visible {
  border-color: rgba(77, 120, 255, 0.46);
  outline: none;
}

.generation-mode-tabs button.is-active {
  border-color: rgba(77, 120, 255, 0.82);
  background: rgba(47, 108, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(106, 148, 255, 0.1);
}

.generation-mode-tabs button.is-active strong {
  color: #ffffff;
}

.outfit-upload-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.outfit-home[data-active-generation-mode="couple"] .outfit-upload-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.outfit-upload-zone[hidden],
.outfit-form-card[hidden] {
  display: none;
}

.outfit-upload-zone {
  min-height: 376px;
  padding: 20px 12px 16px;
  border: 1px solid rgba(47, 108, 255, 0.62);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 20%, rgba(47, 108, 255, 0.16), transparent 42%),
    rgba(9, 17, 32, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 60px rgba(11, 31, 72, 0.18);
}

.upload-zone-head {
  margin: 0 10px 20px;
  gap: 10px;
}

.upload-index {
  color: #3f78ff;
  font-size: 18px;
}

.upload-zone-head strong {
  color: #edf3ff;
  font-size: 16px;
}

.upload-zone-head small,
.outfit-prompt-label small,
.outfit-scope small {
  color: #8c98b2;
  font-size: 12px;
}

.upload-drop {
  min-height: 276px;
  border-color: rgba(130, 154, 205, 0.28);
  border-radius: 18px;
  background: rgba(3, 8, 18, 0.34);
  color: #eef4ff;
}

.upload-drop:hover,
.upload-drop:focus-visible,
.upload-drop.has-files {
  border-color: rgba(77, 120, 255, 0.86);
  background: rgba(18, 35, 68, 0.58);
}

.upload-drop small {
  color: #8e9ab5;
}

.upload-plus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(91, 117, 173, 0.22);
  color: #5b83ff;
  font-size: 30px;
}

.outfit-home-right {
  display: grid;
  align-content: start;
  border: 1px solid rgba(130, 154, 205, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(8, 14, 27, 0.56);
}

.outfit-form-card {
  padding: 20px;
  border: 0;
  border-bottom: 1px solid rgba(130, 154, 205, 0.16);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.outfit-form-card:last-child {
  border-bottom: 0;
}

.couple-scope-card {
  display: grid;
  gap: 14px;
}

.couple-scope-card > div:first-child {
  display: grid;
  gap: 6px;
}

.couple-scope-card strong {
  color: #edf3ff;
  font-size: 15px;
}

.couple-scope-card small {
  color: #8c98b2;
  font-size: 12px;
}

.couple-scope-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.couple-scope-row > span {
  color: #b9c6df;
  font-size: 12px;
  font-weight: 800;
}

.outfit-prompt-label {
  margin: 0 0 12px;
}

.outfit-prompt-label strong,
.outfit-scope strong {
  color: #edf3ff;
  font-size: 15px;
}

.outfit-create-card .prompt-panel {
  position: relative;
  display: block;
  min-height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.outfit-create-card .prompt-panel textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid rgba(130, 154, 205, 0.22);
  border-radius: 8px;
  padding: 14px;
  background:
    radial-gradient(circle at 30% 0%, rgba(47, 108, 255, 0.08), transparent 42%),
    rgba(4, 9, 19, 0.58);
  color: #eef4ff;
  outline: none;
}

.outfit-create-card .prompt-panel textarea::placeholder {
  color: #7e89a2;
}

.outfit-create-card .prompt-panel textarea:focus {
  border-color: rgba(71, 118, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(47, 108, 255, 0.16);
}

.prompt-count {
  display: block;
  margin-top: -26px;
  padding-right: 12px;
  color: #8b96b0;
  font-size: 12px;
  text-align: right;
  pointer-events: none;
}

.outfit-scope,
.outfit-resolution {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-color: rgba(130, 154, 205, 0.16);
}

.outfit-scope > div:first-child,
.outfit-resolution > div:first-child {
  display: grid;
  gap: 8px;
}

.outfit-resolution strong {
  color: #edf3ff;
  font-size: 15px;
}

.outfit-resolution small {
  color: #8c98b2;
  font-size: 12px;
}

.outfit-pose-json {
  display: grid;
  gap: 14px;
}

.outfit-pose-json > div:first-child {
  display: grid;
  gap: 8px;
}

.outfit-pose-json strong {
  color: #edf3ff;
  font-size: 15px;
}

.outfit-pose-json small {
  color: #8c98b2;
  font-size: 12px;
}

.pose-json-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px dashed rgba(130, 154, 205, 0.3);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(4, 9, 19, 0.42);
  color: #eef4ff;
  font-weight: 900;
}

.pose-json-button.has-file {
  border-style: solid;
  border-color: rgba(47, 108, 255, 0.7);
  background: rgba(47, 108, 255, 0.12);
}

.pose-json-button small {
  max-width: 230px;
  overflow: hidden;
  color: #9fb2e4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#poseJsonInput {
  display: none;
}

.pose-json-file {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(70, 132, 255, 0.48);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(40, 95, 210, 0.18), rgba(10, 19, 38, 0.62));
}

.pose-json-file[hidden] {
  display: none;
}

.pose-json-file-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 10px;
  background: rgba(47, 108, 255, 0.2);
  color: #78a5ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.pose-json-file-info {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.pose-json-file-info strong,
.pose-json-file-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pose-json-file-info strong {
  color: #f1f5ff;
  font-size: 13px;
}

.pose-json-file-info small {
  color: #91a5ce;
  font-size: 11px;
}

.pose-json-remove {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 100, 116, 0.42);
  border-radius: 8px;
  background: rgba(126, 29, 44, 0.2);
  color: #ff9eaa;
  cursor: pointer;
  font-weight: 800;
}

.pose-json-remove:hover {
  border-color: rgba(255, 100, 116, 0.8);
  background: rgba(163, 35, 54, 0.32);
}

.scope-segment,
.resolution-segment {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(3, 1fr);
  padding: 0;
  border: 1px solid rgba(130, 154, 205, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(13, 20, 34, 0.8);
  box-shadow: none;
}

.scope-segment button,
.resolution-segment button {
  position: relative;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #b6c0d7;
  font-weight: 800;
  border-right: 1px solid rgba(130, 154, 205, 0.14);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.scope-segment button:last-child,
.resolution-segment button:last-child {
  border-right: 0;
}

.scope-segment button.is-active,
.resolution-segment button.is-active {
  background: linear-gradient(135deg, rgba(47, 108, 255, 0.98), rgba(24, 67, 177, 0.92));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(125, 161, 255, 0.52), 0 10px 24px rgba(47, 108, 255, 0.26);
}

.scope-segment button.is-active::before,
.resolution-segment button.is-active::before {
  content: "✓";
  display: inline-grid;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  vertical-align: 1px;
}

.outfit-helper-card {
  min-height: 155px;
}

.outfit-helper-card p {
  margin: 0;
  color: #8e9ab5;
  font-size: 13px;
  line-height: 1.7;
}

.outfit-status {
  min-height: 20px;
  margin: 0 6px;
  color: #7ea0ff;
}

.outfit-home .generate-button {
  width: 100%;
  min-height: 56px;
  border-radius: 7px;
  background: linear-gradient(135deg, #4b80ff, #1d5cff);
  color: #fff;
  font-size: 16px;
  letter-spacing: -0.01em;
  box-shadow: 0 20px 42px rgba(31, 92, 255, 0.28);
}

.outfit-home .generate-button small {
  color: rgba(231, 238, 255, 0.76);
}

.person-list,
.garment-list {
  max-height: 94px;
  overflow: auto;
}

.outfit-preview img {
  border: 1px solid rgba(130, 154, 205, 0.24);
}

@media (max-width: 1180px) {
  .desktop-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    left: 0;
  }

  main {
    padding: 76px 14px 28px;
  }

  .mobile-brand {
    display: inline-flex;
  }

  .outfit-home-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .create-card.outfit-home {
    padding: 22px 14px 14px;
  }

  .outfit-home-left {
    padding: 0;
  }

  .outfit-upload-grid {
    grid-template-columns: 1fr;
  }

  .generation-mode-tabs,
  .outfit-home[data-active-generation-mode="couple"] .outfit-upload-grid {
    grid-template-columns: 1fr;
  }

  .generation-mode-tabs button small {
    white-space: normal;
  }
}

/* Global layout lock: keep the app inside the viewport and make the right side scroll independently. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.desktop-frame,
main,
.view,
.user-panel,
.user-layout,
.creator-column,
.works-section,
.history-section,
.admin-card,
.admin-grid,
.settings-grid,
.outfit-home-grid,
.outfit-home-left,
.outfit-home-right {
  min-width: 0;
  max-width: 100%;
}

.table-wrap,
.record-list,
.work-grid,
.credit-list {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 1181px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .desktop-frame {
    width: 100%;
    max-width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    grid-template-columns: 174px minmax(0, 1fr);
    overflow: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .upgrade-card {
    margin-top: auto;
  }

  .topbar {
    left: 174px;
    right: 26px;
  }

  main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 64px 28px 38px 22px;
    scrollbar-gutter: stable;
  }

  .view.is-active,
  .view .user-panel.is-active {
    width: 100%;
  }

  .admin-hero,
  .works-section,
  .history-section,
  .admin-card,
  .create-card.outfit-home {
    width: 100%;
  }

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

  .settings-grid label,
  .settings-grid input,
  .settings-grid select,
  .settings-grid textarea {
    min-width: 0;
    max-width: 100%;
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
    gap: 20px;
  }

  .admin-grid > .admin-card {
    min-width: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .table-wrap table {
    width: 100%;
  }

  .record-item,
  .work-card,
  .credit-row {
    max-width: 100%;
  }
}

.record-item {
  display: grid;
  gap: 8px;
}

.record-item strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.record-item span {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 1px;
}

.record-tags em {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(88, 126, 255, 0.28);
  border-radius: 999px;
  background: rgba(47, 108, 255, 0.1);
  color: #aec6ff;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}

.record-error {
  color: #ff9b95 !important;
}
