/* karaokeking.art - "纸面歌词" 设计体系
   浅色:奶油纸张 + 朱红/蜜橙点缀;深色:暖墨纸页 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --paper: #F5F0E6;
  --paper-2: #EEE5D6;
  --card: #FFF9EE;
  --ink: #292624;
  --muted: #756A5D;
  --faint: #A79A8A;
  --accent: #C94F4F;
  --accent-2: #3E6873;
  --secondary: #D99A52;
  --accent-light: rgba(201, 79, 79, 0.10);
  --border: #D8CCB8;
  --pill: #E8DDCB;
  --grad: linear-gradient(90deg, #C94F4F, #D99A52);
  --glow: 0 6px 18px rgba(201, 79, 79, 0.28);
  --glow-strong: 0 8px 26px rgba(201, 79, 79, 0.42);
  --shadow-card: 0 16px 36px rgba(41, 38, 36, 0.10);
  --shadow-soft: 0 4px 14px rgba(41, 38, 36, 0.06);
  --font-display: "M PLUS Rounded 1c", "ZCOOL KuaiLe", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-romaji: "Zen Maru Gothic", "M PLUS Rounded 1c", sans-serif;
  --font-cn: "ZCOOL KuaiLe", "Microsoft YaHei", "PingFang SC", sans-serif;
}

[data-theme="dark"] {
  --paper: #211D18;
  --paper-2: #1A1712;
  --card: #2C261F;
  --ink: #F2ECE1;
  --muted: #B3A695;
  --faint: #857868;
  --accent: #E06A5F;
  --accent-2: #7FA8B3;
  --secondary: #D99A52;
  --accent-light: rgba(224, 106, 95, 0.16);
  --border: #4A4036;
  --pill: #3D362D;
  --grad: linear-gradient(90deg, #E06A5F, #D99A52);
  --glow: 0 6px 18px rgba(224, 106, 95, 0.30);
  --glow-strong: 0 8px 26px rgba(224, 106, 95, 0.45);
  --shadow-card: 0 16px 36px rgba(0, 0, 0, 0.40);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.30);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: linear-gradient(135deg, var(--paper), var(--paper-2));
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

::selection {
  background: rgba(201, 79, 79, 0.25);
}

/* 背景氛围:两团静态色晕(青绿右上、朱红左下) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(420px 420px at 88% 4%, rgba(62, 104, 115, 0.14), transparent 65%),
    radial-gradient(360px 360px at 8% 92%, rgba(201, 79, 79, 0.10), transparent 68%);
}

.container {
  max-width: 1296px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 顶部导航 ---------- */
.topnav {
  max-width: 1296px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand-jp {
  margin-left: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 22px;
  font-size: 14px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-active {
  color: var(--accent);
  font-weight: 600;
}

.nav-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.nav-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
}

.nav-icon:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: var(--accent);
}

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.caps {
  font-size: 11px;
  letter-spacing: 1.6px;
  color: var(--faint);
  font-weight: 500;
  margin-bottom: 10px;
}

.btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-cn);
  border-radius: 999px;
  border: none;
  background: var(--pill);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  color: var(--ink);
}

.btn.active {
  background: var(--accent);
  color: var(--card);
  font-weight: 700;
  box-shadow: var(--glow);
}

.btn.active:hover {
  color: var(--card);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--card);
  font-weight: 700;
}

.btn-primary:hover {
  color: var(--card);
  box-shadow: var(--glow);
}

/* ---------- 主页 ---------- */
.home {
  max-width: 860px;
  padding-bottom: 40px;
}

.header {
  text-align: center;
  margin: 26px 0 30px;
  animation: fadeInDown 0.6s ease;
}

.site-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.site-title::after {
  content: '';
  display: block;
  height: 3px;
  width: 64px;
  margin: 14px auto 0;
  background: var(--grad);
  border-radius: 3px;
}

.site-sub {
  font-size: 15px;
  color: var(--muted);
  margin-top: 14px;
}

