:root {
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-light: #eef2ff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --coin: #f59e0b;
  --success: #10b981;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1280px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand,
.top-actions,
.user-menu,
.credits-pill,
.panel-title,
.step-heading,
.generate-bar,
.device-switch {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow);
}

.brand h1,
.brand p,
.panel-title h2,
.panel-title span,
.step-heading h2,
.step-heading p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  gap: 18px;
}

.credits-pill,
.user-menu {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  gap: 8px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.04);
}

.coin,
.credits-pill strong,
.balance strong {
  color: var(--coin);
}

.link-text {
  color: var(--primary);
  font-size: 12px;
  margin-left: 8px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, #fff 0 18%, #5877ff 19% 42%, #dbe4ff 43% 100%);
  border: 1px solid #c7d2fe;
}

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

.workspace {
  display: grid;
  grid-template-columns: 32% minmax(520px, 41%) 25%;
  gap: 24px;
  padding: 16px;
}

.left-panel,
.preview-panel,
.history-panel {
  min-width: 0;
}

.step-card,
.info-card,
.preview-panel,
.history-panel,
.generate-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.step-card {
  padding: 16px;
  margin-bottom: 14px;
}

.step-card.compact {
  padding-bottom: 18px;
}

.step-heading {
  gap: 12px;
  margin-bottom: 14px;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
}

.step-heading h2 {
  font-size: 15px;
}

.step-heading p,
.hint,
.advice,
.panel-title span,
.info-card dd,
.info-card li,
.disclaimer {
  color: var(--muted);
  font-size: 12px;
}

.dropzone {
  min-height: 104px;
  border: 1.5px dashed #c7cbd6;
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: #fff;
  transition: 0.2s ease;
}

.dropzone.dragover,
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone input {
  display: none;
}

.dropzone .plus {
  color: var(--primary);
  font-size: 40px;
  line-height: 1;
}

.dropzone strong {
  font-size: 13px;
  margin-top: 4px;
}

.dropzone small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.upload-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--primary-light);
  margin-top: 10px;
  overflow: hidden;
}

.upload-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  animation: upload 0.9s ease forwards;
}

@keyframes upload {
  to {
    width: 100%;
  }
}

.thumb-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.thumb {
  width: 66px;
  height: 66px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}

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

.thumb button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: #6b7280;
  color: #fff;
}

.add-thumb {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 30px;
  border-style: dashed;
}

.hint {
  margin: 8px 0 0;
}

.advice {
  margin: -4px 0 12px;
  color: #5b60b9;
}

.textarea-wrap {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  color: var(--text);
  outline: none;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

#counter {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.secondary-btn,
.outline-btn,
.load-more {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  color: var(--text);
}

.outline-btn {
  color: var(--primary);
  border-color: #c7d2fe;
}

.info-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 12px;
}

.info-card {
  padding: 14px;
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.info-card h3 span {
  color: var(--primary);
}

.info-card dl {
  margin: 0;
}

.info-card div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.info-card dt {
  font-size: 12px;
  font-weight: 700;
}

.info-card dd {
  margin: 0;
}

.info-card ul {
  margin: 0;
  padding-left: 18px;
}

.info-card li {
  margin-bottom: 10px;
}

.warning {
  color: #5b60b9;
  font-size: 12px;
  margin: 10px 0 0;
}

.generate-bar {
  margin-top: 14px;
  padding: 14px 18px;
  justify-content: space-between;
  gap: 12px;
}

.generate-bar > div {
  min-width: 92px;
  font-size: 12px;
  color: var(--muted);
}

.generate-bar > div strong {
  display: block;
  color: var(--primary);
  margin-top: 4px;
  font-size: 14px;
}

.primary-btn {
  min-width: 204px;
  height: 60px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.25);
}

.primary-btn small {
  font-weight: 600;
  opacity: 0.9;
}

.primary-btn[disabled] {
  opacity: 0.6;
}

.preview-panel,
.history-panel {
  padding: 16px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  display: inline;
  font-size: 18px;
  margin-right: 8px;
}

.device-switch {
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.device-switch button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--text);
}

.device-switch button.active {
  color: var(--primary);
  border-color: #c7d2fe;
  background: var(--primary-light);
}

.preview-stage {
  position: relative;
  min-height: 760px;
  border-radius: 10px;
  background: #fff;
  overflow: auto;
  border: 1px solid #f0f1f4;
  padding: 0 0 12px;
}

