/* ============================================================
   此刻有歌 · Music For This Moment
   ============================================================ */
:root {
  --grad-warm: linear-gradient(160deg, #ffd6a5 0%, #f6a582 34%, #e58a86 58%, #9a7bb5 82%, #6d6aa0 100%);
  --grad-btn: linear-gradient(90deg, #ffb27a 0%, #f58d7d 55%, #ef7f8f 100%);
  --grad-share: linear-gradient(90deg, #f79d7e 0%, #b47bc0 100%);
  --ink: #4a3f47;
  --ink-soft: #6f6470;
  --ink-faint: #9b90a0;
  --brand: #d95f74;
  --white-glass: rgba(255,255,255,.42);
  --white-glass-strong: rgba(255,255,255,.62);
  --line: rgba(120,100,110,.5);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 16px;
  --shadow-card: 0 18px 44px -20px rgba(90,60,80,.45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #1a1526;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; }

/* 应用容器：居中的手机视口 */
.app {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #2a2036;
  box-shadow: 0 0 80px rgba(0,0,0,.4);
}

/* ---------- 屏幕基础 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 22px) 22px calc(var(--safe-bottom) + 18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.is-active { opacity: 1; visibility: visible; pointer-events: auto; }

.screen__bg {
  position: absolute;
  inset: 0;
  background: var(--grad-warm);
  z-index: 0;
}
.screen__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(255,220,180,.55), transparent 60%),
    radial-gradient(120% 60% at 90% 100%, rgba(110,106,160,.55), transparent 55%);
  mix-blend-mode: screen;
}
.screen__bg--light { background: linear-gradient(155deg,#f6ede6 0%,#f3d9c6 40%,#c9a4c6 72%,#8f7ec0 100%); }

.screen > *:not(.screen__bg) { position: relative; z-index: 1; }

/* 毛玻璃卡片 */
.glass {
  background: var(--white-glass);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   屏 1：主页
   ============================================================ */
.home__title { text-align: center; margin: auto 0; flex: 0 0 auto; }
.home__title-eyebrow {
  font-size: 12px; letter-spacing: 4px; text-transform: uppercase;
  color: rgba(120,72,60,.72); font-weight: 600; margin-bottom: 10px;
}
.home__title-main {
  font-family: Georgia, 'Songti SC', 'STSong', 'Noto Serif SC', serif;
  font-size: 52px; font-weight: 700; letter-spacing: 10px;
  padding-left: 10px; /* 抵消末字右侧字距，视觉居中 */
  line-height: 1.15;
  /* 深暖色渐变，在浅色背景上保证对比度 */
  background: linear-gradient(120deg,#5a3324 0%,#9e4d38 42%,#b8604a 62%,#6b3a28 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: 0 2px 10px rgba(255,255,255,.35);
}
.home__title-rule {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 14px auto 12px; width: 168px;
}
.home__title-rule span {
  flex: 1 1 auto; height: 1px;
  background: linear-gradient(90deg,transparent,rgba(120,72,60,.5));
}
.home__title-rule span:last-child { background: linear-gradient(90deg,rgba(120,72,60,.5),transparent); }
.home__title-rule i {
  font-style: normal; font-size: 13px; color: rgba(120,72,60,.85);
}
.home__title-sub {
  font-size: 16px; color: rgba(90,56,44,.9); letter-spacing: 3px; font-weight: 400;
}

.home__panel {
  margin-top: auto;
  border-radius: var(--radius-lg);
  padding: 18px;
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 上传区 —— 固定尺寸，上传前后不变 */
.uploader {
  position: relative;
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.35);
  overflow: hidden;
  flex: 0 0 auto;
  aspect-ratio: 16 / 10;
  transition: border-color .3s, background .3s;
}
.uploader:active { background: rgba(255,255,255,.5); }
.uploader__placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--ink-soft);
}
.uploader__text { font-size: 17px; font-weight: 500; }
.uploader__preview {
  width: 100%; height: 100%; object-fit: cover; opacity: 0; display: none;
}
.uploader.has-photo .uploader__preview { display: block; opacity: 1; }
.uploader.has-photo .uploader__placeholder { display: none; }
.uploader.has-photo { border-style: solid; border-color: transparent; }
.uploader__clear {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 20px;
  line-height: 1; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.uploader.has-photo .uploader__clear { display: flex; }

/* 场景标签 —— 次要快捷项，固定两行、轻量化不抢焦点 */
.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 16px; flex: 0 0 auto;
}
.chip {
  padding: 8px 4px; border-radius: 8px; font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(150,110,100,.28);
  white-space: nowrap; text-align: center;
  transition: transform .18s, background .25s, color .25s, border-color .25s;
}
.chip:active { transform: scale(.94); }
.chip.is-selected {
  background: rgba(239,127,143,.14);
  color: var(--brand);
  border-color: rgba(239,127,143,.6);
  font-weight: 600;
}

/* 心情输入 */
/* 心情输入 —— 实心白卡，区别于虚线上传区 */
.feeling { position: relative; margin-top: 16px; flex: 0 0 auto; height: 88px; display: flex; }
.feeling__icon {
  position: absolute; left: 14px; top: 14px; color: var(--brand);
  opacity: .8; pointer-events: none;
}
.feeling__input {
  width: 100%; height: 100%; resize: none;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217,95,116,.22);
  background: rgba(255,255,255,.82);
  box-shadow: inset 0 1px 3px rgba(120,80,90,.08);
  padding: 14px 16px 32px 38px;
  font-size: 14px; line-height: 1.6; color: var(--ink);
  outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.feeling__input::placeholder { color: var(--ink-faint); }
.feeling__input:focus {
  background: #fff;
  border-color: rgba(217,95,116,.55);
  box-shadow: 0 0 0 3px rgba(239,127,143,.14);
}
.feeling__count {
  position: absolute; right: 14px; bottom: 12px;
  font-size: 13px; color: var(--ink-faint);
}
.home__hint { margin-top: 12px; text-align: center; font-size: 14px; color: var(--ink-soft); flex: 0 0 auto; }

/* 主按钮 */
.home__cta-wrap { margin-top: 18px; padding-top: 4px; flex: 0 0 auto; }
.btn-primary {
  width: 100%; height: 60px; border-radius: 999px; border: 0;
  background: var(--grad-btn); color: #fff;
  font-size: 20px; font-weight: 700; letter-spacing: 2px;
  box-shadow: 0 14px 30px -12px rgba(239,127,143,.9);
  transition: transform .18s, box-shadow .3s, background .3s, color .3s, opacity .3s;
}
.btn-primary:active { transform: scale(.97); }
/* 未上传照片 —— 柔和「待命」外观，中性色不突兀 */
.btn-primary:disabled {
  background: rgba(255,255,255,.45);
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 1.5px rgba(120,100,110,.28);
  cursor: not-allowed;
  transform: none;
  filter: none; opacity: 1;
}

/* ============================================================
   屏 2：等待页
   ============================================================ */
.screen--loading { align-items: center; justify-content: center; }
.loading__center { text-align: center; display: flex; flex-direction: column; align-items: center; }

.loading__disc { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.loading__disc-ring, .loading__disc-ring--2 {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4);
}
.loading__disc-ring--2 { inset: 18px; border-color: rgba(255,255,255,.28); }
.loading__disc-core {
  width: 78px; height: 78px; border-radius: 50%;
  background: rgba(255,255,255,.85); color: #ef7f8f;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px -8px rgba(200,90,110,.6);
}

.loading__wave { display: flex; align-items: flex-end; gap: 5px; height: 46px; margin-top: 34px; }
.loading__wave span {
  width: 5px; border-radius: 3px; background: rgba(255,255,255,.9);
  height: 12px;
}

.loading__title { margin-top: 30px; font-size: 22px; font-weight: 600; color: #fff; }
.loading__sub { margin-top: 10px; font-size: 15px; color: rgba(255,255,255,.85); }

/* ============================================================
   屏 3：推荐页
   ============================================================ */
.screen--recommend { padding-top: calc(var(--safe-top) + 14px); }
.rec-header { display: flex; align-items: center; position: relative; height: 44px; flex: 0 0 auto; margin-bottom: 8px; }
.rec-header__back { color: var(--ink); padding: 6px; margin-left: -6px; }
.rec-header__title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 21px; font-weight: 600; color: var(--ink); pointer-events: none;
}

.rec-scroll { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 2px 0; display: flex; flex-direction: column; min-height: 0; }

/* 此刻语境 —— 无卡片背景，直接呈现文字与封面 */
.echo {
  display: flex; align-items: center; gap: 20px;
  padding: 8px 4px; margin-bottom: 16px;
  flex: 1 1 auto; min-height: 92px; max-height: 150px;
}
.echo__cover { width: 88px; height: 88px; border-radius: 18px; object-fit: cover; flex: 0 0 auto; background: rgba(255,255,255,.4); box-shadow: 0 8px 20px -10px rgba(120,70,80,.45); }
.echo__text { flex: 1 1 auto; min-width: 0; }
.echo__label { font-size: 25px; font-weight: 700; color: var(--ink); letter-spacing: 1px; }
.echo__desc { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }

/* 主推卡片 —— 整卡可点选 */
.main-pick { border-radius: var(--radius-lg); padding: 16px; position: relative; flex: 0 0 auto; cursor: pointer; transition: transform .18s; }
.main-pick:active { transform: scale(.985); }
.main-pick__body { display: flex; gap: 16px; align-items: center; }
.main-pick__cover {
  width: 112px; height: 112px; border-radius: 16px; object-fit: cover;
  flex: 0 0 auto; background: rgba(255,255,255,.4);
  box-shadow: 0 8px 20px -8px rgba(120,70,80,.5);
}
.main-pick__info { flex: 1 1 auto; padding-top: 2px; }
.main-pick__title { font-size: 25px; font-weight: 700; color: var(--ink); }
.main-pick__artist { margin-top: 4px; font-size: 16px; color: var(--ink-soft); }
.main-pick__reason { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

/* 延展推荐 —— 标题与列表贴近，整卡可点选 */
.rec-sub-title { margin: 14px 4px 8px; font-size: 20px; font-weight: 700; color: var(--ink); flex: 0 0 auto; }
.ext-list { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; }
.ext-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--white-glass); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--radius-md); padding: 10px;
  box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform .18s;
}
.ext-card:active { transform: scale(.98); }
.ext-card__cover { width: 62px; height: 62px; border-radius: 14px; object-fit: cover; flex: 0 0 auto; background: rgba(255,255,255,.4); }
.ext-card__info { flex: 1 1 auto; min-width: 0; }
.ext-card__title { font-size: 18px; font-weight: 700; color: var(--ink); }
.ext-card__artist { margin-top: 2px; font-size: 13px; color: var(--ink-soft); }
.ext-card__reason { margin-top: 4px; font-size: 13px; color: var(--ink-soft); line-height: 1.35; }

/* ============================================================
   屏 4：歌曲卡片页
   ============================================================ */
.screen--card { padding-top: calc(var(--safe-top) + 14px); align-items: center; }
.card-page__header { display: flex; align-items: center; position: relative; height: 40px; width: 100%; flex: 0 0 auto; }
.card-page__back { color: var(--ink); padding: 6px; margin-left: -6px; }
.card-page__title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 22px; font-weight: 700; color: var(--ink); pointer-events: none;
}

/* 分享卡片本体（可截图区域） */
.share-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  margin-top: 22px;
  box-shadow: 0 26px 60px -24px rgba(70,40,80,.6);
  display: flex;
  flex-direction: column;
  color: #fff;
  flex: 1 1 auto;
  min-height: 0;
}
.share-card__bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
}
.share-card__overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(30,20,40,.28) 0%, rgba(30,20,40,.05) 32%, rgba(30,20,40,.12) 62%, rgba(20,12,30,.7) 100%);
}
.share-card > *:not(.share-card__bg):not(.share-card__overlay) { position: relative; z-index: 2; }