.form-card {
  padding: 22px;
  margin-bottom: 18px;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.generate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.generate-input {
  padding: 12px 18px;
  font-size: 15px;
  font-family: inherit;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}

.generate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.generate-input:disabled {
  opacity: 0.5;
}

.generate-btn {
  padding: 12px 26px;
  font-size: 15px;
  background: var(--grad);
  color: #FFF9EE;
  font-weight: 700;
  box-shadow: var(--glow);
}

.generate-btn:hover:not(:disabled) {
  color: #FFF9EE;
  box-shadow: var(--glow-strong);
}

.generate-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
  font-size: 14px;
}

.generate-status[hidden] {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.search-section {
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease 0.15s both;
}

.search-box {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
  pointer-events: none;
}

.search-section .generate-input {
  width: 100%;
  padding-left: 44px;
  background: var(--card);
}

.list-label {
  animation: fadeInUp 0.6s ease 0.2s both;
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.song-card {
  display: block;
  position: relative;
  padding: 18px 22px 18px 66px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.25s ease;
}

/* 卡片左侧的音符图标芯片 */
.song-card::before {
  content: '♪';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.25s ease;
}

.song-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--accent);
}

.song-card:hover::before {
  background: var(--grad);
  color: #FFF9EE;
}

/* 最新一首歌(仅未过滤时由 JS 加 .is-new)的 NEW 徽章 */
.song-card.is-new .song-card-title::after {
  content: 'NEW';
  margin-left: 8px;
  padding: 2px 7px;
  font-size: 10px;
  font-family: var(--font-romaji);
  letter-spacing: 0.06em;
  border-radius: 999px;
  background: var(--grad);
  color: #FFF9EE;
  vertical-align: 3px;
}

.song-card .song-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 3px;
}

.song-card .song-card-artist {
  font-size: 13px;
  color: var(--muted);
}

/* 歌单卡片错落入场 */
.song-card {
  opacity: 0;
  animation: fadeInUp 0.45s ease forwards;
}

.song-card:nth-child(1) { animation-delay: 0.05s; }
.song-card:nth-child(2) { animation-delay: 0.10s; }
.song-card:nth-child(3) { animation-delay: 0.15s; }
.song-card:nth-child(4) { animation-delay: 0.20s; }
.song-card:nth-child(5) { animation-delay: 0.25s; }
.song-card:nth-child(6) { animation-delay: 0.30s; }
.song-card:nth-child(7) { animation-delay: 0.35s; }
.song-card:nth-child(n+8) { animation-delay: 0.40s; }

.song-list-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}

.song-list-empty[hidden] {
  display: none;
}

.request-section-title {
  margin: 30px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.request-section-title::before {
  content: '★ ';
  color: var(--secondary);
}

.request-card {
  cursor: default;
}

/* 许愿清单卡片用 ★ 芯片区分 */
.request-card::before {
  content: '★';
  background: rgba(62, 104, 115, 0.12);
  color: var(--accent-2);
}

.request-card:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
  border-color: var(--border);
}

.request-card:hover::before {
  background: rgba(62, 104, 115, 0.12);
  color: var(--accent-2);
}

/* ---------- 歌曲页 ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 468px);
  gap: 28px 38px;
  align-items: start;
  padding-top: 12px;
}

.video-section {
  margin-bottom: 18px;
  animation: fadeInUp 0.6s ease 0.05s both;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: linear-gradient(135deg, var(--pill), var(--paper-2));
  border: 1px solid var(--border);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.song-title {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.artist {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease 0.12s both;
}

.playmode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  animation: fadeInUp 0.6s ease 0.15s both;
}

.playmode .caps {
  margin-bottom: 4px;
}

.playmode-text {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-cn);
}

.playmode-actions {
  display: flex;
  gap: 10px;
}

.circle-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--pill);
  color: var(--accent-2);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circle-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.circle-btn.primary {
  background: var(--accent);
  color: #FFF9EE;
  box-shadow: var(--glow);
}

.circle-btn.primary:hover {
  box-shadow: var(--glow-strong);
}

/* K歌按钮图标 */
.circle-btn i {
  font-style: normal;
  display: none;
}

.circle-btn i.play-icon {
  display: inline-block;
  transform: translateX(1px);
}

.circle-btn.active i.play-icon {
  display: none;
}

.circle-btn i.stop-icon {
  display: none;
}

.circle-btn.active i.stop-icon {
  display: inline-block;
}

