/* Static stylesheet keeps the model pages styled during SSR and hydration. */
:root {
  --model-ink: rgba(0, 0, 0, 0.9);
  --model-body: rgba(0, 0, 0, 0.58);
  --model-line: #eaeaea;
  --model-muted-surface: #f8f8f8;
  --model-accent: #7b4dff;
}

.ai-model-studio {
  min-height: 100vh;
  background: #fff;
  color: var(--model-ink);
  font-family: Inter, system-ui, sans-serif;
}

.ai-model-studio__tool {
  margin-top: calc(-1 * var(--tools-header-h));
  padding: calc(var(--tools-header-h) + 68px) 24px 72px;
  background: var(--model-muted-surface);
}

.ai-model-studio__intro,
.ai-model-studio__workbench,
.ai-model-studio__crumb,
.ai-model-studio__content-inner {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  box-sizing: border-box;
}

.ai-model-studio__crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.4;
}

.ai-model-studio__crumb-link {
  color: rgba(0, 0, 0, 0.55);
  text-decoration: none;
}

.ai-model-studio__crumb-link:hover {
  color: var(--model-accent);
}

.ai-model-studio__crumb-sep {
  color: rgba(0, 0, 0, 0.3);
}

.ai-model-studio__intro {
  max-width: 900px;
  margin-bottom: 40px;
  text-align: center;
}

.ai-model-studio h1,
.ai-model-studio h2,
.ai-model-studio h3 {
  margin: 0;
  color: var(--model-ink);
}

.ai-model-studio h1 {
  font-size: 48px;
  font-weight: 600;
  line-height: 56px;
  letter-spacing: -1.44px;
}

.ai-model-studio__lead {
  margin: 16px auto 0;
  color: var(--model-body);
  font-size: 18px;
  line-height: 1.75;
}

