:root {
  --bg: #f5f5f7;
  --paper: rgba(255, 255, 255, .76);
  --solid: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .1);
  --blue: #0071e3;
  --green: #16805f;
  --orange: #b86d20;
  --danger: #c43b32;
  --shadow: 0 28px 80px rgba(0, 0, 0, .13);
  --soft-shadow: 0 16px 46px rgba(0, 0, 0, .09);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -18%, rgba(0, 113, 227, .16), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(22, 128, 95, .11), transparent 28%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 54%, #eeeeef 100%);
  font-family: var(--sans);
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button,
a.button,
.file-button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(1080px, calc(100vw - 28px));
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .08);
  backdrop-filter: blur(24px) saturate(1.6);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 850;
  white-space: nowrap;
}

.brand-mark {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #111, #4b5560);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 950;
}

.step-track {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 29, 31, .24);
  transition: width .5s var(--ease), background .5s var(--ease);
}

.step-dot.active {
  width: 30px;
  background: var(--ink);
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button,
.primary-btn,
.secondary-btn,
.nav-btn,
.file-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  white-space: nowrap;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .35s var(--ease), opacity .25s ease;
}

.primary-btn,
.file-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 14px 30px rgba(0, 113, 227, .22);
}

.secondary-btn,
.nav-btn {
  color: var(--blue);
  background: rgba(255, 255, 255, .88);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, .18);
}

.nav-btn {
  min-width: 38px;
  padding: 0;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.button:hover,
.primary-btn:hover,
.secondary-btn:hover,
.nav-btn:hover,
.file-button:hover {
  transform: translateY(-1px);
}

.button:active,
.primary-btn:active,
.secondary-btn:active,
.nav-btn:active,
.file-button:active {
  transform: scale(.985);
}

.button[disabled],
.primary-btn[disabled],
.secondary-btn[disabled],
.nav-btn[disabled] {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}

.app {
  min-height: 100vh;
  padding: 94px 22px 28px;
  display: grid;
  place-items: center;
}

.device {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 122px));
  display: grid;
  align-items: stretch;
}

.canvas {
  position: relative;
  min-height: inherit;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .42)),
    rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.25);
  overflow: hidden;
}

.canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, .94), transparent 32%),
    radial-gradient(circle at 82% 78%, rgba(0, 113, 227, .09), transparent 30%);
  opacity: .92;
}

.page {
  position: relative;
  z-index: 1;
  min-height: inherit;
  padding: clamp(28px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(280px, .92fr) minmax(360px, 1.08fr);
  gap: clamp(26px, 4vw, 70px);
  align-items: center;
  animation: pageIn .7s var(--ease) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.copy {
  display: grid;
  gap: 20px;
  align-content: center;
}

.eyebrow {
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.03;
}

h1 {
  max-width: 720px;
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 900;
}

h2 {
  max-width: 620px;
  font-size: clamp(42px, 5.8vw, 78px);
  font-weight: 900;
}

.lead {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.48;
  font-weight: 620;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.visual {
  min-height: 420px;
  position: relative;
  display: grid;
  place-items: center;
}

.visual::before {
  content: "";
  position: absolute;
  pointer-events: none;
  width: min(420px, 80%);
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 113, 227, .16), transparent 66%);
  filter: blur(8px);
  transform: translateY(20px);
}

.product-stage,
.glass-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .36));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .74),
    0 40px 100px rgba(0, 0, 0, .14);
  overflow: hidden;
}

.product-stage {
  aspect-ratio: 1.05;
  display: grid;
  place-items: center;
}

.product-stage::after {
  content: "";
  position: absolute;
  inset: auto 10% 9%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .15), transparent 70%);
  filter: blur(8px);
}

.product-svg,
.generated-product {
  position: relative;
  z-index: 1;
  width: 74%;
  height: auto;
  filter: drop-shadow(0 32px 34px rgba(0, 0, 0, .18));
  animation: floatProduct 5s var(--ease) infinite;
}

@keyframes floatProduct {
  0%, 100% { transform: translateY(-3px) rotate(-1deg); }
  50% { transform: translateY(-17px) rotate(1deg); }
}

.preview-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  background: #111;
}

.product-stage.has-file .preview-media {
  display: block;
}

.product-stage.has-file .product-svg,
.product-stage.has-file .upload-orbit {
  display: none;
}

.upload-orbit,
.status-pill {
  position: relative;
  z-index: 2;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--soft-shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(18px);
}

.upload-orbit {
  position: absolute;
  right: 34px;
  bottom: 34px;
}

.file-button {
  position: relative;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

textarea {
  width: 100%;
  min-height: 290px;
  border: 0;
  border-radius: 28px;
  padding: 26px;
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, .08),
    var(--soft-shadow);
  outline: 0;
  resize: vertical;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.55;
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}

