:root {
  color-scheme: dark;
  --bg: #151515;
  --surface: #1b1b1b;
  --text: #e6e6e6;
  --muted: #969696;
  --border: #303030;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled, input:disabled { opacity: .35; cursor: default; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid #c4c4c4;
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  padding: 8px 16px;
  background: var(--text);
  color: var(--bg);
  z-index: 50;
}

.skip-link:focus { top: 12px; }

.header { border-bottom: 1px solid var(--border); }

.header-inner {
  max-width: 960px;
  min-height: 66px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 34px;
}

.site-name { font-weight: 600; white-space: nowrap; }
nav { display: flex; gap: 24px; }
nav a { font-size: 13px; color: var(--muted); }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }

#search-form { margin-left: auto; width: 188px; }

#search {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

#search::placeholder { color: #777; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 54px 28px 64px;
  outline: none;
}

body.has-player main { padding-bottom: 180px; }
h1 { font-size: 26px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
h2 { font-size: 15px; line-height: 1.7; font-weight: 500; }
.muted { color: var(--muted); }
.english-title { font-size: 12px; color: var(--muted); line-height: 1.8; margin-top: 8px; overflow-wrap: anywhere; }
.breadcrumb { margin-bottom: 24px; font-size: 12px; color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb span { margin: 0 9px; color: #666; }
.novel-list { margin-top: 26px; border-top: 1px solid var(--border); }

.novel-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.novel-row:hover .novel-title { text-decoration: underline; text-underline-offset: 5px; }
.novel-row-info { flex: 1; min-width: 0; }
.novel-title { display: block; font-size: 17px; font-weight: 400; overflow-wrap: anywhere; }
.novel-row .english-title { display: block; font-size: 11px; margin-top: 5px; }
.novel-count { flex-shrink: 0; color: var(--muted); font-size: 12px; white-space: nowrap; }
.chapter { margin-top: 34px; }
.chapter h2 { margin-bottom: 10px; }
.track-list { border-top: 1px solid var(--border); }

.track-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 0;
  border-bottom: 1px solid var(--border);
}

.track-row-main { flex: 1; min-width: 0; }
.track-title { font-size: 15px; }
.track-title:hover { text-decoration: underline; text-underline-offset: 4px; }
.track-context { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.track-length { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.track-actions { display: flex; align-items: center; gap: 18px; margin-top: 25px; }
.track-page-context { font-size: 13px; color: var(--muted); line-height: 1.9; margin-top: 16px; }
.track-page-context a:hover { color: var(--text); }
.track-state { min-height: 22px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.lyrics { max-width: 720px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.lyrics h2 { font-size: 12px; font-weight: 400; color: var(--muted); margin-bottom: 26px; }
.lyric-pair { margin-bottom: 24px; }
.lyric-pair:last-child { margin-bottom: 0; }
.lyric-original { font-size: 16px; line-height: 1.9; color: var(--text); overflow-wrap: anywhere; }
.lyric-translation { font-size: 13px; line-height: 1.9; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.list-spacing { margin-top: 28px; }
.empty { padding: 26px 0; font-size: 13px; color: var(--muted); }
.error { font-size: 13px; margin-top: 15px; color: var(--muted); overflow-wrap: anywhere; }

.button {
  border: 1px solid #dedede;
  border-radius: 3px;
  padding: 8px 21px;
  background: #dedede;
  color: #161616;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
}

.button:hover { background: #fff; border-color: #fff; }
.text-button { border: 0; padding: 4px 0; background: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.text-button:hover { color: var(--text); }
.icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { border: 0; background: none; width: 32px; height: 32px; padding: 7px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-button:hover { background: #262626; }
.icon-play { fill: currentColor; stroke-width: 1; }
.player { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border); }

.player-inner {
  max-width: 960px;
  margin: auto;
  padding: 18px 28px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(160px, 1.5fr) auto;
  gap: 24px;
  align-items: center;
}

.player-info { min-width: 0; }
#player-title { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player-title:hover { text-decoration: underline; }
#player-context { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.player-controls { display: flex; align-items: center; gap: 8px; }
.play-button { color: var(--bg); background: var(--text); border-radius: 50%; }
.play-button:hover { background: #fff; }
.progress { display: flex; align-items: center; gap: 10px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; }
.progress span { min-width: 29px; }
.progress span:last-child { text-align: right; }
.volume-control { display: flex; align-items: center; gap: 5px; }
#volume { width: 60px; }
#seek { flex: 1; min-width: 0; }

input[type="range"] {
  appearance: none;
  height: 3px;
  margin: 0;
  border-radius: 0;
  background: linear-gradient(to right, #d0d0d0 var(--progress, 0%), #444 var(--progress, 0%));
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb { appearance: none; width: 8px; height: 8px; background: #d0d0d0; border-radius: 50%; }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 0; background: #d0d0d0; border-radius: 50%; }
.player-status { grid-column: 1 / -1; font-size: 11px; color: #bbb; margin-top: -10px; }
.notice { position: fixed; top: 82px; left: 50%; transform: translateX(-50%); z-index: 40; padding: 8px 16px; border: 1px solid #444; border-radius: 3px; background: #252525; font-size: 12px; max-width: calc(100vw - 32px); text-align: center; }

#link-dialog { width: min(480px, calc(100% - 36px)); border: 1px solid #444; border-radius: 4px; padding: 22px; background: #202020; color: var(--text); }
#link-dialog::backdrop { background: #0009; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
#link-value { width: 100%; border: 1px solid #454545; border-radius: 2px; padding: 9px; background: #151515; color: var(--text); font-size: 12px; margin-bottom: 15px; }
.noscript { padding: 30px; }

@media (max-width: 700px) {
  .header-inner { padding: 0 22px; gap: 24px; }
  #search-form { width: 145px; }
  .player-inner { padding: 16px 22px; gap: 14px; grid-template-columns: minmax(100px, 1fr) auto minmax(100px, 1fr); }
  .volume-control { display: none; }
}

@media (max-width: 520px) {
  .header-inner { min-height: 60px; padding: 0 20px; gap: 20px; flex-wrap: wrap; }
  .site-name { font-size: 13px; }
  nav { gap: 18px; }
  nav a { font-size: 12px; }
  #search-form { width: 80px; }
  #search { font-size: 11px; }
  main { padding: 34px 20px 48px; }
  h1 { font-size: 23px; }
  .novel-list { margin-top: 22px; }
  .novel-title { font-size: 15px; }
  .novel-row { padding: 18px 0; gap: 15px; }
  .novel-row .english-title { font-size: 10px; line-height: 1.9; }
  .novel-count { font-size: 10px; }
  .track-row { gap: 12px; }
  .track-context { font-size: 10px; }
  .track-title { font-size: 14px; }
  .track-page-context { font-size: 12px; }
  .lyrics { margin-top: 28px; padding-top: 20px; }
  .lyrics h2 { margin-bottom: 23px; }
  .lyric-pair { margin-bottom: 21px; }
  .lyric-original { font-size: 15px; }
  .lyric-translation { font-size: 12px; }
  .player-inner { padding: 14px 20px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .progress { grid-column: 1 / -1; }
  .player-status { margin-top: 0; }
  .track-actions { gap: 20px; }
  .chapter { margin-top: 28px; }
  .breadcrumb { font-size: 11px; margin-bottom: 21px; }
  .notice { top: 72px; }
}

@media (max-width: 350px) {
  .header-inner { padding: 0 16px; gap: 15px; }
  nav { gap: 15px; }
  #search-form { width: 67px; }
  main { padding-left: 16px; padding-right: 16px; }
}

@supports (padding: max(0px)) {
  .player-inner { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  body.has-player main { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }
}

.track-artist { margin-top: 8px; font-size: 12px; color: var(--muted); }
.track-kind { font-size: 10px; color: var(--muted); display: block; margin-top: 3px; }
.instrumental { margin-top: 28px; font-size: 12px; color: var(--muted); }
.lyrics-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.lyrics-tools h2 { margin-bottom: 0; }
.lyrics-mode { color: #838383; font-size: 10px; }
.lyric-follow { margin-left: auto; color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.lyric-follow input { margin: 0; accent-color: #c6c6c6; }
.is-timed .lyric-pair { cursor: pointer; border-left: 2px solid transparent; padding-left: 12px; margin-left: -14px; }
.is-timed .lyric-original { color: #9a9a9a; }
.is-timed .lyric-translation { color: #858585; }
.is-timed .lyric-pair:hover .lyric-original { color: var(--text); }
.is-timed .lyric-pair.is-active { border-left-color: #c6c6c6; }
.is-timed .lyric-pair.is-active .lyric-original { color: var(--text); font-weight: 500; }
.is-timed .lyric-pair.is-active .lyric-translation { color: #c2c2c2; }
.lyric-pair:focus-visible { outline: 1px solid #aaa; outline-offset: 5px; }
@media (max-width: 520px) { .lyrics-tools { margin-bottom: 23px; } }