.ai-model-studio__workbench {
  display: grid;
  max-width: 760px;
  grid-template-columns: minmax(0, 1fr);
  transition: max-width 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

.ai-model-studio__workbench--has-output {
  gap: 16px;
}

.ai-model-studio__panel {
  min-width: 0;
  border: 1px solid var(--model-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.ai-model-studio__composer {
  display: flex;
  min-height: 372px;
  flex-direction: column;
  padding: 24px;
}

.ai-model-studio__prompt {
  display: block;
  width: 100%;
  min-height: 208px;
  height: 260px;
  max-height: 560px;
  flex: 0 0 auto;
  resize: vertical;
  padding: 18px;
  border: 1px solid #e1e1e1;
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--model-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  box-sizing: border-box;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.ai-model-studio__prompt::placeholder {
  color: rgba(0, 0, 0, 0.38);
}
.ai-model-studio__prompt:focus {
  border-color: var(--model-accent);
  box-shadow: 0 0 0 3px rgba(123, 77, 255, 0.12);
}
.ai-model-studio__prompt:disabled {
  background: #f6f6f6;
  color: var(--model-body);
  cursor: not-allowed;
}

.ai-model-studio__prompt-count {
  margin: 0;
  color: var(--model-body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  order: 1;
  text-align: right;
}

.ai-model-studio__feedback {
  margin: 14px 0 0;
  color: #b3263d;
  font-size: 14px;
  line-height: 1.5;
}

.ai-model-studio__credit-cta {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--model-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background 150ms ease, transform 150ms ease;
}

.ai-model-studio__credit-cta:hover {
  background: #6540d9;
}

.ai-model-studio__credit-cta:active {
  transform: scale(0.98);
}

.ai-model-studio__action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.ai-model-studio__submit {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: var(--model-accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.ai-model-studio__submit:hover:not(:disabled) {
  background: #6540d9;
}
.ai-model-studio__submit:active:not(:disabled) {
  transform: scale(0.98);
}
.ai-model-studio__submit:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ai-model-studio__submit--loading:disabled {
  background: var(--model-accent);
  color: #fff;
  cursor: wait;
  opacity: 0.72;
}

.ai-model-studio__price {
  margin: 0;
  color: var(--model-body);
  font-size: 13px;
  line-height: 1.45;
  order: 0;
  text-align: right;
}

.ai-model-studio__action-meta {
  display: flex;
  flex: 1;
  order: -1;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

/* 结果卡片在输入框下方，视觉与输入框卡片一致 */
.ai-model-studio__output {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  text-align: left;
  animation: ai-model-output-in 220ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes ai-model-output-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-model-studio__output {
    animation: none;
  }
}

.ai-model-studio__panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.ai-model-studio__panel-actions--result {
  flex: none;
  justify-content: space-between;
  margin-top: 16px;
}

.ai-model-studio__download {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--model-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.ai-model-studio__download:hover {
  background: #6540d9;
}

.ai-model-studio__download:active {
  transform: scale(0.98);
}

.ai-model-studio__download:focus-visible {
  outline: 3px solid rgba(123, 77, 255, 0.22);
  outline-offset: 2px;
}

.ai-model-studio__stage {
  position: relative;
  display: grid;
  height: 400px;
  min-height: 0;
  flex: 0 0 400px;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 50%, rgba(123, 77, 255, 0.11), transparent 48%), #f7f6fb;
}

.ai-model-studio__clear {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.ai-model-studio__clear:hover {
  background: rgba(0, 0, 0, 0.75);
}

.ai-model-studio__clear:focus-visible {
  outline: 2px solid #7b4dff;
  outline-offset: 2px;
}

.ai-model-studio__generation {
  display: flex;
  width: min(100%, 360px);
  align-items: center;
  flex-direction: column;
  padding: 18px 0;
  text-align: center;
}

.ai-model-studio__generation-visual {
  position: relative;
  width: 100%;
  height: 156px;
  margin-bottom: 19px;
  overflow: hidden;
  border-radius: 14px;
  background: #171124;
  box-shadow: 0 12px 30px rgba(33, 18, 72, 0.18);
}

.ai-model-studio__generation-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.58;
  filter: saturate(0.78) contrast(0.94);
  transform: scale(1.04);
}

.ai-model-studio__generation-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(28, 14, 68, 0.75), rgba(65, 35, 144, 0.42));
  content: '';
}

.ai-model-studio__generation-scan {
  position: absolute;
  z-index: 1;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  box-shadow: 0 0 14px 3px rgba(190, 167, 255, 0.9);
  animation: ai-model-scan 2.5s ease-in-out infinite;
}

.ai-model-studio__generation-orbit {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: conic-gradient(
    from 45deg,
    #fff,
    #cdbdff 28%,
    #8050ff 52%,
    transparent 64%,
    transparent
  );
  box-shadow: 0 0 34px rgba(191, 166, 255, 0.62);
  animation: ai-model-orbit 1.2s linear infinite;
}

.ai-model-studio__generation-orbit::after {
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  background: rgba(47, 26, 102, 0.84);
  content: '';
}

.ai-model-studio__generation-label {
  position: absolute;
  z-index: 2;
  top: calc(50% + 40px);
  left: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ai-model-studio__progress-meta {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  color: var(--model-body);
  font-size: 14px;
  line-height: 1.4;
}

.ai-model-studio__progress-meta strong {
  color: var(--model-ink);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ai-model-studio__progress-track {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f0f0;
}

.ai-model-studio__progress-track span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7b4dff, #a78bfa);
  transition: width 0.2s ease;
}

.ai-model-studio__progress-track--reported span {
  animation: none;
}

.ai-model-studio__persistence-notice {
  width: 100%;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f3ff;
  color: #6144bd;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  box-sizing: border-box;
}

.ai-model-studio__persistence-notice--download {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  color: var(--model-body);
  font-size: 13px;
  font-weight: 400;
}

/* 生成中：去掉内层浅紫舞台，预览铺满结果卡片，进度与提示紧随其下 */
.ai-model-studio__stage:has(> .ai-model-studio__generation) {
  display: block;
  height: auto;
  flex-basis: auto;
  border-radius: 0;
  background: none;
}

.ai-model-studio__stage > .ai-model-studio__generation {
  width: 100%;
  padding: 0;
}

.ai-model-studio__stage > .ai-model-studio__generation .ai-model-studio__generation-visual {
  height: 300px;
  margin-bottom: 16px;
}

.ai-model-studio__generation .ai-model-studio__persistence-notice {
  margin-top: 12px;
  padding: 0;
  background: none;
  color: var(--model-body);
  font-weight: 400;
  text-align: center;
}

@keyframes ai-model-orbit {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes ai-model-scan {
  0%,
  100% {
    top: 10%;
    opacity: 0.25;
  }

  50% {
    top: 86%;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-model-studio__generation-orbit,
  .ai-model-studio__generation-scan {
    animation: none;
  }
}

.ai-model-studio__result {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #0e0e0e;
  object-fit: contain;
}
.ai-model-studio--image .ai-model-studio__result {
  background: #f7f6fb;
  object-fit: contain;
}

@media (max-width: 900px) {
  .ai-model-studio__tool {
    padding-top: calc(var(--tools-header-h) + 52px);
  }
  .ai-model-studio__workbench {
    grid-template-columns: 1fr;
  }
  .ai-model-studio__workbench--has-output {
    max-width: 760px;
  }
}

@media (max-width: 640px) {
  .ai-model-studio__tool {
    padding: calc(var(--tools-header-h) + 40px) 16px 48px;
  }
  .ai-model-studio__intro {
    margin-bottom: 28px;
  }
  .ai-model-studio h1 {
    font-size: 34px;
    line-height: 40px;
    letter-spacing: -0.68px;
  }
  .ai-model-studio__lead {
    font-size: 16px;
    line-height: 1.6;
  }
  .ai-model-studio__composer,
  .ai-model-studio__output {
    min-height: 320px;
    padding: 16px;
  }
  .ai-model-studio__prompt {
    min-height: 190px;
    height: 226px;
    max-height: 440px;
    padding: 15px;
  }
  .ai-model-studio__stage > .ai-model-studio__generation .ai-model-studio__generation-visual {
    height: 200px;
  }
  .ai-model-studio__stage {
    height: 200px;
    flex-basis: 200px;
  }
  .ai-model-studio__action-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .ai-model-studio__submit {
    width: 100%;
  }
  .ai-model-studio__price {
    text-align: left;
  }
  .ai-model-studio__action-meta {
    justify-content: space-between;
  }
}
