:root {
  --ink: #271c2b;
  --muted: #796c7c;
  --paper: #fffdfa;
  --panel: rgba(255, 253, 250, .88);
  --rose: #dc617c;
  --rose-dark: #af3f5c;
  --lavender: #8f78b7;
  --line: rgba(55, 31, 59, .11);
  --shadow: 0 22px 60px rgba(61, 31, 66, .13);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f7f1f2;
  font-family: "Microsoft JhengHei UI", "PingFang TC", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.ambient { position: fixed; border-radius: 999px; filter: blur(4px); pointer-events: none; opacity: .5; }
.ambient-one { width: 30rem; height: 30rem; top: 18rem; left: -16rem; background: #f0b5c0; }
.ambient-two { width: 24rem; height: 24rem; right: -10rem; bottom: -7rem; background: #d5c1e6; }

.hero {
  position: relative;
  min-height: 270px;
  color: white;
  background-color: #321d38;
  background-position: center 36%;
  background-size: cover;
  overflow: hidden;
}
.hero-shade { position: absolute; inset: 0; background: linear-gradient(100deg, rgba(31,13,35,.92), rgba(49,24,52,.58) 55%, rgba(26,10,30,.35)); }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 80px; background: linear-gradient(transparent, rgba(24,9,27,.28)); }
.hero-inner { position: relative; z-index: 1; max-width: 1240px; min-height: 270px; margin: auto; padding: 52px 28px; display: flex; align-items: center; gap: 28px; }
.avatar { width: 132px; height: 132px; border-radius: 34px; object-fit: cover; border: 3px solid rgba(255,255,255,.85); box-shadow: 0 15px 35px rgba(0,0,0,.3); background: #eadfe8; }
.identity { flex: 1; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .2em; opacity: .72; }
.identity h1 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(38px, 6vw, 66px); font-weight: 500; letter-spacing: -.04em; }
.hero-copy { margin: 12px 0 0; color: rgba(255,255,255,.78); }
.about-button { padding: 11px 17px; color: white; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; background: rgba(255,255,255,.09); backdrop-filter: blur(8px); }
.about-button:hover { background: rgba(255,255,255,.18); }

.shell { position: relative; z-index: 2; width: min(1240px, calc(100% - 40px)); margin: -24px auto 60px; }
.toolbar { position: sticky; top: 10px; z-index: 12; display: grid; grid-template-columns: minmax(240px, 1fr) 135px 135px 185px auto; gap: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,253,250,.94); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.search-box { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.search-box span { font-size: 25px; color: var(--rose); transform: rotate(-15deg); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; }
kbd { padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #faf7f6; }
select, .random-button { min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; }
.random-button { border-color: var(--rose); color: white; background: var(--rose); font-weight: 700; }
.random-button:hover { background: var(--rose-dark); }
.stats-row { min-height: 54px; display: flex; justify-content: space-between; align-items: center; padding: 0 6px; color: var(--muted); font-size: 14px; }
.stats-row p { margin: 0; }
.stats-row strong { color: var(--ink); font-size: 18px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, .78fr); align-items: start; gap: 18px; }
.song-panel, .lyrics-panel { border: 1px solid rgba(255,255,255,.85); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.song-panel { padding: 8px; }
.song-list { min-height: 440px; }
.song-row { display: grid; grid-template-columns: 44px minmax(0,1.4fr) minmax(100px,.8fr) auto minmax(78px,auto) auto auto auto; gap: 10px; align-items: center; min-height: 70px; padding: 10px 12px; border-bottom: 1px solid var(--line); transition: background .18s, transform .18s; }
.song-row:last-child { border-bottom: 0; }
.song-row:hover, .song-row.active { border-radius: 14px; background: white; transform: translateX(2px); }
.song-number { color: #ad9cae; font-family: Georgia, serif; font-size: 13px; }
.song-name { min-width: 0; }
.song-name strong, .song-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-name strong { font-size: 16px; }
.song-name span { display: none; margin-top: 4px; color: var(--muted); font-size: 13px; }
.song-artist { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.request-data { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.request-count { padding: 3px 7px; border: 0; border-radius: 7px; color: var(--rose-dark); background: #fde8ec; font-size: 12px; font-weight: 800; }
.request-count:not(:disabled):hover { color: white; background: var(--rose); }
.request-count:disabled { color: var(--muted); background: transparent; cursor: default; opacity: .65; }
.request-rate { color: var(--rose-dark); font-size: 11px; }
.tag { padding: 5px 9px; border-radius: 99px; color: #785f7e; background: #f1e9f2; font-size: 11px; white-space: nowrap; }
.lyrics-button { padding: 8px 13px; border: 0; border-radius: 10px; color: var(--rose-dark); background: #fde8ec; font-weight: 800; }
.lyrics-button:hover { color: white; background: var(--rose); }
.clip-button { padding: 8px 12px; border: 0; border-radius: 10px; color: #674c94; background: #eee7fa; font-weight: 800; white-space: nowrap; }
.clip-button:hover { color: white; background: var(--lavender); }
.copy-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; }
.list-message { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 420px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid #eadfe8; border-top-color: var(--rose); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-more { width: 100%; margin-top: 8px; padding: 12px; border: 0; border-radius: 12px; color: var(--muted); background: #f4edef; }
.load-more:hover { color: var(--rose-dark); background: #f9e8ec; }

.lyrics-panel { position: sticky; top: 88px; min-height: 520px; max-height: calc(100vh - 104px); padding: 28px; overflow-x: hidden; overflow-y: auto; }
.close-lyrics { display: none; position: absolute; top: 12px; right: 15px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: #f4edef; font-size: 25px; }
.lyrics-empty { min-height: 460px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted); }
.note-mark { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 50%; color: var(--rose); background: #fde8ec; font-family: Georgia, serif; font-size: 32px; }
.lyrics-empty h2 { margin: 20px 0 8px; color: var(--ink); font-family: Georgia, "Noto Serif TC", serif; font-weight: 500; }
.lyrics-empty p { margin: 0; }
.lyrics-content { height: 100%; }
.sidebar-video { margin: -8px -8px 24px; padding: 12px; border-radius: 17px; background: #211525; box-shadow: 0 14px 32px rgba(38, 19, 42, .2); }
.sidebar-video-label { min-height: 30px; display: flex; justify-content: space-between; align-items: center; padding: 0 3px 8px; color: rgba(255,255,255,.68); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.sidebar-video-label a { color: #f4c4ce; letter-spacing: 0; text-decoration: none; }
.sidebar-video-frame { position: relative; width: 100%; padding-top: 56.25%; overflow: hidden; border-radius: 11px; background: #0e0910; }
.sidebar-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lyrics-heading { padding-right: 25px; border-bottom: 1px solid var(--line); }
.lyrics-heading h2 { margin: 0; font-family: inherit; font-size: 28px; font-weight: 700; }
.lyrics-heading > p:last-child { margin: 7px 0 20px; color: var(--muted); }
.lyrics-status { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 280px; color: var(--muted); text-align: center; line-height: 1.8; }
.lyrics-status[hidden] { display: none !important; min-height: 0; height: 0; margin: 0; padding: 0; }
.lyrics-lines { padding: 24px 4px 45px; white-space: pre-wrap; font-family: Georgia, "Noto Serif TC", serif; font-size: 17px; line-height: 2.15; }
.lyrics-source { margin: -32px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); color: var(--muted); background: var(--paper); font-size: 11px; }

.about-dialog { width: min(560px, calc(100% - 32px)); padding: 34px; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 90px rgba(32,13,36,.3); }
.request-dialog { width: min(720px, calc(100% - 24px)); max-height: min(780px, calc(100vh - 40px)); padding: 30px; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 90px rgba(32,13,36,.3); }
.request-dialog::backdrop { background: rgba(30,14,33,.55); backdrop-filter: blur(5px); }
.request-dialog h2 { margin: 0; font-size: 30px; }
.request-dialog-summary { margin: 7px 0 20px; color: var(--rose-dark); font-weight: 700; }
.request-history { display: grid; gap: 9px; }
.request-history-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fffafa; }
.request-history-item.cooldown-excluded { border-color: #d8c8ed; background: #f2ebfa; }
.cooldown-label { display: inline-block; margin-top: 7px; padding: 3px 8px; border-radius: 999px; color: #725398; background: #e4d7f4; font-size: 11px; font-weight: 800; }
.request-history-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; }
.request-history-heading time { margin-left: auto; color: var(--muted); font-size: 12px; }
.request-user-id { color: var(--muted); font-size: 11px; }
.request-message { margin: 7px 0 0; }
.request-live { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.about-dialog::backdrop { background: rgba(30,14,33,.55); backdrop-filter: blur(5px); }
.about-dialog h2 { margin: 0 0 20px; font-family: Georgia, serif; font-size: 30px; }
.about-dialog #profileDescription { color: var(--muted); line-height: 1.8; }
.dialog-close { position: absolute; top: 12px; right: 14px; border: 0; color: var(--muted); background: transparent; font-size: 28px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; padding: 11px 18px; border-radius: 999px; color: white; background: #2e2031; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 880px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .content-grid { display: block; }
  .lyrics-panel { position: fixed; z-index: 15; inset: auto 0 0; max-height: 82vh; min-height: 58vh; border-radius: 24px 24px 0 0; transform: translateY(105%); transition: transform .28s ease; }
  .lyrics-panel.open { transform: translateY(0); }
  .lyrics-panel.open::before { content: ""; position: fixed; z-index: -1; inset: -100vh 0 100%; background: rgba(30,14,33,.45); }
  .close-lyrics { display: block; }
  .lyrics-lines { padding-bottom: 30px; }
}

@media (max-width: 600px) {
  .hero, .hero-inner { min-height: 230px; }
  .hero-inner { align-items: flex-end; padding: 34px 20px 42px; gap: 16px; }
  .avatar { width: 80px; height: 80px; border-radius: 22px; }
  .identity h1 { font-size: 36px; }
  .hero-copy, .about-button { display: none; }
  .shell { width: min(100% - 20px, 1240px); margin-top: -20px; }
  .toolbar { top: 6px; grid-template-columns: 1fr 1fr; padding: 10px; border-radius: 17px; }
  select, .random-button { min-width: 0; font-size: 13px; }
  .hint { display: none; }
  .song-row { grid-template-columns: 30px minmax(0,1fr) auto auto auto; gap: 8px; padding: 9px 7px; }
  .song-name span { display: block; }
  .song-artist, .tag { display: none; }
  .request-data { min-width: 62px; }
  .lyrics-button { padding: 8px 10px; }
  .clip-button { grid-column: 2 / 3; width: max-content; margin-top: -3px; padding: 7px 10px; }
  .copy-button { width: 32px; }
  .lyrics-panel { padding: 26px 20px; }
}

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