:root {
  color-scheme: light;
  --bg: #1d1e1e;
  --panel: #ffffff;
  --line: #d9d9d9;
  --text: #1f1f1f;
  --muted: #6a6a6a;
  --accent: #1e63c6;
  --accent-dark: #164b95;
  --soft: #f7f7f7;
  --score-width: 768px;
  --score-font-size: 14px;
  --score-line-height: 22px;
  --score-chord-color: #0e5bbb;
  --score-lyric-color: #666666;
  --score-chord-row-height: 22px;
  --score-lyric-row-height: 22px;
  --score-char-gap: 0px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft JhengHei", Arial, Helvetica, sans-serif;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

.hero,
.library,
.score-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.hero {
  padding: 20px 24px;
}

.hero-mark {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  background: #f1f6ff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-search {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-search input {
  flex: 1 1 360px;
}

.hero-status {
  min-height: 24px;
}

.hero-status.is-error {
  color: #b42318;
}

.hero-status.is-success {
  color: #18633a;
}

.library,
.score-shell {
  margin-top: 18px;
}

.library {
  padding: 18px 20px;
}

label {
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 2px;
  background: #ffffff;
  padding: 10px 12px;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(30, 99, 198, 0.18);
  border-color: var(--accent);
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.library-header h2 {
  margin: 0;
  font-size: 20px;
}

.library-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

button {
  border: 1px solid #1b5ab0;
  border-radius: 2px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.song-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.artist-card {
  width: 100%;
  border: 1px solid #dadada;
  border-radius: 2px;
  background: #fafafa;
  padding: 14px;
}

.artist-card.is-open,
.artist-card:hover {
  border-color: #9bbce9;
  background: #f5f9ff;
}

.artist-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.artist-trigger:hover {
  background: transparent;
}

.artist-meta strong,
.artist-meta span,
.artist-meta small {
  display: block;
}

.artist-meta span,
.artist-meta small,
.artist-count {
  color: var(--muted);
  margin-top: 3px;
}

.artist-count {
  white-space: nowrap;
  font-size: 13px;
}

.artist-picker {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.artist-picker select {
  flex: 1 1 260px;
}

.artist-picker button {
  min-width: 120px;
}

.score-shell {
  padding: 0;
  overflow: hidden;
}

.score-layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 18px;
}

.showToneInfo {
  width: var(--score-width);
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0 0 26px;
  border: 1px solid #e6e6e6;
  background: #fafafa;
  position: relative;
  color: #5e5e5e;
}

.showToneInfo h1 {
  margin: 0 auto;
  padding: 15px 0 0;
  text-align: center;
  width: 300px;
  font-size: 30px;
  line-height: 30px;
  height: 30px;
  font-weight: 700;
  color: #55558e;
}

.tinfo {
  width: 100%;
  font-size: 13px;
  height: 50px;
  overflow: hidden;
  margin-top: 0;
}

.tinfo .con {
  margin-left: 30px;
  text-align: left;
  color: #555555;
  line-height: 1.5em;
}

.tinfo p {
  margin: 0;
}

.score-toolbar {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 8px 20px 0;
  padding: 10px 12px;
  background: #f8f8f8;
  border: 1px solid #ededed;
  color: #666666;
  font-size: 14px;
}

.score-editor {
  margin: 14px 20px 0;
  padding: 14px;
  border: 1px solid #e7e7e7;
  background: #ffffff;
}

.score-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.score-editor-head h2 {
  margin: 0;
  font-size: 18px;
  color: #55558e;
}

.score-editor-actions {
  display: flex;
  gap: 8px;
}

.score-editor-hint {
  margin: 10px 0 12px;
  color: #666666;
  font-size: 13px;
  line-height: 1.5;
}

.score-editor textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid #d6d6d6;
  background: #fcfcfc;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  font-family: Menlo, Monaco, Consolas, monospace;
  resize: vertical;
}

.composer {
  margin-top: 18px;
  border: 1px solid #e3e3e3;
  background: #fafafa;
  padding: 16px 18px;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.composer-head h2 {
  margin: 0;
  font-size: 22px;
  color: #55558e;
}

.composer-panel.is-hidden {
  display: none;
}

.composer-panel {
  margin-top: 14px;
}

.composer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.composer-grid label {
  display: grid;
  gap: 6px;
  color: #555555;
  font-size: 13px;
}

.composer-grid input,
.composer-grid select,
.composer-grid textarea {
  width: 100%;
  border: 1px solid #d6d6d6;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 14px;
}

.composer-grid textarea {
  min-height: 220px;
  resize: vertical;
  font-family: Menlo, Monaco, Consolas, monospace;
}

.composer-wide {
  grid-column: 1 / -1;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.composer-status {
  margin: 0;
  color: #666666;
  font-size: 13px;
}

.composer-status.is-error {
  color: #b23b3b;
}

.composer-status.is-success {
  color: #2a7a3b;
}

.moviebox {
  flex: 0 0 320px;
  border: 1px solid #e2e2e2;
  background: #fafafa;
  padding: 14px;
}

.moviebox h2 {
  margin: 0 0 12px;
  font-size: 22px;
  color: #55558e;
}

.video-manager {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.video-select-wrap {
  display: grid;
  gap: 6px;
  color: #555555;
  font-size: 13px;
}

.video-select {
  width: 100%;
  min-height: 38px;
}

.video-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.video-add input,
.artist-song-filter {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d6d6d6;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 14px;
}

.video-add button {
  min-width: 72px;
  padding: 8px 14px;
}

.video-popup-row {
  margin-top: 10px;
}

.video-popup-row button {
  width: 100%;
  padding: 10px 14px;
}

.videolist .item iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

.videolist .item p {
  margin: 10px 0 0;
  color: #565656;
  line-height: 1.5;
  font-size: 14px;
}

.toolbar-item strong {
  color: var(--text);
}

.toolbar-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #444;
}

.toolbar-control select {
  width: auto;
  min-width: 78px;
  padding: 5px 8px;
  font-size: 13px;
}

.artist-picker {
  display: grid;
  gap: 10px;
}

.tone {
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  font-size: 14px;
  font-family: Arial, Helvetica, sans-serif;
  cursor: default;
  position: relative;
  z-index: 2;
}

.song-placeholder {
  padding: 26px 0;
  text-align: center;
  color: #7b7b7b;
  font-size: 15px;
}

.song-line {
  position: relative;
  display: block;
  margin: 0;
}

.song-line.is-empty {
  min-height: 22px;
}

.music,
.lyric {
  position: relative;
  display: block;
  margin: 0;
  text-indent: 30px;
  line-height: 22px;
}

.music {
  min-height: var(--score-chord-row-height);
  background: rgba(0, 0, 0, 0.02);
  color: #000000;
}

.lyric {
  min-height: var(--score-lyric-row-height);
  color: #666666;
}

.chord-token,
.lyric-char {
  position: absolute;
  top: 0;
  display: inline-block;
  white-space: pre;
  font-size: 14px;
  line-height: 22px;
}

.chord-token {
  color: var(--score-chord-color);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.lyric-char {
  color: var(--score-lyric-color);
  font-family: Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
}

.lyric-space {
  opacity: 0;
}

.music-inline {
  min-height: 22px;
}

.music-inline .tf {
  color: #246fb5;
}

.music-inline .tf:hover,
.chord-token:hover {
  color: #ff0000;
}

@media (max-width: 1024px) and (orientation: portrait) {
  .page {
    padding: 18px 12px 44px;
  }

  .hero,
  .library {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-search,
  .library-actions {
    align-items: stretch;
  }

  .hero-search input,
  .library-actions input {
    flex-basis: 100%;
  }

  .score-layout {
    flex-direction: column;
    gap: 14px;
    padding: 14px;
  }

  .showToneInfo,
  .moviebox {
    width: 100%;
    max-width: 100%;
    flex-basis: auto;
  }

  .showToneInfo {
    padding-bottom: 18px;
  }

  .showToneInfo h1 {
    width: auto;
    height: auto;
    padding: 14px 18px 0;
    font-size: 28px;
    line-height: 1.2;
  }

  .tinfo {
    height: auto;
    padding-right: 18px;
  }

  .tinfo .con {
    margin-left: 18px;
  }

  .score-toolbar {
    justify-content: flex-start;
    gap: 14px 18px;
    margin: 10px 14px 0;
  }

  .toolbar-control {
    flex-wrap: wrap;
  }

  .toolbar-control select {
    min-width: 92px;
    font-size: 14px;
  }

  .tone {
    margin-top: 10px;
  }

  .moviebox {
    padding: 12px;
  }
}

@media (max-width: 760px) {
  .page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .score-layout {
    flex-direction: column;
    padding: 12px;
  }

  .library-header,
  .score-toolbar,
  .score-editor-head,
  .composer-head,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-grid {
    grid-template-columns: 1fr;
  }

  .hero-search {
    align-items: stretch;
  }

  .hero-search button,
  .library-actions button {
    width: 100%;
  }

  .showToneInfo {
    padding-left: 12px;
    padding-right: 12px;
  }

  .moviebox {
    width: 100%;
    flex-basis: auto;
  }

  .showToneInfo h1 {
    font-size: 25px;
  }
}
