:root {
  --bg: #f7f7f2;
  --text: #171717;
  --muted: #66645c;
  --line: #d8d5ca;
  --accent: #126c58;
  --accent-dark: #0c4f42;
  --panel: #fff;
  --warn: #a14c00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.site-header,
footer,
main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 15px;
}

nav a {
  text-decoration: none;
}

.hero {
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px 0 84px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(42px, 8vw, 92px);
  line-height: 0.98;
}

h2 {
  margin: 0 0 18px;
  font-size: 24px;
}

.lead {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 20px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: var(--accent-dark);
}

.split,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 42px;
  padding: 46px 0 72px;
  border-top: 1px solid var(--line);
}

.narrow,
.article-shell {
  width: min(860px, calc(100% - 32px));
}

.page-title {
  padding: 64px 0 32px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 8px 22px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.list-item.full {
  grid-template-columns: 150px 1fr;
}

.list-item time,
.list-item span,
.list-item p {
  color: var(--muted);
}

.list-item a {
  font-size: 21px;
  font-weight: 800;
  text-decoration: none;
}

.list-item p {
  grid-column: 2;
  margin: 0;
}

.article {
  padding: 72px 0 90px;
}

.article h1,
.song-head h1 {
  margin-bottom: 16px;
  font-size: clamp(38px, 7vw, 74px);
}

.article time {
  display: block;
  margin-bottom: 32px;
  color: var(--muted);
}

.article p {
  font-size: 19px;
}

.song-shell {
  width: min(980px, calc(100% - 32px));
}

.song-head {
  padding: 60px 0 28px;
}

audio {
  width: 100%;
  margin-top: 24px;
}

.song-player {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.song-player audio {
  margin-top: 0;
}

.youtube-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #101010;
}

.youtube-frame iframe {
  width: 100%;
  height: 100%;
}

.youtube-frame.large {
  margin-top: 10px;
}

.song-progress {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e2d8;
}

.song-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.now-playing {
  display: grid;
  gap: 3px;
  margin-top: 14px;
}

.now-playing span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.now-playing strong {
  font-size: 18px;
}

.now-playing em {
  color: var(--muted);
  font-style: normal;
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.empty-audio {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.lyrics {
  display: grid;
  gap: 14px;
  padding: 28px 0 80px;
}

.lyric-line {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.lyric-line.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 108, 88, 0.12);
}

.lyric-line.active .ja {
  color: var(--accent-dark);
}

.play-line {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
}

.ja {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.romaji,
.zh {
  margin: 4px 0 0;
  color: var(--muted);
}

.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.token {
  display: grid;
  gap: 1px;
  min-width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9f9f5;
  cursor: default;
}

.token em,
.token span {
  color: var(--muted);
  font-size: 13px;
}

.token-active {
  border-color: var(--accent);
  background: #e8f5ef;
}

.playing-token {
  border-color: var(--accent);
  background: #dff2e9;
  box-shadow: 0 0 0 3px rgba(18, 108, 88, 0.12);
}

.playing-token strong,
.token-active strong {
  color: var(--accent-dark);
}

.focus-line .ja,
.focus-line .zh {
  background: linear-gradient(transparent 58%, rgba(18, 108, 88, 0.2) 58%);
}

.admin-shell {
  width: min(980px, calc(100% - 32px));
  padding: 54px 0 84px;
}

.sync-shell {
  width: min(1080px, calc(100% - 32px));
  padding: 42px 0 84px;
}

.sync-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.sync-line {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.sync-line.selected {
  border-color: var(--accent);
  background: #e8f5ef;
  box-shadow: 0 0 0 3px rgba(18, 108, 88, 0.12);
}

.sync-timecode {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.sync-line strong,
.sync-line em,
.sync-line p {
  display: block;
}

.sync-line em {
  color: var(--muted);
  font-style: normal;
}

.sync-line p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-title,
.admin-row,
.admin-row div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-row {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.admin-row form {
  margin: 0;
}

.admin-row button {
  border: 0;
  background: transparent;
  color: var(--warn);
  cursor: pointer;
}

.stack-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: auto;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.help {
  margin: 0;
  color: var(--muted);
}

.error {
  color: #b42318;
  font-weight: 700;
}

.error-box {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #f0b8ad;
  border-radius: 8px;
  background: #fff4f2;
  color: #8f1d12;
  font-weight: 700;
}

footer {
  padding: 30px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .hero {
    min-height: auto;
    padding: 56px 0 68px;
  }

  .split,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .list-item,
  .list-item.full {
    grid-template-columns: 1fr;
  }

  .list-item p {
    grid-column: auto;
  }

  .lyric-line {
    grid-template-columns: 1fr;
  }

  .sync-line {
    grid-template-columns: 1fr;
  }
}
