:root {
  color-scheme: light;
  --ink: #1d1c19;
  --muted: #77736b;
  --paper: #fffdf8;
  --background: #f4f1e9;
  --line: rgba(35, 32, 27, .12);
  --line-strong: rgba(35, 32, 27, .2);
  --red: #c9433c;
  --red-dark: #a7312c;
  --red-soft: #f6ded9;
  --green: #42856a;
  --shadow: 0 28px 80px rgba(63, 52, 35, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 13%, rgba(210, 165, 139, .15), transparent 26rem),
    radial-gradient(circle at 90% 34%, rgba(177, 195, 175, .14), transparent 28rem),
    var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { color: inherit; font: inherit; }
a { color: inherit; }

.topbar {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 7px 16px rgba(201, 67, 60, .22);
}

.topbar nav { display: flex; align-items: center; gap: 8px; }
.topbar nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
  text-decoration: none;
  transition: color .18s ease, background .18s ease;
}
.topbar nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }

main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr);
  align-items: center;
  gap: clamp(46px, 8vw, 112px);
  min-height: 590px;
  padding: 72px 0 82px;
}

.eyebrow, .section-kicker {
  margin: 0;
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 18px 0 22px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(48px, 7vw, 78px);
  font-weight: 520;
  letter-spacing: -.065em;
  line-height: 1.03;
}

.hero h1 em { color: var(--red); font-style: normal; }
.hero-description {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 16px;
  line-height: 1.9;
}