.preview-stage.mobile .detail-page {
  width: 370px;
  margin: 0 auto;
}

.detail-page {
  background: #f5eee5;
  transition: width 0.25s ease;
}

.generated-page-view {
  width: 100%;
  min-height: 720px;
  background: #f5eee5;
  display: grid;
  place-items: start center;
}

.generated-page-view[hidden] {
  display: none;
}

.generated-page-view img {
  width: 100%;
  height: auto;
  display: block;
  background: #f5eee5;
}

.preview-stage.mobile .generated-page-view {
  width: 370px;
  margin: 0 auto;
}

.hero-block,
.spec-block,
.bottom-features {
  margin: 0 0 6px;
  background: linear-gradient(135deg, #fbf6ef, #eadfcc);
}

.hero-block {
  min-height: 292px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 44%;
  align-items: center;
  gap: 20px;
}

.brand-label {
  display: inline-block;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(31, 41, 55, 0.18);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 13px;
  font-weight: 700;
}

.hero-copy h3 {
  margin: 18px 0 12px;
  font-size: 32px;
  line-height: 1.25;
}

.hero-copy p,
.spec-block p {
  margin: 0;
  color: #3f3f46;
  font-size: 14px;
  line-height: 1.7;
}

.hero-block img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  mix-blend-mode: multiply;
}

.feature-icons {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 10px;
  margin-top: 24px;
  max-width: 390px;
}

.feature-icons span {
  display: grid;
  place-items: center;
  gap: 4px;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(31, 41, 55, 0.3);
  border-radius: 50%;
  font-size: 18px;
}

.feature-icons small {
  font-size: 10px;
  white-space: nowrap;
}

.spec-block {
  padding: 26px 30px;
  min-height: 128px;
}

.spec-block h3 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.25;
}

.split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  align-items: center;
  gap: 24px;
}

.parts-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.parts-visual span {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 10px solid #1f2937;
  background: radial-gradient(circle, #f9fafb, #c8b9a5);
  box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.16);
}

.parts-visual span:nth-child(even) {
  width: 48px;
  height: 48px;
  border-width: 7px;
}

.image-right {
  display: grid;
  grid-template-columns: 1fr 260px;
  align-items: center;
  gap: 20px;
}

.image-right img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  mix-blend-mode: multiply;
}

.endurance {
  display: grid;
  grid-template-columns: 1fr 180px;
  align-items: center;
  background: linear-gradient(90deg, #fbf6ef 0 58%, #e9ddc8 58% 100%);
}

.endurance strong {
  font-size: 86px;
  color: #a48654;
  line-height: 1;
}

.endurance span {
  font-size: 36px;
}

.bottom-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 16px 22px;
  gap: 10px;
}

.bottom-features div {
  display: grid;
  grid-template-columns: 38px 1fr;
  column-gap: 8px;
  align-items: center;
  min-width: 0;
}

.bottom-features b {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(31, 41, 55, 0.28);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.bottom-features span {
  font-size: 13px;
  font-weight: 800;
}

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

.disclaimer {
  margin: 8px 10px 0;
}

.skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 20px;
  background: rgba(255, 255, 255, 0.86);
}

.skeleton span {
  display: block;
  height: 130px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2ff, #fff, #eef2ff);
  background-size: 220% 100%;
  animation: shine 1s linear infinite;
}

@keyframes shine {
  to {
    background-position: -220% 0;
  }
}

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

.history-card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.history-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.history-card img {
  width: 118px;
  height: 136px;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f4f6;
}

.history-info {
  min-width: 0;
}

.history-info h3 {
  margin: 4px 0 10px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-info p {
  margin: 6px 0;
  font-size: 12px;
  color: var(--muted);
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.history-actions button {
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
}

.more-btn {
  margin-left: auto;
  width: 34px;
  padding: 0;
}

.load-more {
  width: 100%;
  margin-top: 16px;
  height: 46px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 50;
}

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

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.42);
  display: grid;
  place-items: center;
  z-index: 60;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  padding: 24px;
  position: relative;
}

.modal-card h2 {
  margin: 0 0 10px;
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  color: var(--muted);
}

.modal-card ul {
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.modal-card li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 1380px) {
  .workspace {
    grid-template-columns: 33% 40% 25%;
    gap: 14px;
  }

  .hero-copy h3 {
    font-size: 28px;
  }

  .bottom-features {
    grid-template-columns: repeat(2, 1fr);
  }
}
