:root {
  color-scheme: light;
  --ink: #17161d;
  --muted: #6f6d78;
  --line: #dedce5;
  --soft-line: #eceaf0;
  --surface: rgba(255, 255, 255, 0.9);
  --canvas: #f4f2f7;
  --purple: #6e4cff;
  --purple-dark: #5636db;
  --purple-soft: #eee9ff;
  --mint: #1ca87c;
  --danger: #d94a61;
  --tiktok-pink: #fe2c55;
  --tiktok-pink-dark: #d4143a;
  --tiktok-cyan: #25f4ee;
  --tiktok-video-soft: #fff0f3;
  --amazon: #ff9900;
  --amazon-dark: #c96b00;
  --amazon-soft: #fff4de;
  --shadow: 0 28px 80px rgba(43, 34, 68, 0.11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  height: 100%;
  min-width: 320px;
  overflow: hidden;
  background: var(--canvas);
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  background:
    radial-gradient(circle at 11% 14%, rgba(111, 76, 255, 0.1), transparent 24rem),
    radial-gradient(circle at 88% 42%, rgba(35, 196, 156, 0.08), transparent 28rem),
    linear-gradient(180deg, #faf9fc 0%, #f1eff5 100%);
}

button, textarea { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.page-shell {
  width: min(1440px, calc(100% - 48px));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(430px, 1fr) minmax(360px, 0.95fr);
  align-items: center;
  column-gap: clamp(28px, 5vw, 72px);
  row-gap: 8px;
  padding: 20px 0 16px;
  max-width: none;
}
.eyebrow { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--purple); font-size: 9px; font-weight: 800; letter-spacing: 0.18em; }
.eyebrow span { width: 25px; height: 2px; background: var(--purple); }
.hero h1 {
  margin: 0;
  padding: 18px 0;
  font-size: clamp(26px, 2.8vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 720;
  white-space: nowrap;
}
.hero h1 br { display: none; }
.hero h1 em { color: var(--purple); font-style: normal; }
.hero h1 .accent-char { color: var(--purple); }
.hero-char {
  display: inline-block;
  opacity: 1;
  transform-origin: 50% 75%;
  will-change: opacity, transform, filter;
}
.hero h1.is-switching .hero-char {
  animation: hero-character-in 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--char-index) * 24ms);
}
.type-caret {
  display: inline-block;
  width: 2px;
  height: 0.92em;
  margin-left: 3px;
  border-radius: 1px;
  background: var(--purple);
  vertical-align: -0.06em;
  animation: caret-blink 0.85s step-end infinite;
}
@keyframes hero-character-in {
  from { opacity: 0; filter: blur(7px); transform: translateY(0.55em) rotateX(-35deg) scale(0.96); }
  to { opacity: 1; filter: blur(0); transform: translateY(0) rotateX(0) scale(1); }
}
@keyframes hero-copy-in {
  from { opacity: 0; filter: blur(4px); transform: translateY(9px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}
@keyframes caret-blink { 50% { opacity: 0; } }
.eyebrow.is-switching {
  animation: hero-copy-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-side p.is-switching {
  animation: hero-copy-in 480ms 150ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.feature-strip.is-switching > span {
  animation: hero-copy-in 440ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(220ms + var(--feature-index) * 65ms);
}
.hero-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-side p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-wrap: balance;
}
.feature-strip { display: flex; gap: 22px; color: #4f4d58; font-size: 10px; }
.feature-strip span { display: inline-flex; align-items: center; gap: 8px; }
.feature-strip b { color: var(--purple); font-size: 10px; letter-spacing: 0.08em; }

.tool-switch {
  flex: 0 0 auto;
  align-self: flex-start;
  display: flex;
  gap: 5px;
  margin: 0 0 10px;
  padding: 4px;
  border: 1px solid rgba(210, 207, 218, 0.84);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(43, 34, 68, 0.06);
}
.tool-tab {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: #77737e;
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.tool-tab:hover { color: var(--ink); background: rgba(245, 243, 248, 0.9); }
.tool-tab.is-active { color: var(--ink); background: white; box-shadow: 0 3px 10px rgba(35, 30, 46, 0.09); }
.tool-tab.is-active { animation: active-tab-text-in 260ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes active-tab-text-in {
  from { color: transparent; letter-spacing: 0.08em; }
  to { color: var(--ink); letter-spacing: normal; }
}
.tool-dot { width: 7px; height: 7px; border-radius: 50%; }
.tiktok-dot { background: var(--purple); box-shadow: 0 0 0 3px rgba(110, 76, 255, 0.11); }
.tiktok-video-dot {
  background: linear-gradient(135deg, var(--tiktok-cyan) 0 45%, var(--tiktok-pink) 48% 100%);
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
}
.video-dot {
  background: linear-gradient(135deg, var(--tiktok-cyan) 0 25%, var(--tiktok-pink) 28% 52%, var(--amazon) 55% 100%);
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.09);
}
.images-dot { background: var(--amazon); box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.13); }
.amazon-dot { background: var(--amazon); box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.13); }

body[data-tool="tiktok-video"] .eyebrow,
body[data-tool="tiktok-video"] .hero h1 .accent-char,
body[data-tool="tiktok-video"] .feature-strip b { color: var(--tiktok-pink-dark); }
body[data-tool="tiktok-video"] .eyebrow span,
body[data-tool="tiktok-video"] .type-caret { background: var(--tiktok-pink); }
body[data-tool="video"] .eyebrow,
body[data-tool="video"] .hero h1 .accent-char,
body[data-tool="video"] .feature-strip b { color: var(--tiktok-pink-dark); }
body[data-tool="video"] .eyebrow span,
body[data-tool="video"] .type-caret {
  background: linear-gradient(90deg, var(--tiktok-cyan), var(--tiktok-pink), var(--amazon));
}
body[data-tool="amazon"] .eyebrow,
body[data-tool="amazon"] .hero h1 .accent-char,
body[data-tool="amazon"] .feature-strip b { color: var(--amazon-dark); }
body[data-tool="amazon"] .eyebrow span,
body[data-tool="amazon"] .type-caret { background: var(--amazon); }
body[data-tool="images"] .eyebrow,
body[data-tool="images"] .hero h1 .accent-char,
body[data-tool="images"] .feature-strip b { color: var(--amazon-dark); }
body[data-tool="images"] .eyebrow span,
body[data-tool="images"] .type-caret { background: var(--amazon); }

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
  padding-bottom: 10px;
}
.panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  background: var(--surface); border: 1px solid rgba(210, 207, 218, 0.88); border-radius: 22px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.panel-heading { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.step { color: var(--purple); font-size: 9px; font-weight: 800; letter-spacing: 0.18em; }
.panel h2 { margin: 5px 0 0; font-size: 18px; letter-spacing: -0.025em; }
.count-badge { padding: 7px 10px; border-radius: 999px; background: #f1eff4; color: var(--muted); font-size: 10px; font-weight: 700; }
.count-badge.has-value { color: var(--purple-dark); background: var(--purple-soft); }
.count-badge.over-limit { color: var(--danger); background: #fff0f2; }

.textarea-wrap { position: relative; min-height: 0; flex: 1; }
textarea {
  position: relative; z-index: 1; display: block; width: 100%; height: 100%; min-height: 112px; resize: none; padding: 16px 18px;
  color: #292732; background: rgba(249, 248, 251, 0.92); border: 1px solid var(--line); border-radius: 17px;
  outline: none; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.78;
  scrollbar-width: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
textarea::-webkit-scrollbar { display: none; }
textarea::placeholder { color: #aaa7b2; }
textarea:focus { border-color: rgba(110, 76, 255, 0.62); background: white; box-shadow: 0 0 0 4px rgba(110, 76, 255, 0.1); }
.textarea-glow { position: absolute; inset: 18px -10px -12px; border-radius: 22px; background: rgba(110, 76, 255, 0.09); filter: blur(24px); opacity: 0; transition: opacity 180ms ease; }
.textarea-wrap:focus-within .textarea-glow { opacity: 1; }
.input-help { flex: 0 0 auto; margin: 8px 3px 0; color: #92909a; font-size: 9px; }
.input-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 11px; }
.secondary-actions { display: flex; align-items: center; gap: 4px; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 11px; }
.text-button:hover:not(:disabled) { color: var(--ink); background: #f2f0f5; }
.text-button svg { width: 15px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-width: 140px; min-height: 42px; padding: 0 18px;
  color: white; background: var(--ink); border: 0; border-radius: 14px; font-size: 12px; font-weight: 750;
  box-shadow: 0 13px 25px rgba(24, 22, 30, 0.19); transition: transform 160ms ease, background 160ms ease;
}
.primary-button:hover:not(:disabled) { background: var(--purple); transform: translateY(-1px); }
.primary-button svg { width: 17px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-button.loading svg { animation: arrow-pulse 900ms ease-in-out infinite; }
@keyframes arrow-pulse { 50% { transform: translateX(4px); opacity: 0.55; } }

.progress { flex: 0 0 auto; margin-top: 9px; }
.progress-bar { height: 3px; overflow: hidden; border-radius: 999px; background: #ece9f2; }
.progress-bar span { display: block; width: 34%; height: 100%; border-radius: inherit; background: var(--purple); animation: progress-move 1.1s ease-in-out infinite; }
.progress p { margin: 8px 0 0; color: var(--muted); font-size: 10px; }
@keyframes progress-move { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

.result-heading { align-items: center; }
.result-tools { display: flex; gap: 7px; }
.compact-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #5d5b66; background: white; font-size: 10px; font-weight: 700; }
.compact-button:hover:not(:disabled) { border-color: var(--purple); color: var(--purple-dark); }
.summary { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; border: 1px solid var(--soft-line); border-radius: 12px; background: #faf9fb; }
.summary div { display: flex; align-items: baseline; justify-content: center; gap: 7px; padding: 9px; border-right: 1px solid var(--soft-line); }
.summary div:last-child { border-right: 0; }
.summary strong { font-size: 17px; }
.summary span { color: var(--muted); font-size: 10px; }

.empty-state { min-height: 0; flex: 1; display: grid; place-content: center; justify-items: center; padding: 10px 20px; text-align: center; }
.empty-state h3 { margin: 15px 0 6px; font-size: 14px; }
.empty-state p { margin: 0; color: #9a97a2; font-size: 11px; }
.empty-visual { position: relative; width: 150px; height: 72px; transform: scale(0.88); }
.link-card { position: absolute; top: 19px; width: 60px; height: 58px; border-radius: 13px; border: 1px solid #d6d2df; background: white; box-shadow: 0 12px 24px rgba(52, 45, 70, 0.08); }
.link-card-a { left: 3px; transform: rotate(-7deg); }
.link-card-a::after { content: "↗"; display: grid; place-items: center; height: 100%; color: var(--purple); font-size: 24px; font-weight: 300; }
.link-card-b { right: 3px; display: grid; align-content: center; gap: 5px; padding: 13px; transform: rotate(7deg); }
.link-card-b i { display: block; height: 3px; border-radius: 9px; background: #d9d6e0; }
.link-card-b i:first-child { width: 60%; background: #a997ff; }
.link-path { position: absolute; top: 44px; left: 57px; width: 61px; height: 2px; background: linear-gradient(90deg, #c9c4d5, var(--purple), #c9c4d5); }
.link-path::after { content: ""; position: absolute; right: -1px; top: -3px; width: 7px; height: 7px; border-right: 2px solid var(--purple); border-top: 2px solid var(--purple); transform: rotate(45deg); }

.error-banner { flex: 0 0 auto; margin-bottom: 9px; padding: 10px 12px; border-radius: 11px; color: #a82c43; background: #fff0f3; border: 1px solid #ffd4dc; font-size: 10px; }
.result-list {
  min-height: 0;
  flex: 1;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.result-list::-webkit-scrollbar { display: none; }
.result-row { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 9px 11px; border: 1px solid var(--soft-line); border-radius: 12px; background: rgba(250, 249, 251, 0.8); }
.result-row:hover { background: white; border-color: #d8d4e0; }
.row-status { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; font-size: 12px; font-weight: 900; }
.is-success .row-status { color: #087b5a; background: #dcf7ed; }
.is-failure .row-status { color: #b62f48; background: #ffe5ea; }
.row-content { min-width: 0; }
.row-meta { display: flex; gap: 9px; align-items: center; min-width: 0; color: #9b98a3; font-size: 9px; }
.source-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-url { display: block; overflow: hidden; margin: 6px 0 0; color: var(--ink); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
a.output-url:hover { color: var(--purple-dark); text-decoration: underline; }
.row-trailing { display: flex; align-items: center; gap: 9px; }
.product-id, .error-code { color: #8e8b96; font-size: 8px; letter-spacing: 0.04em; white-space: nowrap; }
.error-code { color: var(--danger); }
.icon-button { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: #73707c; background: white; }
.icon-button:hover { color: var(--purple); border-color: #bdb0ff; }
.icon-button svg { width: 14px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.product-preview {
  position: fixed;
  z-index: 40;
  width: min(344px, calc(100vw - 24px));
  min-height: 126px;
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 13px;
  padding: 10px;
  overflow: hidden;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(205, 200, 217, 0.96);
  border-radius: 17px;
  box-shadow: 0 20px 56px rgba(31, 26, 43, 0.24);
  pointer-events: none;
  opacity: 0;
  transform: translateY(7px) scale(0.98);
  transform-origin: top left;
  transition: opacity 140ms ease, transform 140ms ease;
  backdrop-filter: blur(18px);
}
.product-preview.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.preview-media { position: relative; width: 106px; height: 106px; overflow: hidden; border-radius: 12px; background: linear-gradient(145deg, #eee9ff, #e5f7f1); }
.preview-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: var(--purple-dark); background: radial-gradient(circle at 30% 25%, white, transparent 24%), linear-gradient(145deg, #eee9ff, #dff5ee); }
.preview-fallback::before { content: ""; position: absolute; width: 45px; height: 45px; border: 1px solid rgba(110, 76, 255, 0.24); border-radius: 14px; transform: rotate(12deg); }
.preview-fallback span { position: relative; z-index: 1; font-size: 8px; font-weight: 850; letter-spacing: 0.16em; }
.preview-content { min-width: 0; display: flex; flex-direction: column; padding: 3px 3px 2px 0; }
.preview-eyebrow { color: var(--purple); font-size: 8px; font-weight: 850; letter-spacing: 0.15em; }
.preview-content h3 { display: -webkit-box; overflow: hidden; margin: 7px 0 8px; font-size: 12px; line-height: 1.4; letter-spacing: -0.015em; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.preview-meta { display: flex; align-items: center; gap: 7px; min-width: 0; color: #76727e; font-size: 8px; }
.preview-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-meta span:first-child { flex: 0 0 auto; color: #5f5b68; font-weight: 750; }
.preview-content p { margin: auto 0 0; color: #9a96a2; font-size: 8px; }

.amazon-step { color: var(--amazon-dark); }
.amazon-badge { color: #a75d08; background: var(--amazon-soft); }
.amazon-textarea-wrap { flex: 1; }
.amazon-textarea-wrap textarea:focus { border-color: rgba(255, 153, 0, 0.72); box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.11); }
.amazon-glow { background: rgba(255, 153, 0, 0.11); }
.amazon-primary:hover:not(:disabled) { color: #24170a; background: var(--amazon); }
.amazon-progress .progress-bar span { background: var(--amazon); }

.tiktok-video-step { color: var(--tiktok-pink-dark); }
.tiktok-video-badge { color: #b11738; background: var(--tiktok-video-soft); }
.tiktok-video-textarea-wrap { flex: 1; }
.tiktok-video-textarea-wrap textarea:focus {
  border-color: rgba(254, 44, 85, 0.6);
  box-shadow: 0 0 0 4px rgba(254, 44, 85, 0.09);
}
.tiktok-video-glow { background: rgba(254, 44, 85, 0.1); }
.tiktok-video-primary:hover:not(:disabled) { background: var(--tiktok-pink); }
.tiktok-video-progress .progress-bar span {
  background: linear-gradient(90deg, var(--tiktok-cyan), var(--tiktok-pink));
}
.tiktok-empty-visual .video-frame {
  background: linear-gradient(145deg, #eaffff, #fff0f3);
}
.tiktok-empty-visual .video-frame i {
  border-left-color: var(--tiktok-pink);
  filter: drop-shadow(-3px 3px 0 rgba(37, 244, 238, 0.5));
}
.tiktok-empty-visual .quality-pill {
  box-shadow: -3px 3px 0 rgba(37, 244, 238, 0.65), 3px -3px 0 rgba(254, 44, 85, 0.44);
}

.amazon-empty-state { padding-bottom: 26px; }
.video-empty-visual { position: relative; width: 150px; height: 83px; }
.video-frame {
  position: absolute;
  inset: 7px 10px 7px 8px;
  display: grid;
  place-items: center;
  border: 1px solid #d9d5df;
  border-radius: 17px;
  background: linear-gradient(145deg, #f1edf8, #fff7e8);
  box-shadow: 0 14px 30px rgba(47, 39, 61, 0.09);
  transform: rotate(-3deg);
}
.video-frame i {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid var(--amazon);
  filter: drop-shadow(0 5px 8px rgba(201, 107, 0, 0.2));
}
.quality-pill {
  position: absolute;
  right: 1px;
  bottom: 1px;
  padding: 6px 8px;
  border: 2px solid white;
  border-radius: 9px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(26, 24, 31, 0.18);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.amazon-video-card {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(180px, 0.86fr) minmax(220px, 1.14fr);
  gap: clamp(15px, 2.3vw, 28px);
  padding: 4px;
  overflow: auto;
  scrollbar-width: none;
}
.amazon-video-card::-webkit-scrollbar { display: none; }
.amazon-poster-wrap {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border-radius: 17px;
  background: #25222b;
  box-shadow: 0 17px 36px rgba(35, 29, 44, 0.18);
}
.amazon-poster-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.amazon-poster-wrap video {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0e0d11;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.amazon-poster-wrap video.is-ready { opacity: 1; pointer-events: auto; }
.amazon-poster-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 190px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 153, 0, 0.38), transparent 26%),
    linear-gradient(145deg, #302b38, #17161d);
}
.amazon-poster-fallback span { color: rgba(255, 255, 255, 0.62); font-size: 8px; font-weight: 850; letter-spacing: 0.15em; }
.tiktok-video-poster-wrap { background: #131216; }
.tiktok-video-poster-fallback {
  background:
    radial-gradient(circle at 27% 21%, rgba(37, 244, 238, 0.27), transparent 28%),
    radial-gradient(circle at 78% 79%, rgba(254, 44, 85, 0.28), transparent 31%),
    linear-gradient(145deg, #26222d, #0f0e12);
}
.preview-play-icon {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}
.amazon-preview-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: white;
  background: rgba(17, 15, 21, 0.76);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(9px);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease;
}
.amazon-preview-button:hover:not(:disabled) { background: var(--amazon-dark); transform: translate(-50%, -50%) scale(1.03); }
.tiktok-video-preview-button:hover:not(:disabled) {
  background: var(--tiktok-pink-dark);
  box-shadow: -3px 3px 0 rgba(37, 244, 238, 0.4), 0 9px 24px rgba(0, 0, 0, 0.26);
}
.amazon-preview-button.is-loading { pointer-events: none; }
.amazon-preview-button.is-loading .preview-play-icon {
  width: 12px;
  height: 12px;
  margin: 0;
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-top-color: white;
  border-radius: 50%;
  animation: preview-spin 800ms linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }
.resolution-chip {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  padding: 6px 8px;
  border-radius: 8px;
  color: #22170c;
  background: var(--amazon);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.amazon-video-info { min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 5px 4px 4px 0; }
.amazon-source-label { color: var(--amazon-dark); font-size: 8px; font-weight: 850; letter-spacing: 0.14em; }
.tiktok-video-resolution-chip {
  color: white;
  background: linear-gradient(135deg, var(--tiktok-pink-dark), var(--tiktok-pink));
  box-shadow: -3px 3px 0 rgba(37, 244, 238, 0.58), 0 8px 18px rgba(0, 0, 0, 0.2);
}
.tiktok-video-source-label { color: var(--tiktok-pink-dark); }
.amazon-video-info h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 9px 0 5px;
  font-size: clamp(15px, 1.5vw, 20px);
  line-height: 1.3;
  letter-spacing: -0.025em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.amazon-video-id { overflow: hidden; margin: 0; color: #95919d; font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.tiktok-video-author {
  overflow: hidden;
  margin: 0 0 5px;
  color: #696570;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quality-field { display: grid; gap: 7px; margin-top: 18px; color: #65616c; font-size: 9px; font-weight: 750; }
.quality-field select {
  width: 100%;
  min-height: 39px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: white;
  outline: none;
  font: inherit;
  font-size: 10px;
}
.quality-field select:focus { border-color: var(--amazon); box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.12); }
.tiktok-video-info .quality-field select:focus {
  border-color: var(--tiktok-pink);
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
}
.amazon-download-button { width: 100%; margin-top: 11px; text-decoration: none; }
.amazon-download-button:hover { color: #22170c; background: var(--amazon); transform: translateY(-1px); }
.tiktok-video-download-button:hover {
  color: white;
  background: var(--tiktok-pink);
}
.tiktok-video-card.is-amazon .tiktok-video-poster-fallback {
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 153, 0, 0.38), transparent 26%),
    linear-gradient(145deg, #302b38, #17161d);
}
.tiktok-video-card.is-amazon .tiktok-video-preview-button:hover:not(:disabled) {
  background: var(--amazon-dark);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.26);
}
.tiktok-video-card.is-amazon .tiktok-video-resolution-chip {
  color: #22170c;
  background: var(--amazon);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}
.tiktok-video-card.is-amazon .tiktok-video-source-label { color: var(--amazon-dark); }
.tiktok-video-card.is-amazon .quality-field select:focus {
  border-color: var(--amazon);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.12);
}
.tiktok-video-card.is-amazon .tiktok-video-download-button:hover {
  color: #22170c;
  background: var(--amazon);
}
.amazon-download-button svg { stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.download-note { margin: 8px 2px 0; color: #97939d; font-size: 8px; line-height: 1.45; }

.amazon-images-step { color: var(--amazon-dark); }
.amazon-images-badge { color: #9a5707; background: var(--amazon-soft); }
.amazon-images-textarea-wrap { flex: 1; }
.amazon-images-textarea-wrap textarea:focus {
  border-color: rgba(255, 153, 0, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.11);
}
.amazon-images-glow { background: rgba(255, 153, 0, 0.12); }
.amazon-images-primary:hover:not(:disabled),
.amazon-images-download-button:hover:not(:disabled) { color: #24170a; background: var(--amazon); }
.amazon-images-progress .progress-bar span { background: var(--amazon); }

.amazon-images-empty-state { padding-bottom: 24px; }
.image-empty-visual { position: relative; width: 142px; height: 88px; }
.image-sheet {
  position: absolute;
  width: 88px;
  height: 68px;
  overflow: hidden;
  border: 1px solid #d9d5df;
  border-radius: 14px;
  background: white;
  box-shadow: 0 13px 28px rgba(47, 39, 61, 0.1);
}
.image-sheet-back { left: 18px; top: 8px; transform: rotate(-8deg); background: #fff7e9; }
.image-sheet-front { right: 12px; bottom: 4px; display: grid; place-items: center; transform: rotate(5deg); }
.image-sheet-front::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 10px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--amazon);
}
.image-sheet-front i {
  width: 62px;
  height: 35px;
  margin-top: 16px;
  background: linear-gradient(145deg, transparent 38%, #e6dfd2 39% 62%, transparent 63%), linear-gradient(35deg, #f1e2c7 0 55%, transparent 56%);
}
.image-count-pill {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 6px 8px;
  border: 2px solid white;
  border-radius: 9px;
  color: #24170a;
  background: var(--amazon);
  box-shadow: 0 8px 18px rgba(26, 24, 31, 0.16);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.amazon-images-card { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.amazon-images-summary { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.amazon-images-title-wrap { min-width: 0; }
.amazon-images-title-wrap > span { color: var(--amazon-dark); font-size: 8px; font-weight: 850; letter-spacing: 0.14em; }
.amazon-images-title-wrap h3 {
  overflow: hidden;
  margin: 5px 0 3px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amazon-images-title-wrap p { margin: 0; color: #92909a; font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; }
.amazon-images-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  grid-auto-rows: auto;
  gap: 8px;
  align-content: start;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.amazon-images-grid::-webkit-scrollbar { display: none; }
.amazon-image-group-heading {
  grid-column: 1 / -1;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: #6e6974;
  font-size: 8px;
  letter-spacing: 0.08em;
}
.amazon-image-group-heading strong { color: var(--ink); font-size: 9px; letter-spacing: normal; }
.amazon-image-group-heading.is-detail { margin-top: 3px; padding-top: 7px; border-top: 1px solid var(--soft-line); }
.amazon-image-group-heading.is-detail strong { color: var(--amazon-dark); }
.amazon-image-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #f7f5f1;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.amazon-image-tile:hover { transform: translateY(-1px); }
.amazon-image-tile.is-selected { border-color: var(--amazon); box-shadow: inset 0 0 0 1px var(--amazon), 0 7px 18px rgba(201, 107, 0, 0.1); }
.amazon-image-tile input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.amazon-image-tile img { position: relative; z-index: 1; width: 100%; height: 100%; display: block; object-fit: contain; background: white; }
.amazon-image-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: #9b9388; font-size: 8px; text-align: center; }
.amazon-image-tile.image-failed img { display: none; }
.amazon-image-number {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  min-width: 21px;
  padding: 4px 5px;
  border-radius: 7px;
  color: white;
  background: rgba(26, 24, 31, 0.72);
  backdrop-filter: blur(5px);
  font-size: 7px;
  font-weight: 850;
  text-align: center;
}
.amazon-image-check {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 2;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 7px;
  color: transparent;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 4px 10px rgba(26, 24, 31, 0.12);
  font-size: 10px;
  font-weight: 900;
}
.amazon-image-tile.is-selected .amazon-image-check { color: #24170a; background: var(--amazon); }
.amazon-images-download-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
.amazon-images-download-bar > div { display: flex; align-items: baseline; gap: 6px; color: #77737e; font-size: 9px; }
.amazon-images-download-bar strong { color: var(--ink); font-size: 17px; }
.amazon-images-download-button { min-width: 176px; }
.amazon-images-download-status { flex: 0 0 auto; min-height: 12px; margin-top: 6px; text-align: right; }

footer { min-height: 28px; flex: 0 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 2px; color: #8d8a95; font-size: 9px; }
footer p { margin: 0; }
.app-version { flex: 0 0 auto; color: #716e79; font-weight: 750; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
code { color: #625e6b; font-family: "SFMono-Regular", Consolas, monospace; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 10; transform: translate(-50%, 16px); padding: 12px 17px; border-radius: 12px; color: white; background: #1f1d26; box-shadow: 0 15px 40px rgba(24, 22, 30, 0.25); opacity: 0; font-size: 11px; transition: opacity 180ms ease, transform 180ms ease; }
.toast[data-tone="error"] { background: #a82c43; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(110, 76, 255, 0.28); outline-offset: 2px; }

@media (max-width: 940px) {
  .page-shell { width: min(100% - 20px, 720px); }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 13px 3px 11px;
  }
  .eyebrow { display: none; }
  .hero h1 { padding: 0; font-size: clamp(25px, 5vw, 34px); white-space: nowrap; }
  .hero-side { margin-top: 7px; gap: 6px; }
  .hero-side p { max-width: 100%; font-size: 10px; line-height: 1.45; }
  .feature-strip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.12fr) minmax(0, 0.88fr); gap: 8px; padding-bottom: 7px; }
  .tool-switch { margin-bottom: 7px; }
  .panel { padding: 14px 15px; border-radius: 17px; }
  .panel-heading { margin-bottom: 8px; }
  .panel h2 { font-size: 16px; }
  textarea { min-height: 72px; padding: 12px 13px; font-size: 10px; line-height: 1.55; border-radius: 13px; }
  .input-help { margin-top: 5px; font-size: 8px; }
  .input-actions { margin-top: 6px; }
  .text-button { padding: 6px; font-size: 9px; }
  .text-button svg { width: 12px; }
  .primary-button { min-width: 116px; min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: 10px; }
  .result-heading { align-items: center; }
  .compact-button { padding: 6px 8px; font-size: 8px; }
  .summary { margin-bottom: 7px; }
  .summary div { padding: 6px; }
  .summary strong { font-size: 14px; }
  .empty-visual { height: 56px; transform: scale(0.68); }
  .empty-state h3 { margin-top: 4px; }
  .amazon-video-card { grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
  .amazon-poster-wrap, .amazon-poster-fallback { min-height: 120px; }
  .amazon-video-info { padding-top: 0; }
  .quality-field { margin-top: 9px; }
  .amazon-download-button { min-height: 34px; margin-top: 7px; }
  .download-note { margin-top: 5px; }
  .amazon-images-summary { margin-bottom: 6px; }
  .amazon-images-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
  .amazon-image-tile { min-height: 70px; border-radius: 9px; }
  .amazon-images-download-bar { margin-top: 6px; }
  .amazon-images-download-button { min-width: 154px; }
  footer { min-height: 18px; flex-basis: 18px; justify-content: flex-end; gap: 0; font-size: 8px; }
  footer p:not(.app-version) { display: none; }
}

@media (max-width: 600px) {
  .page-shell { width: calc(100% - 14px); }
  .hero h1 { font-size: clamp(22px, 6.8vw, 28px); letter-spacing: -0.045em; }
  .hero-side p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .count-badge { padding: 5px 8px; font-size: 8px; }
  .step { font-size: 7px; }
  .secondary-actions { gap: 0; }
  .tiktok-video-input-panel .input-actions { gap: 8px; }
  .tiktok-video-input-panel .secondary-actions { min-width: 0; }
  .tiktok-video-input-panel .text-button {
    flex: 0 0 auto;
    gap: 4px;
    padding: 5px 3px;
    white-space: nowrap;
    font-size: 8px;
  }
  .result-tools { gap: 4px; }
  .tool-switch { width: 100%; }
  .tool-tab { flex: 1; justify-content: center; gap: 5px; padding: 0 5px; font-size: 8px; white-space: nowrap; }
  .tool-dot { width: 6px; height: 6px; }
  .result-row {
    position: relative;
    grid-template-columns: 25px minmax(0, 1fr);
    min-height: 50px;
    padding: 7px 47px 7px 8px;
  }
  .row-status { width: 24px; height: 24px; }
  .product-id { display: none; }
  .row-trailing { position: absolute; right: 8px; }
  .output-url { font-size: 9px; }
  .row-meta { font-size: 7px; }
  .product-preview { grid-template-columns: 82px minmax(0, 1fr); min-height: 102px; gap: 10px; padding: 9px; border-radius: 14px; }
  .preview-media { width: 82px; height: 82px; border-radius: 10px; }
  .preview-content h3 { margin: 5px 0 6px; font-size: 10px; -webkit-line-clamp: 2; }
  .preview-content p { display: none; }
  .amazon-video-card { grid-template-columns: 112px minmax(0, 1fr); gap: 11px; }
  .amazon-poster-wrap, .amazon-poster-fallback { min-height: 112px; border-radius: 13px; }
  .amazon-video-info h3 { margin-top: 5px; font-size: 12px; }
  .amazon-source-label, .download-note { display: none; }
  .quality-field { gap: 4px; margin-top: 6px; }
  .quality-field select { min-height: 31px; padding-left: 8px; font-size: 8px; }
  .amazon-download-button { min-width: 0; min-height: 31px; font-size: 9px; }
  .amazon-images-title-wrap > span { display: none; }
  .amazon-images-title-wrap h3 { margin-top: 0; font-size: 11px; }
  .amazon-images-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .amazon-image-tile { min-height: 62px; }
  .amazon-image-number { left: 4px; bottom: 4px; padding: 3px 4px; }
  .amazon-image-check { right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 6px; }
  .amazon-images-download-bar > div span { display: none; }
  .amazon-images-download-button { min-width: 150px; min-height: 31px; font-size: 9px; }
  .amazon-images-download-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .product-preview { transition: none; }
  .hero h1.is-switching .hero-char,
  .eyebrow.is-switching,
  .hero-side p.is-switching,
  .feature-strip.is-switching > span,
  .tool-tab.is-active,
  .type-caret { animation: none; }
}

@media (max-height: 720px) {
  .hero { padding-top: 8px; padding-bottom: 8px; }
  .hero-side p { display: none; }
  .panel { padding-top: 11px; padding-bottom: 11px; }
  .input-help { display: none; }
}

@media (max-height: 720px) and (max-width: 940px) {
  .workspace { grid-template-rows: minmax(0, 1.08fr) minmax(0, 0.92fr); }
}
