:root {
  color-scheme: light;

  /* ── 中性底色（暖米白、護眼，文字對比足） ── */
  --ink: #3a3540;
  --muted: #877e8a;
  --line: #ece2ec;
  --paper: #fdf9f4;
  --panel: #ffffff;
  --panel-soft: #fffaf6;

  /* ── 🌸 粉紅：品牌主角 / 錄音 / 第 1 步 ── */
  --pink-soft: #fcdae7;
  --pink: #f6a9c6;
  --pink-strong: #e56ba1;
  --pink-deep: #c54f86;

  /* ── 🍑 蜜橘：前進動作（主要 CTA） / 第 2 步 ── */
  --peach-soft: #ffe3c6;
  --peach: #ffbf88;
  --peach-strong: #f6923f;
  --peach-deep: #db7129;

  /* ── 🌿 淺綠：完成 / 成功 / 第 3 步 ── */
  --mint-soft: #d4efd8;
  --mint: #9cdcac;
  --mint-strong: #56b974;
  --mint-deep: #3e9b5c;

  /* ── ☁️ 天藍：上傳 / 資訊 / 輔助 ── */
  --sky-soft: #d6edfb;
  --sky: #9bd4f2;
  --sky-strong: #4ea7dd;
  --sky-deep: #2f85bd;

  --focus: #ef7d12;
  --shadow: 0 22px 60px rgba(120, 86, 110, 0.16);
  --shadow-soft: 0 12px 30px rgba(120, 86, 110, 0.10);

  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(720px 460px at 0% 0%, rgba(246, 169, 198, 0.30), transparent 60%),
    radial-gradient(680px 440px at 100% 2%, rgba(155, 212, 242, 0.30), transparent 60%),
    radial-gradient(720px 520px at 4% 100%, rgba(255, 191, 136, 0.26), transparent 62%),
    radial-gradient(700px 520px at 100% 100%, rgba(156, 220, 172, 0.28), transparent 62%),
    linear-gradient(180deg, #fffdfa 0%, var(--paper) 52%, #fbf3ea 100%),
    var(--paper);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.55;
}

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

button,
label.file-drop {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.file-drop:focus-within,
.skip-link:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.skip-link {
  background: var(--pink-deep);
  color: #fff;
  left: 1rem;
  padding: 0.75rem 1rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-150%);
  z-index: 50;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  margin: 0 auto;
  max-width: 920px;
  padding: 34px 18px 56px;
}

.auth-screen {
  align-items: center;
  background:
    radial-gradient(620px 420px at 0% 0%, rgba(246, 169, 198, 0.34), transparent 60%),
    radial-gradient(600px 420px at 100% 0%, rgba(155, 212, 242, 0.32), transparent 60%),
    radial-gradient(620px 460px at 50% 100%, rgba(255, 191, 136, 0.26), transparent 62%),
    linear-gradient(180deg, #fffdfa 0%, var(--paper) 100%);
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  padding: 22px;
  position: fixed;
  z-index: 80;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 430px;
  padding: 30px;
  width: 100%;
}

.auth-card h1 {
  font-size: clamp(2rem, 8vw, 3.2rem);
}

.auth-mark {
  height: 66px;
  width: 66px;
}

.auth-error {
  background: #ffeef2;
  border: 1px solid var(--pink);
  border-radius: 12px;
  color: #b23a64;
  font-weight: 800;
  margin: 0;
  padding: 12px 14px;
}

.hero {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 76px 1fr;
  margin-bottom: 22px;
}

.brand-mark {
  align-items: center;
  background:
    linear-gradient(145deg, #fff3f7 0%, var(--pink-soft) 46%, var(--peach) 100%);
  border: 1px solid rgba(229, 107, 161, 0.22);
  border-radius: 24px;
  box-shadow: 0 18px 34px rgba(229, 107, 161, 0.22);
  color: var(--pink-deep);
  display: flex;
  height: 76px;
  justify-content: center;
  width: 76px;
}

.brand-mark svg {
  height: 42px;
  width: 42px;
}

.eyebrow {
  color: var(--pink-deep);
  font-weight: 800;
  margin: 0 0 2px;
}

h1,
h2 {
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  line-height: 1.15;
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
}

h2 {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.lead,
.panel p,
.note {
  color: var(--muted);
  margin: 0;
}

.lead {
  max-width: 35rem;
}

.stepper {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 22px 0;
}

.step {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
}

.step span {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 32px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
}

/* 每一步給自己的色票：粉 → 橘 → 綠，幫媽媽用顏色記住進度 */
.step[data-step="1"] span {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.step[data-step="2"] span {
  background: var(--peach-soft);
  color: var(--peach-deep);
}
.step[data-step="3"] span {
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.step.is-active {
  background: #fff;
}
.step[data-step="1"].is-active {
  border-color: var(--pink);
  box-shadow: 0 14px 30px rgba(229, 107, 161, 0.18);
}
.step[data-step="2"].is-active {
  border-color: var(--peach);
  box-shadow: 0 14px 30px rgba(246, 146, 63, 0.18);
}
.step[data-step="3"].is-active {
  border-color: var(--mint);
  box-shadow: 0 14px 30px rgba(86, 185, 116, 0.18);
}

.step[data-step="1"].is-active span,
.step[data-step="1"].is-done span {
  background: var(--pink-strong);
  color: #fff;
}
.step[data-step="2"].is-active span,
.step[data-step="2"].is-done span {
  background: var(--peach-strong);
  color: #fff;
}
.step[data-step="3"].is-active span,
.step[data-step="3"].is-done span {
  background: var(--mint-strong);
  color: #fff;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
  padding: clamp(20px, 5vw, 34px);
}

.primary-actions {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.25fr 1fr;
}

.mega-button,
.file-drop,
.action-button,
.publish-button,
.secondary-button {
  align-items: center;
  border: 0;
  border-radius: 16px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 58px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

/* 🌸 錄音：品牌主角，粉紅 */
.mega-button {
  background:
    linear-gradient(145deg, #f58ab5 0%, var(--pink) 50%, #f9c1d6 100%);
  box-shadow: 0 18px 34px rgba(229, 107, 161, 0.30);
  color: #fff;
  flex-direction: column;
  font-size: clamp(1.4rem, 5vw, 2rem);
  gap: 10px;
  min-height: 190px;
  padding: 26px;
}

.mega-button svg {
  height: 48px;
  width: 48px;
}

.mega-button.is-recording {
  background:
    linear-gradient(145deg, #c5316b 0%, #e0588f 60%, #f185b2 100%);
  box-shadow: 0 18px 34px rgba(197, 49, 107, 0.36);
}

/* ☁️ 上傳：天藍 */
.file-drop {
  background:
    linear-gradient(180deg, #f4fbff 0%, var(--sky-soft) 100%);
  border: 2px dashed var(--sky-strong);
  color: var(--sky-deep);
  flex-direction: column;
  gap: 8px;
  min-height: 190px;
  padding: 22px;
  text-align: center;
}

.file-drop input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.file-drop svg {
  height: 42px;
  width: 42px;
}

.file-drop small {
  color: var(--sky-deep);
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.85;
}

/* 🌿 已選檔案狀態：淺綠（確認感） */
.status-box {
  background: var(--mint-soft);
  border: 2px solid var(--mint);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  padding: 16px;
  color: var(--mint-deep);
}

.status-box strong {
  color: var(--ink);
}

/* ☁️ 小提醒：天藍資訊條 */
.record-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  background: #f4fbff;
  border: 1px solid var(--sky-soft);
  border-left: 4px solid var(--sky-strong);
  border-radius: 14px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
}

.record-tip svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  fill: none;
  stroke: var(--sky-deep);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.record-tip strong {
  color: var(--sky-deep);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 800;
}

input,
select,
textarea {
  background: #fffefc;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  min-height: 56px;
  padding: 14px 15px;
  width: 100%;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--sky);
}

textarea {
  resize: vertical;
}

.split-fields,
.result-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 🍑 前進動作（幫我準備上架資料 / 進入 App）：蜜橘＋粉的暖色 CTA */
.action-button,
.publish-button {
  background:
    linear-gradient(135deg, var(--peach-strong) 0%, #f7843f 48%, var(--pink-strong) 100%);
  color: #fff;
  gap: 10px;
  min-height: 68px;
  padding: 0 22px;
  box-shadow: 0 16px 30px rgba(246, 146, 63, 0.26);
}

.action-button svg,
.publish-button svg,
.secondary-button svg {
  height: 24px;
  width: 24px;
}

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

.progress-row {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 14px;
  min-height: 62px;
  padding: 14px;
}

.progress-row span {
  background: #e7dded;
  border-radius: 999px;
  flex: 0 0 24px;
  height: 24px;
}

.progress-row.is-done span {
  background: var(--mint-strong);
}

.progress-row.is-active span {
  animation: pulse 1s ease-in-out infinite;
  background: var(--pink-strong);
}

.upload-progress {
  background: var(--sky-soft);
  border: 1px solid var(--sky);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 16px;
}

.upload-progress-head {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

#upload-progress-label {
  color: var(--sky-deep);
  font-weight: 600;
}

#upload-progress-percent {
  color: var(--sky-deep);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.upload-progress-track {
  background: #ffffff;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}

#upload-progress-fill {
  background: linear-gradient(90deg, var(--sky-strong), var(--sky-deep));
  border-radius: 999px;
  display: block;
  height: 100%;
  transition: width 0.25s ease;
  width: 0%;
}

.upload-progress.is-processing #upload-progress-fill {
  animation: upload-indeterminate 1.2s ease-in-out infinite;
  width: 40%;
}

.upload-progress-hint {
  color: var(--sky-deep);
  font-size: 13px;
  margin: 0;
  opacity: 0.85;
}

@keyframes upload-indeterminate {
  0% {
    margin-left: -40%;
  }
  100% {
    margin-left: 100%;
  }
}

.result-header,
.audio-output {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.handoff-steps,
.soundon-fields {
  display: grid;
  gap: 14px;
}

.handoff-step {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: 42px 1fr auto;
  padding: 16px;
}

.handoff-step > span {
  align-items: center;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

/* 三個上架步驟呼應上方 stepper 的色序：粉 → 橘 → 藍 */
.handoff-step:nth-of-type(1) > span {
  background: var(--pink-strong);
}
.handoff-step:nth-of-type(2) > span {
  background: var(--peach-strong);
}
.handoff-step:nth-of-type(3) > span {
  background: var(--sky-strong);
}

.handoff-step strong {
  display: block;
  font-size: 1.12rem;
}

.copy-field {
  background: #fffefc;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.copy-field-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.copy-field label {
  font-weight: 900;
}

.mini-copy-button {
  min-height: 46px;
  padding: 0 14px;
}

/* 🌿 已準備標章：淺綠 */
.ready-badge {
  background: var(--mint-soft);
  border-radius: 999px;
  color: var(--mint-deep);
  font-weight: 900;
  padding: 8px 14px;
  white-space: nowrap;
}

.audio-output {
  background:
    linear-gradient(180deg, #fffaf6, var(--peach-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* 輔助按鈕：白底＋天藍框（資訊／次要動作） */
.secondary-button {
  background: #fff;
  border: 2px solid var(--sky-strong);
  color: var(--sky-deep);
  gap: 8px;
  padding: 0 18px;
  white-space: nowrap;
}

/* 🍑 下載類＝實心蜜橘（明確的「拿走檔案」動作） */
.package-button {
  background: var(--peach-strong);
  border-color: var(--peach-strong);
  color: #fff;
}

/* 安靜按鈕：中性，不搶視覺 */
.quiet-button {
  border-color: var(--line);
  color: var(--muted);
}

/* 打開 SoundOn：實心天藍（跳出去的外連動作） */
.publish-button {
  background:
    linear-gradient(135deg, var(--sky-strong) 0%, var(--sky-deep) 100%);
  border-color: var(--sky-strong);
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 16px 30px rgba(79, 167, 221, 0.26);
}

.toast {
  background: var(--ink);
  border-radius: 16px;
  bottom: 18px;
  box-shadow: var(--shadow);
  color: #fff;
  font-weight: 800;
  left: 50%;
  max-width: min(92vw, 520px);
  padding: 14px 18px;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  z-index: 100;
}

button:hover,
.file-drop:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(120, 86, 110, 0.18);
}

button:active,
.file-drop:active {
  transform: translateY(1px);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.16);
  }
}

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

@media (max-width: 720px) {
  .app-shell {
    padding: 18px 14px 42px;
  }

  .hero {
    grid-template-columns: 58px 1fr;
  }

  .brand-mark {
    border-radius: 16px;
    height: 58px;
    width: 58px;
  }

  .brand-mark svg {
    height: 32px;
    width: 32px;
  }

  .stepper,
  .primary-actions,
  .split-fields,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .step {
    min-height: 52px;
  }

  .mega-button,
  .file-drop {
    min-height: 150px;
  }

  .result-header,
  .audio-output,
  .handoff-step,
  .copy-field-header {
    align-items: stretch;
    flex-direction: column;
  }

  .handoff-step {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }

  .download-actions {
    width: 100%;
  }
}
