: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-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;
}

@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;
  }
}