.hero-actions { display: flex; align-items: center; gap: 18px; margin-top: 32px; }
.draw-button {
  min-width: 168px;
  height: 48px;
  padding: 0 21px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(29, 28, 25, .18);
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.draw-button:hover { background: #37342f; transform: translateY(-1px); }
.draw-button:disabled { cursor: wait; opacity: .72; transform: none; }
.draw-button svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.draw-button.is-loading svg { animation: spin .9s linear infinite; }
.draw-note { max-width: 170px; color: #8e8980; font-size: 11px; line-height: 1.5; }

.playlist-card {
  position: relative;
  min-width: 0;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 26px;
  background: rgba(255, 253, 248, .76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.cover-shell { position: relative; width: min(82%, 310px); margin: 0 auto 30px; }
.cover-shell::before {
  position: absolute;
  inset: 6% -19% 6% 28%;
  z-index: -1;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #222 0 4px, #161616 5px 7px, #292929 8px 9px);
  box-shadow: 0 18px 42px rgba(20, 18, 15, .2);
  content: '';
}
.cover-shell::after {
  position: absolute;
  top: 50%;
  right: -12%;
  width: 15px;
  height: 15px;
  border: 5px solid #d6d0c6;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
  content: '';
  transform: translateY(-50%);
}
.cover-shell img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  background: linear-gradient(145deg, #d9d0c0, #b9a990);
  object-fit: cover;
  box-shadow: 0 20px 34px rgba(46, 38, 27, .2);
}

.playlist-copy { position: relative; padding-top: 22px; border-top: 1px solid var(--line); }
.playlist-copy > span { color: var(--red-dark); font-size: 9px; font-weight: 760; letter-spacing: .14em; }
.playlist-copy h2 { margin: 7px 0 7px; overflow: hidden; font-family: Georgia, "Songti SC", serif; font-size: 21px; font-weight: 560; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.playlist-copy p { margin: 0; color: var(--muted); font-size: 11px; }
.playlist-copy b { color: var(--ink); font-variant-numeric: tabular-nums; }

.result-section {
  margin-bottom: 72px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  background: rgba(255, 253, 248, .8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.result-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line-strong); }
.result-header h2 { margin: 7px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(25px, 3vw, 34px); font-weight: 540; letter-spacing: -.035em; }
.result-actions { display: flex; align-items: center; gap: 12px; }
.source-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.source-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(66, 133, 106, .11); }
.source-status.is-fallback i { background: #b18445; box-shadow: 0 0 0 4px rgba(177, 132, 69, .11); }
.copy-button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.copy-button:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); background: rgba(255, 255, 255, .7); }
.copy-button:disabled { cursor: default; opacity: .45; }

.player-shell {
  min-height: 88px;
  margin: 18px 0 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(244, 241, 233, .72);
  transition: border-color .2s ease, background .2s ease;
}
.player-shell.is-playing { border-color: rgba(201, 67, 60, .22); background: rgba(255, 255, 255, .7); }
.player-placeholder { min-height: 86px; padding: 16px 20px; display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--muted); }
.player-placeholder[hidden], .player-active[hidden] { display: none; }
.player-placeholder-icon { width: 34px; height: 34px; padding-left: 2px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--red); font-size: 11px; box-shadow: 0 7px 18px rgba(201, 67, 60, .2); }
.player-placeholder > div { display: grid; gap: 3px; }
.player-placeholder strong { color: var(--ink); font-family: Georgia, "Songti SC", serif; font-size: 13px; font-weight: 580; }
.player-placeholder span:last-child { font-size: 10px; }
.player-active { min-height: 86px; display: grid; grid-template-columns: minmax(150px, .58fr) minmax(360px, 1.42fr) 34px; align-items: center; gap: 13px; padding: 0 12px 0 20px; }
.now-playing-copy { min-width: 0; display: grid; gap: 3px; }
.now-playing-label { color: var(--red-dark); font-size: 8px; font-weight: 760; letter-spacing: .14em; }
.now-playing-copy strong, .now-playing-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing-copy strong { font-family: Georgia, "Songti SC", serif; font-size: 13px; font-weight: 600; }
.now-playing-copy small { color: var(--muted); font-size: 9px; }
.now-playing-meta { min-width: 0; display: flex; align-items: center; gap: 7px; }
.now-playing-meta small { min-width: 0; }
.now-playing-meta b {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(66, 133, 106, .2);
  border-radius: 999px;
  color: var(--green);
  background: rgba(66, 133, 106, .07);
  font-size: 7px;
  font-weight: 740;
  letter-spacing: .02em;
  white-space: nowrap;
}
.player-active audio { display: block; width: 100%; min-width: 0; height: 38px; accent-color: var(--red); }
.stop-button { width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; font-size: 19px; line-height: 1; }
.stop-button:hover { color: var(--red-dark); background: var(--red-soft); }

.song-list {
  margin: 0;
  padding: 11px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 36px;
  list-style: none;
}
.song-list.is-loading { display: block; min-height: 320px; }
.empty-state { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); font-size: 12px; }
.loader { width: 25px; height: 25px; border: 2px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }

.song-item {
  min-width: 0;
  height: 86px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  animation: song-in .42s cubic-bezier(.2, .72, .28, 1) both;
  animation-delay: var(--delay);
}
.song-number { color: #a6a198; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; font-variant-numeric: tabular-nums; }
.song-play { min-width: 0; height: 100%; padding: 0; border: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 12px; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.song-play:focus-visible { border-radius: 8px; outline: 2px solid var(--red); outline-offset: 2px; }
.album-cover { position: relative; width: 54px; height: 54px; overflow: hidden; border-radius: 6px; display: grid; place-items: center; color: rgba(255, 255, 255, .8); background: linear-gradient(145deg, #918b7d, #4d4942); font-family: Georgia, serif; font-size: 20px; }
.album-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.play-glyph { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; color: #fff; background: rgba(22, 20, 17, .56); font-family: sans-serif; font-size: 12px; font-style: normal; opacity: 0; transition: opacity .18s ease; }
.song-play:hover .play-glyph, .song-play:focus-visible .play-glyph, .song-item.is-active .play-glyph { opacity: 1; }
.song-item.is-active .song-copy strong { color: var(--red-dark); }
.song-copy { min-width: 0; display: grid; gap: 5px; }
.song-copy strong { overflow: hidden; font-family: Georgia, "Songti SC", serif; font-size: 14px; font-weight: 570; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.song-copy > span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.song-link { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #908b82; text-decoration: none; transition: color .18s ease, background .18s ease, transform .18s ease; }
.song-link > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.song-link svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; }
.song-link:hover { color: var(--red); background: var(--red-soft); transform: translateY(-1px); }

.result-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 24px; }
.result-footer p { margin: 0; color: #908b82; font-size: 10px; line-height: 1.6; }
.text-draw-button { flex: 0 0 auto; padding: 8px 0; border: 0; color: var(--red-dark); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.text-draw-button span { display: inline-block; margin-left: 3px; font-size: 15px; transition: transform .25s ease; }
.text-draw-button:hover:not(:disabled) span { transform: rotate(90deg); }
.text-draw-button:disabled { cursor: default; opacity: .4; }

.page-footer {
  width: min(1120px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 10px;
}
.page-footer a { font-weight: 650; text-decoration: none; }
.page-footer a:hover { color: var(--red-dark); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  padding: 10px 15px;
  border-radius: 999px;
  color: #fff;
  background: rgba(29, 28, 25, .9);
  box-shadow: 0 12px 32px rgba(30, 26, 20, .2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes song-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 54px; min-height: 0; padding-block: 62px; }
  .hero-copy { max-width: 610px; }
  .playlist-card { width: min(100%, 470px); margin: 0 auto; }
  .cover-shell { width: min(72%, 290px); }
  .song-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar, main, .page-footer { width: min(100% - 28px, 1120px); }
  .topbar { min-height: 66px; }
  .brand { font-size: 15px; }
  .topbar nav a:first-child { display: none; }
  .topbar nav a { padding-inline: 6px; }
  .hero { padding: 50px 0 56px; }
  .hero h1 { font-size: clamp(46px, 15vw, 62px); }
  .hero-description { font-size: 14px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 11px; }
  .draw-note { max-width: none; }
  .playlist-card { padding: 22px; border-radius: 22px; }
  .result-section { margin-bottom: 44px; padding: 21px 18px; border-radius: 22px; }
  .result-header { align-items: flex-start; flex-direction: column; gap: 15px; }
  .result-actions { width: 100%; justify-content: space-between; }
  .player-active { grid-template-columns: minmax(0, 1fr) 30px; gap: 5px 10px; padding: 12px; }
  .player-active audio { grid-column: 1 / -1; grid-row: 2; }
  .stop-button { grid-column: 2; grid-row: 1; }
  .song-item { height: 80px; grid-template-columns: 21px minmax(0, 1fr) 28px; gap: 10px; }
  .song-play { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .album-cover { width: 48px; height: 48px; }
  .song-copy strong { font-size: 13px; }
  .song-link { width: 28px; height: 28px; }
  .result-footer { align-items: flex-start; flex-direction: column; }
  .text-draw-button { align-self: flex-end; }
  .page-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
}

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