.circle-btn i.stop-icon b {
  display: inline-block;
  width: 4px;
  height: 12px;
  background: #FFF9EE;
  margin: 0 2.5px;
  border-radius: 1px;
}

.circle-btn.active {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: var(--glow); }
  50% { box-shadow: var(--glow-strong); }
}

/* 歌词面板 */
.lyrics-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  padding: 22px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.lyrics-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.lyrics-head h2 {
  font-size: 18px;
  font-weight: 700;
}

.line-counter {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-romaji);
  letter-spacing: 0.06em;
}

.toggles {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lyrics-section {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: 4px;
}

.lyrics-section::-webkit-scrollbar {
  width: 6px;
}

.lyrics-section::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.lyric-line {
  position: relative;
  padding: 14px 10px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lyric-line:hover {
  background: var(--accent-light);
}

/* 当前行:只换底色/描边/颜色,字号、内边距、外边距保持不变,避免换行和排版跳动 */
.lyric-line.active {
  background: var(--paper);
  border-color: var(--accent);
}

.lyric-jp {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.55;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.lyric-line.active .lyric-jp {
  color: var(--ink);
}

/* ruby 注音:假名悬在汉字正上方 */
.lyric-jp ruby {
  ruby-position: over;
}

.lyric-jp rt {
  font-family: var(--font-romaji);
  font-size: 0.52em;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0;
}

.lyric-line.active .lyric-jp rt {
  color: var(--accent);
}

.lyric-jp-plain {
  display: none;
}

.lyric-romaji {
  font-family: var(--font-romaji);
  font-size: 13px;
  color: var(--accent-2);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.lyric-cn {
  font-size: 13.5px;
  font-family: var(--font-cn);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* 英文界面下,翻译行与按钮换回圆体拉丁 */
body.lang-en .lyric-cn {
  font-family: var(--font-romaji);
  font-size: 13px;
}

body.lang-en .btn {
  font-family: var(--font-romaji);
}

/* Toggle: hide individual elements */
.hide-romaji .lyric-romaji,
.hide-cn .lyric-cn {
  display: none;
}

/* ふりがな 开关:ruby 注音版与纯文本版互换 */
.hide-furigana .lyric-jp-furi {
  display: none;
}

.hide-furigana .lyric-jp-plain {
  display: block;
}

.lyrics-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--faint);
}

/* 每行的报错小旗 */
.report-line-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  color: var(--faint);
  opacity: 0.35;
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
  transition: opacity 0.2s ease;
}

.lyric-line:hover .report-line-btn,
.report-line-btn:hover {
  opacity: 0.9;
  color: var(--accent);
}

/* Tip 卡片 */
.tip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  margin-top: 28px;
}

.tip-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--pill);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tip-text {
  font-size: 13px;
  color: var(--muted);
}

.tip-text b {
  color: var(--ink);
  margin-right: 8px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 60px 24px 36px;
  color: var(--faint);
  font-size: 13px;
}

.footer::before {
  content: '';
  display: block;
  height: 2px;
  width: 96px;
  margin: 0 auto 18px;
  background: var(--grad);
  border-radius: 2px;
  opacity: 0.5;
}

/* ---------- 报错弹窗 ---------- */
.report-modal {
  position: fixed;
  inset: 0;
  background: rgba(41, 38, 36, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.report-modal[hidden] {
  display: none;
}

.report-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.report-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.report-line-text {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  word-break: break-all;
}

.report-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--ink);
}

.report-types label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.report-types input[type="checkbox"] {
  accent-color: var(--accent);
}

.report-desc {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}

.report-desc:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.report-status {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--accent);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- 动画 ---------- */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .stage {
    display: block;
  }

  .stage-left {
    margin-bottom: 24px;
  }

  .lyrics-panel {
    position: static;
    max-height: none;
  }

  .topnav {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .site-title {
    font-size: 27px;
  }

  .song-title {
    font-size: 22px;
  }

  .container {
    padding: 0 16px;
  }
}

@media (min-width: 640px) {
  .generate-form {
    flex-direction: row;
  }

  .generate-form .generate-input {
    flex: 1;
  }

  .generate-btn {
    flex-shrink: 0;
  }
}
