:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --primary: #25d4d0;
  --primary-dark: #0fb7b3;
  --text: #282828;
  --body: #474747;
  --muted: #a7a7ad;
  --line: #ededf1;
  --surface: #f7f7f8;
  --pink: #ffe6eb;
  --blue: #dff4ff;
  --orange: #ff7a22;
  --player: #3f4c60;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #edf0f4;
  color: var(--text);
  overflow: auto;
}

button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.demo-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.demo-steps {
  width: min(430px, calc(100vw - 24px));
  height: 46px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 8px;
}

.step-chip {
  min-width: 0;
  height: 34px;
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7b808b;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.step-chip span {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: 3px;
  border-radius: 50%;
  background: #e8eaee;
  font-size: 10px;
}

.step-chip.active { background: #e9fffd; color: #067f7c; font-weight: 600; }
.step-chip.active span { background: var(--primary); color: white; }

.reset-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 6px;
  background: #f1f2f5;
  color: #626875;
  cursor: pointer;
}
.reset-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.phone {
  position: relative;
  width: min(430px, calc(100vw - 24px));
  height: auto;
  min-height: 0;
  aspect-ratio: 430 / 932;
  border: 8px solid #111319;
  border-radius: 42px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(31, 37, 48, .18);
  overflow: hidden;
}

.dynamic-island {
  position: absolute;
  z-index: 30;
  top: 10px;
  left: 50%;
  width: 112px;
  height: 31px;
  transform: translateX(-50%);
  border-radius: 18px;
  background: #050608;
  pointer-events: none;
}

.phone-screen { width: 100%; height: 100%; background: #fff; overflow: hidden; }
.screen { height: 100%; display: flex; flex-direction: column; animation: screen-in .28s ease both; }
.screen.player-screen { color: white; background: var(--player); }

@keyframes screen-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

.status-bar {
  height: 45px;
  flex: 0 0 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 21px 0;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 5;
}
.status-icons { display: flex; align-items: center; gap: 5px; }
.status-icons i { display: block; background: currentColor; }
.signal { width: 15px; height: 10px; clip-path: polygon(0 100%,0 70%,18% 70%,18% 50%,38% 50%,38% 30%,58% 30%,58% 10%,78% 10%,78% 0,100% 0,100% 100%); }
.wifi { width: 13px; height: 9px; border: 2px solid currentColor; border-left-color: transparent; border-right-color: transparent; border-bottom-color: transparent; border-radius: 50%; background: none !important; }
.battery { width: 19px; height: 9px; border-radius: 2px; position: relative; }
.battery::after { content: ""; position: absolute; right: -3px; top: 2px; width: 2px; height: 5px; border-radius: 1px; background: currentColor; }

.nav-bar {
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 0 9px;
  border-bottom: .5px solid var(--line);
}
.nav-title { text-align: center; font-size: 16px; font-weight: 600; }
.nav-title small { display: block; margin-top: 2px; color: #9b9ba2; font-size: 10px; font-weight: 400; }
.icon-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: inherit; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat-body { flex: 1; min-height: 0; padding: 20px 16px; overflow-y: auto; background: #fff; }
.timestamp { text-align: center; color: #b1b1b6; font-size: 11px; margin-bottom: 14px; }
.message-row { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0; }
.message-row.mine { justify-content: flex-end; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 34px; font-size: 18px; }
.avatar.a { background: #ffdce5; }
.avatar.b { background: #dceeff; }
.bubble { max-width: 75%; padding: 11px 13px; border-radius: 8px; font-size: 15px; line-height: 1.4; }
.bubble.a { background: var(--pink); }
.bubble.b { background: var(--blue); }

.composer {
  flex: 0 0 auto;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: .5px solid var(--line);
}
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-field { height: 42px; flex: 1; display: flex; align-items: center; padding: 0 13px; border-radius: 22px; background: #f5f6f7; color: #b4b5ba; font-size: 14px; }
.plus-button { width: 42px; height: 42px; border: 1px solid #cfd2d8; border-radius: 50%; background: #fff; font-size: 28px; font-weight: 300; line-height: 1; cursor: pointer; transition: transform .2s ease, border-color .2s ease; }
.plus-button.pulse { animation: pulse 1.5s infinite; border-color: var(--primary); color: var(--primary-dark); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(37,212,208,.28); } 50% { box-shadow: 0 0 0 10px rgba(37,212,208,0); } }

.action-sheet {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .32s ease, opacity .24s ease, padding .32s ease;
  padding: 0;
}
.action-sheet.open { max-height: 248px; opacity: 1; padding: 16px 2px 5px; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px 6px; }
.action-item { border: 0; background: transparent; display: grid; justify-items: center; gap: 6px; color: #555b66; font-size: 11px; cursor: pointer; }
.action-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: #f6f6f7; font-size: 22px; }
.action-item.music .action-icon { color: #087d79; background: #e7fffd; outline: 2px solid var(--primary); animation: pulse 1.4s infinite; }

.form-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: #fff; }
.section-label { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.scene-list { display: grid; gap: 9px; }
.scene-option { width: 100%; min-height: 68px; border: 1px solid #eeeef1; border-radius: 8px; background: #fff; display: grid; grid-template-columns: 50px 1fr 24px; align-items: center; gap: 10px; padding: 9px; text-align: left; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.scene-option:active { transform: scale(.99); }
.scene-option.selected { border: 2px solid var(--primary); background: #f4fffe; }
.scene-visual { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #fff1e9; font-size: 23px; }
.scene-copy strong { display: block; margin-bottom: 4px; font-size: 14px; }
.scene-copy span { color: #90939b; font-size: 11px; }
.checkmark { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: white; opacity: 0; }
.scene-option.selected .checkmark { opacity: 1; }

.prompt-area { margin-top: 14px; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.prompt-box { position: relative; }
.prompt-box textarea { width: 100%; height: 105px; resize: none; border: 1px solid #dedfe4; border-radius: 8px; padding: 12px 13px 24px; color: var(--text); background: #fff; font-size: 14px; line-height: 1.55; outline: none; }
.prompt-box textarea:focus { border-color: var(--primary); }
.char-count { position: absolute; right: 10px; bottom: 8px; color: #a4a6ad; font-size: 10px; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.prompt-chip { border: 1px solid #91e4e1; border-radius: 18px; background: #fff; color: #43827f; padding: 8px 11px; font-size: 11px; cursor: pointer; transition: background .18s, color .18s; }
.prompt-chip:hover, .prompt-chip.active { background: #e8fffd; color: #087d79; }

.bottom-action { flex: 0 0 auto; padding: 12px 16px calc(13px + env(safe-area-inset-bottom)); border-top: .5px solid var(--line); background: #fff; }
.primary-button, .secondary-button { height: 48px; border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; }
.primary-button { width: 100%; border: 0; background: var(--primary); color: #fff; }
.primary-button:disabled { background: #ededed; color: #c1c1c1; cursor: default; }
.secondary-button { border: 1px solid #dcdfe4; background: #fff; color: #464b56; }

.generating {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  animation: fade-in .2s ease both;
}
.generating-card { width: 78%; text-align: center; }
.generating-disc { width: 106px; height: 106px; margin: 0 auto 22px; border-radius: 50%; background: repeating-radial-gradient(circle, #1b1c22 0 5px, #111218 6px 9px); display: grid; place-items: center; animation: spin 1.7s linear infinite; }
.generating-disc::after { content: ""; width: 28px; height: 28px; border-radius: 50%; background: #f68492; border: 5px solid #f6b2bb; }
.generating h2 { margin: 0 0 8px; font-size: 20px; }
.generating p { margin: 0 0 22px; color: #858992; font-size: 13px; }
.loading-track { width: 100%; height: 7px; border-radius: 5px; background: #e6e8ec; overflow: hidden; }
.loading-fill { height: 100%; border-radius: inherit; background: var(--primary); transition: width .12s linear; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.player-nav { border: 0; }
.player-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 4px 20px 12px; }
.creator-line { margin: 2px 0 5px; color: #e5eaf0; font-size: 13px; }
.track-title { margin: 0; font-size: 26px; font-weight: 650; }
.gramophone-stage { position: relative; width: min(310px, 78vw); aspect-ratio: 1 / 1.12; margin: 8px auto 0; overflow: hidden; border-radius: 8px; background: #93a2af; }
.gramophone-stage img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.gramophone-stage.playing { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.012); } }
.record-overlay { position: absolute; left: 50%; top: 67%; width: 106px; height: 106px; transform: translate(-50%,-50%); border-radius: 50%; background: repeating-radial-gradient(circle, rgba(13,14,18,.98) 0 4px, rgba(35,36,42,.98) 5px 7px); box-shadow: 0 4px 9px rgba(0,0,0,.28); }
.record-overlay::after { content: ""; position: absolute; inset: 37px; border-radius: 50%; background: #f2808c; border: 4px solid #f2abb4; }
.gramophone-stage.playing .record-overlay { animation: spin 1.8s linear infinite; }

.progress-area { width: 100%; margin-top: 8px; }
.progress-times { display: flex; justify-content: space-between; margin-top: 6px; color: #d6dce3; font-size: 10px; }
.progress-slider { width: 100%; accent-color: var(--primary); cursor: pointer; }
.player-controls { display: flex; align-items: center; gap: 34px; margin: 7px 0 10px; }
.player-controls button { border: 0; background: transparent; color: white; cursor: pointer; }
.play-main { width: 64px; height: 64px; border: 2px solid rgba(255,255,255,.36) !important; border-radius: 50%; display: grid; place-items: center; font-size: 26px; }
.skip { font-size: 25px; }
.player-actions { width: 100%; display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; margin-top: auto; }
.regen-button { position: relative; padding: 0 37px 0 14px; }
.coin { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: #f6b32b; color: #fff; font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 2px #ffd875; }

.sheet-backdrop { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.55); animation: fade-in .2s ease both; }
.pay-sheet { position: absolute; z-index: 41; left: 10px; right: 10px; bottom: 10px; border-radius: 16px; background: white; color: var(--text); padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .26s ease both; }
@keyframes sheet-up { from { transform: translateY(105%); } to { transform: translateY(0); } }
.pay-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; }
.coin-large { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: white; font-weight: 700; }
.pay-sheet p { margin: 13px 0 18px; color: #717680; font-size: 13px; line-height: 1.5; }
.pay-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }
.pay-actions button { height: 46px; border-radius: 23px; font-weight: 600; cursor: pointer; }
.pay-cancel { border: 1px solid #dddfe4; background: white; }
.pay-confirm { border: 0; background: var(--orange); color: white; }

.gift-message { width: 190px; padding: 8px; border-radius: 8px; animation: gift-in .42s cubic-bezier(.2,.8,.2,1) both; }
.message-row.mine .gift-message { background: var(--blue); }
.message-row:not(.mine) .gift-message { background: var(--pink); }
@keyframes gift-in { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
.gift-media { position: relative; height: 116px; overflow: hidden; border-radius: 7px; background: #94a3ae; }
.gift-media img { width: 100%; height: 100%; object-fit: cover; object-position: center 56%; }
.gift-media::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.04); }
.gift-caption { display: flex; align-items: center; gap: 8px; padding: 8px 3px 2px; font-size: 12px; line-height: 1.3; }
.mini-play { width: 28px; height: 28px; flex: 0 0 28px; border: 0; border-radius: 50%; background: white; display: grid; place-items: center; cursor: pointer; color: #333; }
.mini-play.playing { background: var(--primary); color: white; }
.wave { display: flex; align-items: center; gap: 2px; height: 14px; margin-top: 3px; }
.wave i { width: 2px; height: 4px; border-radius: 2px; background: currentColor; opacity: .45; }
.mini-play.playing + div .wave i { animation: wave .7s ease-in-out infinite alternate; }
.wave i:nth-child(2) { animation-delay: .12s !important; }
.wave i:nth-child(3) { animation-delay: .24s !important; }
.wave i:nth-child(4) { animation-delay: .36s !important; }
@keyframes wave { to { height: 13px; opacity: 1; } }

.delivery-note { margin: 14px auto 0; width: fit-content; border: 0; border-radius: 18px; background: #e9fffd; color: #087d79; padding: 9px 15px; font-size: 12px; cursor: pointer; animation: rise .3s .25s ease both; }
.toast { position: absolute; z-index: 50; left: 50%; bottom: 95px; transform: translateX(-50%); padding: 10px 16px; border-radius: 20px; background: rgba(25,28,34,.9); color: #fff; font-size: 12px; white-space: nowrap; animation: toast .25s ease both; }
@keyframes toast { from { opacity: 0; transform: translate(-50%,8px); } to { opacity: 1; transform: translate(-50%,0); } }

.home-indicator { height: 19px; flex: 0 0 19px; display: grid; place-items: start center; background: inherit; }
.home-indicator::after { content: ""; display: block; width: 134px; height: 5px; border-radius: 5px; background: currentColor; opacity: .95; }

.demo-hint { width: min(430px, calc(100vw - 24px)); margin: 0; text-align: center; color: #686e7a; font-size: 13px; }

#songAudio { display: none; }

@media (max-width: 600px) {
  body { background: #fff; overflow: hidden; }
  .demo-layout { display: block; padding: 0; }
  .demo-steps { position: fixed; z-index: 90; left: 7px; right: 7px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: 42px; border-radius: 8px; box-shadow: 0 8px 25px rgba(25,30,40,.16); opacity: .92; }
  .step-chip { font-size: 0; }
  .step-chip span { margin: 0; }
  .reset-button { width: 31px; height: 31px; flex-basis: 31px; }
  .phone { width: 100vw; height: 100dvh; min-height: 0; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
  .dynamic-island { top: 10px; }
  .demo-hint { display: none; }
  .composer { padding-bottom: 58px; }
  .bottom-action { padding-bottom: 60px; }
  .player-main { padding-bottom: 54px; }
  .pay-sheet { bottom: 52px; }
}

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