.share-card__top { display: flex; align-items: center; gap: 14px; padding: 20px 20px 0; }
.share-card__cover {
  width: 64px; height: 64px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 8px 18px -6px rgba(0,0,0,.5); flex: 0 0 auto; background: rgba(255,255,255,.2);
}
.share-card__song { font-size: 24px; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.share-card__artist { margin-top: 4px; font-size: 15px; opacity: .9; }

.share-card__quote {
  margin: auto 22px; padding: 24px 0;
  font-size: 30px; font-weight: 700; line-height: 1.4;
  text-shadow: 0 2px 14px rgba(0,0,0,.35);
}

.share-card__bottom { padding: 0 20px 20px; }
.share-card__player { display: flex; align-items: center; gap: 10px; }
.sc-play {
  width: 14px; height: 14px; flex: 0 0 auto; color: rgba(255,255,255,.72); padding: 0; margin: 0; border: 0; background: none;
  display: grid; place-items: center; position: relative;
}
.sc-play__play, .sc-play__pause { display: block; margin: 0; width: 14px; height: 14px; }
/* 播放时按钮外扩呼吸光环，让操作有「正在响」的动感 */
.sc-play::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.55); opacity: 0; transform: scale(.7);
}
.sc-play.is-playing::before { animation: sc-play-ring 1.6s ease-out infinite; }
@keyframes sc-play-ring {
  0%   { opacity: .55; transform: scale(.7); }
  70%  { opacity: 0;   transform: scale(1.5); }
  100% { opacity: 0;   transform: scale(1.5); }
}
.sc-play__pause { display: none; }
.sc-play.is-playing .sc-play__play { display: none; }
.sc-play.is-playing .sc-play__pause { display: block; }
.sc-track {
  position: relative; width: 62px; height: 2.5px; border-radius: 3px;
  background: rgba(255,255,255,.35); flex: 0 0 auto;
}
.sc-track__fill {
  position: absolute; left: 0; top: 0; height: 100%; width: 30%; border-radius: 3px;
  background: linear-gradient(90deg,#ffd6a5,rgba(255,255,255,.85));
  background-size: 200% 100%;
}
.sc-track__fill.is-playing { animation: sc-fill-shimmer 1.4s linear infinite; }
@keyframes sc-fill-shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}
.sc-track__dot {
  position: absolute; top: 50%; left: 30%; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.88); margin: -3.5px 0 0 -3.5px;
}
.sc-wave { display: flex; align-items: center; gap: 2.5px; height: 24px; flex: 0 1 auto; width: 120px; overflow: hidden; }
.sc-wave span {
  width: 2.5px; border-radius: 3px; height: 7px;
  background: linear-gradient(180deg,#ffd6a5,#ef7f8f);
}

.share-card__foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-top: 16px;
}
/* 左列：播放条在上、落款品牌在下，二维码在其右侧 */
.share-card__foot-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.share-card__brand { font-size: 13px; opacity: .82; letter-spacing: .3px; }
.share-card__qr {
  width: 56px; height: 56px; flex: 0 0 auto; border-radius: 8px;
  background: rgba(255,255,255,.16); padding: 5px;
  display: grid; place-items: center; overflow: hidden;
  opacity: .5;
}
.share-card__qr img, .share-card__qr canvas {
  width: 100% !important; height: 100% !important;
  /* 二维码本体调淡、与卡片背景更贴合，弱化存在感 */
  opacity: .78; mix-blend-mode: luminosity;
}

/* 操作按钮 */
.card-page__actions {
  display: flex; gap: 14px; width: 100%; max-width: 340px; margin-top: 20px; flex: 0 0 auto;
}
.btn-save, .btn-share {
  flex: 1 1 0; height: 56px; border-radius: 999px; font-size: 18px; font-weight: 700;
  transition: transform .18s;
}
.btn-save { background: var(--grad-share); color: #fff; box-shadow: 0 12px 26px -12px rgba(180,100,150,.9); }
.btn-share {
  background: rgba(255,255,255,.7); color: #b06ac0;
  border: 1.5px solid #c78fd0;
}
.btn-save:active, .btn-share:active { transform: scale(.96); }
.card-page__regen {
  margin-top: 16px; font-size: 17px; color: var(--ink); font-weight: 500; padding: 6px;
  flex: 0 0 auto;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: rgba(30,20,40,.9); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 15px; z-index: 999; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; backdrop-filter: blur(8px); max-width: 80%; text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