textarea:focus {
  box-shadow:
    inset 0 0 0 2px rgba(0, 113, 227, .72),
    0 24px 58px rgba(0, 113, 227, .13);
  transform: translateY(-2px);
}

.stack {
  width: min(640px, 100%);
  display: grid;
  gap: 16px;
}

.chips,
.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  font-size: 13px;
  font-weight: 850;
}

.tool-grid {
  width: min(660px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tool-card,
.result-panel,
.history-card {
  position: relative;
  border: 0;
  border-radius: 32px;
  padding: 26px;
  background: rgba(255, 255, 255, .72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .82),
    0 24px 60px rgba(0, 0, 0, .1);
  transition: transform .55s var(--ease), box-shadow .55s var(--ease), background .55s var(--ease);
}

.tool-card {
  min-height: 430px;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  text-align: left;
}

.tool-card:hover,
.history-card:hover {
  transform: translateY(-5px);
}

.tool-card.active {
  background: rgba(255, 255, 255, .94);
  box-shadow:
    inset 0 0 0 2px rgba(0, 113, 227, .72),
    0 32px 72px rgba(0, 113, 227, .16);
}

.tool-card h3 {
  margin: 8px 0 0;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.05;
}

.tool-card p,
.history-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 620;
}

.tag {
  width: fit-content;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  color: var(--blue);
  background: rgba(0, 113, 227, .1);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 900;
}

.tool-card svg {
  width: 100%;
  height: auto;
  margin-top: 24px;
}

.result-panel {
  width: min(680px, 100%);
  display: grid;
  gap: 16px;
}

.result-status {
  min-height: 92px;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(0, 113, 227, .08), rgba(22, 128, 95, .08));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.result-status strong {
  display: block;
  font-size: 20px;
  margin-bottom: 5px;
}

.result-status p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
  font-weight: 650;
}

.loader {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: conic-gradient(var(--blue) var(--progress, 0%), rgba(0, 0, 0, .08) 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: background .48s var(--ease);
}

.loader::after {
  content: "";
  width: 32px;
  height: 32px;
  border-radius: inherit;
  background: rgba(255, 255, 255, .92);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.angle-card {
  min-height: 176px;
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  display: grid;
  grid-template-rows: 1fr auto;
  opacity: 0;
  transform: translateY(18px) scale(.98);
  animation: revealCard .58s var(--ease) forwards;
}

@keyframes revealCard {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.angle-art {
  min-height: 122px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 78%, rgba(0, 113, 227, .13), transparent 40%),
    linear-gradient(180deg, #fff, #f4f5f7);
}

.angle-art img,
.angle-art svg {
  width: min(78%, 130px);
  height: auto;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, .13));
}

.angle-meta {
  min-height: 44px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, .06);
}

.angle-meta strong {
  font-size: 13px;
}

.angle-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.history-list {
  width: min(740px, 100%);
  display: grid;
  gap: 14px;
}

.history-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}

.meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  transform: translate(-50%, 18px);
  min-height: 44px;
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 999px;
  padding: 0 18px;
  color: #fff;
  background: rgba(29, 29, 31, .9);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
  display: inline-flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(18px);
  transition: opacity .28s ease, transform .42s var(--ease);
  font-size: 13px;
  font-weight: 800;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }

  .brand span:last-child {
    display: none;
  }

  .app {
    padding: 86px 14px 18px;
  }

  .device,
  .canvas,
  .page {
    min-height: calc(100vh - 108px);
  }

  .page {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 24px;
    padding: 28px;
  }

  h1 {
    font-size: clamp(44px, 12vw, 72px);
  }

  h2 {
    font-size: clamp(38px, 10vw, 64px);
  }

  .lead {
    font-size: 18px;
  }

  .visual {
    min-height: 300px;
  }

  .product-stage {
    width: min(360px, 94%);
  }

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

  .tool-card {
    min-height: 260px;
  }
}

@media (max-width: 620px) {
  .topbar {
    top: 8px;
    width: calc(100vw - 16px);
    padding-left: 10px;
  }

  .step-dot {
    width: 7px;
    height: 7px;
  }

  .step-dot.active {
    width: 22px;
  }

  .primary-btn,
  .secondary-btn,
  .file-button {
    min-height: 42px;
    padding: 0 13px;
  }

  .nav-btn {
    min-width: 34px;
    min-height: 34px;
  }

  .page {
    padding: 22px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .file-button,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .visual {
    min-height: 246px;
  }

  textarea {
    min-height: 240px;
    border-radius: 24px;
  }

  .result-status {
    align-items: flex-start;
  }

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

  .history-card {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
