:root {
  --ink: #1c1b1a;
  --paper: #fbfaf7;
  --mango: #f4b740;
  --coral: #ea6a5e;
  --purple: #7c5cff;
  --mist: #eef7ff;
  --leaf: #2f8f71;
  --river: #2e6f9e;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-display: clamp(32px, 5.5vw, 52px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f6f2;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.status-toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: min(88vw, 520px);
  transform: translateX(-50%);
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 999px;
  background: rgba(28, 27, 26, 0.94);
  padding: 10px 16px;
  color: white;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 34px rgba(28, 27, 26, 0.22);
}

.status-toast.warning {
  background: rgba(121, 78, 18, 0.96);
}

.status-toast.error-state {
  background: rgba(126, 45, 38, 0.96);
}

.song-card.is-preview-loading,
.search-result.is-preview-loading {
  background: rgba(244, 183, 64, 0.11);
}

.song-card.is-previewing .song-copy::after,
.search-result.is-previewing .search-result-copy::after {
  content: "试听中";
  display: inline-block;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  padding: 3px 8px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

#youtube-error {
  display: none !important;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.thai-text {
  font-family: Tahoma, Arial, system-ui, sans-serif;
}

.page {
  min-height: 100vh;
}

.home-page {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 28px 42px;
}

.topbar,
.player-bar {
  display: flex;
  gap: 14px;
  align-items: center;
}

.topbar {
  justify-content: flex-start;
  padding: 8px 0 28px;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}

.home-version {
  display: none;
}

.brand-mark,
.icon-box {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.pill {
  border-radius: 999px;
  background: white;
  padding: 6px 10px;
  color: rgba(28, 27, 26, 0.68);
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 8px 24px rgba(28, 27, 26, 0.08);
}

.hero {
  display: grid;
  grid-template-columns: minmax(430px, 0.92fr) minmax(720px, 1.68fr);
  gap: 58px;
  align-items: center;
  padding: 10px 0 34px;
  min-height: calc(100vh - 90px);
}

.hero-copy {
  min-width: 0;
}

.slogan-block {
  max-width: 520px;
  display: grid;
  gap: 0;
  color: var(--ink);
}

.slogan-block h1 {
  margin: 0;
  font-size: clamp(23px, 2vw, 31px);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.slogan-block h1 span {
  display: inline;
}

.slogan-block h1 span + span {
  margin-left: 0.32em;
}

.slogan-block p {
  max-width: 500px;
  margin: 20px 0 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
}

.murmur {
  max-width: 620px;
  margin: 22px 0 0;
  border: 1px solid rgba(244, 183, 64, 0.72);
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.56;
  text-align: justify;
  text-align-last: left;
}

.murmur p {
  margin: 0;
}

.murmur p + p {
  margin-top: 0.56em;
}

.search-panel {
  width: min(100%, 480px);
  margin-top: 72px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.home-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(520px, 1.3fr);
  gap: 24px;
  align-items: start;
}

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

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(40px, 8vw, 72px);
  line-height: 1.05;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

.lede {
  max-width: 660px;
  margin: 20px 0 0;
  color: rgba(28, 27, 26, 0.72);
  font-size: 20px;
  font-weight: 720;
  line-height: 1.65;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.actions-grid.search-only {
  grid-template-columns: 1fr;
}

.action-card,
.song-panel {
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 32px rgba(28, 27, 26, 0.08);
}

.action-card {
  min-height: auto;
  padding: 0;
}

.upload-card {
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
}

.upload-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-card strong,
.upload-card small {
  display: block;
}

.upload-card small,
.youtube-card small {
  margin-top: 6px;
  color: rgba(28, 27, 26, 0.62);
  line-height: 1.5;
}

.youtube-title {
  display: block;
  margin-bottom: 12px;
  font-weight: 750;
}

.search-results {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: #fff;
}

.search-results p {
  margin: 0;
  border-bottom: 1px solid rgba(28, 27, 26, 0.08);
  padding: 10px 12px;
  color: rgba(28, 27, 26, 0.62);
  font-size: 13px;
  line-height: 1.5;
}

.search-result-list {
  display: grid;
}

.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(28, 27, 26, 0.08);
  background: white;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.search-result.has-cover {
  grid-template-columns: 52px minmax(0, 1fr) auto;
}

.search-result.is-previewing {
  border-left: 3px solid var(--purple);
  background: rgba(124, 92, 255, 0.07);
}

.search-result-cover {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 3px 12px rgba(28, 27, 26, 0.12);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  margin-top: 2px;
  color: rgba(28, 27, 26, 0.58);
}

.search-result .result-reason {
  color: rgba(28, 27, 26, 0.46);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.search-result-open {
  align-self: center;
  min-width: 54px;
  border: 1px solid rgba(28, 27, 26, 0.14);
  border-radius: 999px;
  background: transparent;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.search-result.unavailable {
  background: rgba(28, 27, 26, 0.025);
}

.search-result.unavailable .search-result-open {
  color: rgba(28, 27, 26, 0.42);
}

.input-row {
  display: flex;
  gap: 0;
  align-items: center;
  min-height: 62px;
  border: 1px solid rgba(28, 27, 26, 0.18);
  border-radius: 7px;
  background: white;
  padding: 0 14px;
}

.input-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 12px 10px;
  font-size: 17px;
}

.input-row button,
.play-button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.input-row button {
  width: 32px;
  border-radius: 0;
  background: transparent;
  color: #f26b13;
  font-size: 25px;
}

.error {
  display: block;
  color: var(--coral) !important;
}

.song-panel {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.catalog-panel {
  max-height: 680px;
  overflow-y: auto;
  padding-right: 2px;
}

.library-logic {
  display: none;
  gap: 4px;
  margin: 0 8px 12px;
  border: 1px solid rgba(47, 143, 113, 0.16);
  border-radius: 8px;
  background: rgba(47, 143, 113, 0.055);
  padding: 10px;
}

.library-logic strong,
.library-logic span {
  display: block;
}

.library-logic strong {
  font-size: 13px;
}

.library-logic span {
  color: rgba(28, 27, 26, 0.62);
  font-size: 12px;
  line-height: 1.55;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 12px;
}

.catalog-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  gap: 18px;
  width: 100%;
  margin: 0;
  border-bottom: 1px solid rgba(28, 27, 26, 0.16);
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.catalog-tabs button {
  min-height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
}

.catalog-tabs button.active {
  border-bottom: 2px solid var(--purple);
  background: transparent;
  color: var(--purple);
  box-shadow: none;
}

.resource-menu-button {
  margin-top: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  color: rgba(28, 27, 26, 0.62);
  font-size: var(--text-sm);
  font-weight: 760;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.search-resource-button {
  width: 100%;
  margin-top: 8px;
  border-top: 1px solid rgba(28, 27, 26, 0.08);
  padding-top: 12px;
  text-align: left;
}

.catalog-heading {
  margin-top: 14px;
  border-top: 1px solid rgba(28, 27, 26, 0.08);
  padding-top: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading span {
  color: rgba(28, 27, 26, 0.52);
  font-size: 12px;
}

.song-list {
  display: grid;
  gap: 0;
}

.song-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-top: 1px solid rgba(28, 27, 26, 0.08);
  border-radius: 0;
  padding: 17px 18px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.song-card.has-cover {
  grid-template-columns: 62px minmax(0, 1fr) auto;
}

.song-card.compact {
  padding: 17px 18px;
}

.song-card.is-previewing {
  border-left: 3px solid var(--purple);
  background: rgba(124, 92, 255, 0.07);
}

.song-cover {
  width: 62px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 3px 12px rgba(28, 27, 26, 0.12);
}

.song-card.placeholder-card {
  opacity: 0.58;
  cursor: default;
}

.song-card.pending-resource {
  cursor: default;
}

.song-card strong,
.song-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-card strong {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.22;
}

.song-card span {
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
}

.song-card .resource-line {
  overflow: visible;
  white-space: normal;
  color: rgba(28, 27, 26, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.song-card .resource-badges {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible !important;
  white-space: normal !important;
}

.resource-badges em {
  border-radius: 999px;
  background: rgba(28, 27, 26, 0.06);
  padding: 3px 8px;
  color: rgba(28, 27, 26, 0.56);
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
}

.resource-badges em.ready {
  background: rgba(47, 143, 113, 0.12);
  color: var(--leaf);
}

.resource-badges em.pending {
  background: rgba(234, 106, 94, 0.12);
  color: var(--coral);
}

.song-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0 !important;
  overflow: visible !important;
}

.song-actions button {
  min-width: 58px;
  min-height: 34px;
  border: 1px solid rgba(28, 27, 26, 0.14);
  border-radius: 999px;
  background: transparent;
  padding: 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.song-actions button::after {
  content: none;
}

.song-actions button:first-child {
  background: transparent;
  color: var(--ink);
}

.song-card.pending-resource .song-actions button {
  border-color: rgba(244, 150, 46, 0.52);
  color: rgba(244, 150, 46, 0.9);
}

.search-result.pending-resource .search-result-open {
  background: rgba(244, 150, 46, 0.12);
  color: rgba(196, 99, 12, 0.95);
}

.placeholder-card .song-actions button {
  color: rgba(28, 27, 26, 0.45);
}

.learn-page {
  background: #f7f6f2;
}

.processor-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.processor-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
  align-items: start;
  padding: 28px 0;
}

.processor-main,
.lyrics-import-card {
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 32px rgba(28, 27, 26, 0.08);
}

.processor-main {
  padding: 22px;
}

.processor-main h1 {
  font-size: clamp(32px, 5vw, 52px);
}

.pipeline {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.pipeline-step {
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
}

.pipeline-step strong,
.pipeline-step span {
  display: block;
}

.pipeline-step span {
  margin-top: 5px;
  color: rgba(28, 27, 26, 0.62);
  line-height: 1.55;
}

.pipeline-step.done {
  border-color: rgba(47, 143, 113, 0.28);
  background: rgba(47, 143, 113, 0.08);
}

.pipeline-step.active {
  border-color: rgba(234, 106, 94, 0.34);
  background: rgba(234, 106, 94, 0.08);
}

.lyrics-import-card {
  padding: 18px;
}

.lyrics-import-card h2 {
  margin: 0 0 8px;
}

.lyrics-import-card p {
  margin: 0 0 14px;
  color: rgba(28, 27, 26, 0.64);
  line-height: 1.6;
}

.lyrics-import-card textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  border: 1px solid rgba(28, 27, 26, 0.14);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  color: var(--ink);
  font-family: Tahoma, Arial, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

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

.import-actions button {
  min-height: 42px;
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 8px;
  background: white;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 800;
}

.import-actions button:last-child {
  border-color: var(--river);
  background: var(--river);
  color: white;
}

.player-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  padding: 12px;
  border-bottom: 1px solid rgba(28, 27, 26, 0.1);
  background: rgba(251, 250, 247, 0.96);
  backdrop-filter: blur(12px);
}

.song-meta {
  min-width: 0;
}

.song-meta strong,
.song-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-meta span {
  margin-top: 2px;
  color: rgba(28, 27, 26, 0.62);
  font-size: 13px;
}

.youtube-frame-wrap {
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 8px;
  background: black;
}

.youtube-frame-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

#loop-button {
  display: none !important;
}

.icon-button,
.play-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
}

.icon-button {
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 23px;
}

.icon-button.active {
  border-color: var(--leaf);
  background: var(--leaf);
  color: white;
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: rgba(28, 27, 26, 0.55);
  font-size: 12px;
}

.progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(28, 27, 26, 0.1);
  cursor: pointer;
  box-sizing: content-box;
  margin: -8px 0;
  padding: 8px 0;
  background-clip: content-box;
  touch-action: manipulation;
}

#progress-fill {
  position: relative;
  z-index: 1;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.progress-markers {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.progress-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border: 2px solid white;
  border-radius: 50%;
  background: var(--mango);
  padding: 0;
  pointer-events: auto;
  touch-action: manipulation;
}

.progress-marker::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.progress-marker.chorus {
  background: var(--ink);
}

.rate-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}

.rate-row span {
  color: rgba(28, 27, 26, 0.56);
  font-size: 12px;
  font-weight: 750;
}

.rate-row button {
  min-width: 58px;
  height: 34px;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  color: rgba(28, 27, 26, 0.74);
  font-weight: 750;
}

.rate-row button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.song-note,
.lyrics-flow {
  width: min(980px, calc(100% - 24px));
  margin: 12px auto;
}

.song-note {
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  color: rgba(28, 27, 26, 0.64);
  font-size: 14px;
}

.song-note p {
  margin: 0;
}

.section-jumps {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.section-jumps button {
  min-height: 30px;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 999px;
  background: #f7f6f2;
  padding: 0 10px;
  color: rgba(28, 27, 26, 0.72);
  font-size: 12px;
  font-weight: 780;
}

.lyrics-flow {
  height: calc(100vh - 252px);
  min-height: 420px;
  overflow-y: auto;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  padding: 8px;
}

.line-card {
  width: 100%;
  margin: 0 0 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: white;
  padding: 16px 19px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.line-card.active {
  border-color: rgba(124, 92, 255, 0.3);
  background: rgba(124, 92, 255, 0.055);
}

.line-jump-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin: -2px 0 6px;
}

.line-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  border: 1px solid rgba(28, 27, 26, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px 8px;
  margin: 0;
  color: rgba(28, 27, 26, 0.46);
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.line-jump:focus-visible {
  outline: 2px solid rgba(124, 92, 255, 0.45);
  outline-offset: 3px;
}

.line-speak {
  flex: 0 0 auto;
  min-height: 26px;
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 999px;
  background: white;
  padding: 0 9px;
  color: rgba(28, 27, 26, 0.62);
  font-size: 12px;
  font-weight: 780;
}

.line-thai {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px 16px;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.25;
}

.phrase-group {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  max-width: 100%;
}

.line-card.active .line-thai {
  font-size: 25px;
}

.line-zh {
  display: block;
  margin-top: 7px;
  color: rgba(28, 27, 26, 0.68);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.word-token {
  display: inline-grid;
  min-width: 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0 1px 4px;
  color: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.word-token:hover,
.word-token:focus-visible {
  border-bottom-color: var(--purple);
  outline: 0;
}

.word-token.unknown {
  color: rgba(28, 27, 26, 0.72);
}

.word-token.latin {
  margin-right: 2px;
}

.token-pron {
  min-height: 1em;
  color: rgba(28, 27, 26, 0.58);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78em;
  font-weight: 760;
  line-height: 1.2;
}

.token-thai {
  display: block;
  font-family: Tahoma, Arial, system-ui, sans-serif;
  font-weight: 760;
  font-size: 1em;
  overflow-wrap: anywhere;
}

.word-token.latin .token-thai {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.punctuation-token {
  align-self: flex-end;
  margin-left: -6px;
  padding-bottom: 4px;
  color: rgba(28, 27, 26, 0.7);
  font-size: 0.82em;
  font-weight: 760;
  line-height: 1;
}

.repeat-badge {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(47, 143, 113, 0.12);
  padding: 2px 7px;
  color: var(--leaf);
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: 800;
}

.repeat-badge.repeat {
  background: rgba(28, 27, 26, 0.06);
  color: rgba(28, 27, 26, 0.52);
}

.import-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  background: rgba(28, 27, 26, 0.18);
  padding: 12px;
}

.token-sheet {
  position: relative;
  width: min(560px, 100%);
  max-height: min(84vh, 720px);
  overflow-y: auto;
  margin: 0 auto;
  border: 1px solid rgba(46, 111, 158, 0.12);
  border-radius: 8px;
  background: var(--mist);
  padding: 24px;
  box-shadow: 0 18px 60px rgba(28, 27, 26, 0.18);
}

.resource-sheet {
  position: relative;
  width: min(520px, 100%);
  max-height: min(84vh, 680px);
  overflow-y: auto;
  margin: 0 auto;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: white;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(28, 27, 26, 0.18);
}

.resource-sheet h2 {
  margin: 0 48px 16px 0;
  font-size: var(--text-xl);
}

.resource-option {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid rgba(28, 27, 26, 0.1);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
  color: var(--ink);
  text-align: left;
}

.resource-option + .resource-option,
.resource-upload + .resource-option {
  margin-top: 10px;
}

.resource-option strong,
.resource-option span {
  display: block;
}

.resource-option span {
  color: rgba(28, 27, 26, 0.58);
  font-size: var(--text-sm);
}

.resource-upload {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.resource-upload input {
  width: 100%;
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
}

.resource-upload button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

.token-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-right: 46px;
}

.token-sheet h2 {
  margin: 0;
  font-size: 34px;
}

.pos-badge {
  margin-top: 10px;
  border-radius: 999px;
  background: white;
  padding: 4px 9px;
  color: rgba(28, 27, 26, 0.7);
  font-size: 12px;
  font-weight: 780;
}

#token-pron {
  margin: 4px 0 18px;
  color: rgba(28, 27, 26, 0.66);
  font-size: 19px;
  font-weight: 800;
}

.speak-button {
  min-height: 34px;
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 999px;
  background: white;
  padding: 0 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 780;
}

.speak-button:disabled,
.speak-button.disabled {
  cursor: default;
  background: rgba(28, 27, 26, 0.05);
  color: rgba(28, 27, 26, 0.38);
}

.token-actions {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.token-primary-meaning {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
  font-weight: 780;
  line-height: 1.35;
}

.token-context {
  margin: 12px 0 0;
  color: rgba(28, 27, 26, 0.74);
  font-size: 15px;
  line-height: 1.65;
}

.examples {
  margin-top: 14px;
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.examples-title {
  display: block;
  margin-bottom: 8px;
  color: rgba(28, 27, 26, 0.56);
  font-size: 12px;
  font-weight: 780;
}

.examples p {
  margin: 8px 0;
  display: grid;
  gap: 4px;
}

.examples p small {
  color: rgba(28, 27, 26, 0.58);
  font-size: 13px;
  line-height: 1.45;
}

.examples mark {
  border-radius: 5px;
  background: rgba(244, 183, 64, 0.32);
  padding: 0 3px;
  color: inherit;
  font-weight: 850;
}

.admin-page {
  max-width: 980px;
  margin: 0 auto;
}

.admin-layout {
  display: grid;
  gap: 16px;
}

.admin-card {
  border: 1px solid rgba(28, 27, 26, 0.08);
  border-radius: 8px;
  background: white;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(28, 27, 26, 0.06);
}

.admin-card h1 {
  font-size: 32px;
  line-height: 1.18;
}

.admin-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.admin-card p {
  margin: 8px 0 0;
  color: rgba(28, 27, 26, 0.62);
}

.admin-card label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: rgba(28, 27, 26, 0.68);
  font-size: 13px;
  font-weight: 760;
}

.admin-card input,
.admin-card select,
.admin-card textarea {
  min-height: 42px;
  border: 1px solid rgba(28, 27, 26, 0.12);
  border-radius: 8px;
  background: var(--cream);
  padding: 0 12px;
  color: var(--ink);
  font-size: 15px;
}

.admin-card textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

.admin-card button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  padding: 0 14px;
  color: white;
  font-weight: 800;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-card button.secondary-button {
  border: 1px solid rgba(28, 27, 26, 0.12);
  background: white;
  color: var(--ink);
}

.admin-card button.danger-button {
  background: rgba(234, 106, 94, 0.12);
  color: var(--coral);
}

.admin-card button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.request-list {
  display: grid;
  gap: 10px;
}

.request-item {
  display: grid;
  gap: 4px;
  border-top: 1px solid rgba(28, 27, 26, 0.08);
  padding-top: 10px;
}

.slogan-support-mobile {
  display: none;
}

.request-item span,
.request-item small,
.request-item a {
  color: rgba(28, 27, 26, 0.58);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .hero,
  .home-workspace,
  .processor-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: start;
    gap: 24px;
    min-height: auto;
    padding-top: 10px;
    padding-bottom: 24px;
  }

  .hero-copy {
    display: grid;
  }

  .search-panel {
    margin-top: 28px;
  }
}

@media (max-width: 780px) {
  .home-page,
  .processor-page {
    padding: 14px 12px;
  }

  .topbar {
    padding-bottom: 18px;
  }

  .brand {
    max-width: none;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .brand-mark,
  .icon-box {
    width: 34px;
    height: 34px;
  }

  h1 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .slogan-block {
    max-width: 100%;
    gap: 8px;
  }

  .slogan-block h1 {
    font-size: clamp(19.2px, 5.52vw, 25.2px);
    line-height: 1.35;
    white-space: normal;
    text-wrap: balance;
  }

  .slogan-block h1 span {
    display: inline;
  }

  .slogan-block h1 span + span {
    margin-left: 0.28em;
  }

  .slogan-block p {
    max-width: 34em;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.62;
  }

  .slogan-support-desktop {
    display: none;
  }

  .slogan-support-mobile {
    display: block;
    max-width: 100%;
    font-size: clamp(12px, 3.47vw, 14px);
    white-space: normal;
  }

  .murmur {
    margin-top: 12px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.46;
  }

  .murmur p + p {
    margin-top: 0.56em;
  }

  .lede {
    font-size: 17px;
  }

  .home-workspace {
    margin-top: 18px;
    gap: 14px;
  }

  .search-panel {
    width: 100%;
    margin-top: 22px;
  }

  .input-row {
    min-height: 54px;
  }

  .input-row input {
    font-size: 16px;
  }

  .catalog-tabs {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .catalog-tabs button {
    min-height: 50px;
    font-size: 16px;
  }

  .catalog-panel {
    max-height: none;
  }

  .song-card,
  .song-card.compact {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 9px;
    padding: 14px 10px;
  }

  .song-card.has-cover,
  .song-card.compact.has-cover {
    grid-template-columns: 52px minmax(0, 1fr) 58px;
  }

  .song-cover {
    width: 52px;
    height: 52px;
  }

  .song-card strong {
    font-size: 15px;
  }

  .song-card span {
    font-size: 13px;
  }

  .action-card {
    padding: 0;
  }

  .song-panel {
    padding: 0;
  }

  .catalog-panel {
    max-height: none;
  }

  .player-bar {
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 8px;
  }

  #source-label {
    display: none;
  }

  .icon-button,
  .play-button {
    width: 38px;
    height: 38px;
  }

  .controls {
    gap: 8px;
  }

  .rate-row {
    gap: 6px;
  }

  .rate-row button {
    min-width: 48px;
    height: 30px;
    font-size: 13px;
  }

  .rate-row span {
    font-size: 11px;
  }

  .lyrics-flow {
    width: calc(100% - 14px);
    height: calc(100svh - 178px);
    min-height: 0;
    padding: 5px;
  }

  .song-note {
    width: calc(100% - 14px);
    margin: 8px auto;
    padding: 8px 10px;
    font-size: 13px;
  }

  .line-jump-row {
    margin: -3px 0 3px;
  }

  .line-thai {
    gap: 5px 9px;
    font-size: 18px;
  }

  .line-card.active .line-thai {
    font-size: 19px;
  }

  .line-card {
    margin-bottom: 3px;
    padding: 8px 10px;
  }

  .line-zh {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.35;
  }

  .token-pron {
    font-size: 0.7em;
  }

  .token-sheet,
  .resource-sheet {
    padding: 20px;
  }

  .token-sheet h2 {
    font-size: 36px;
  }

  #token-pron {
    font-size: 21px;
  }
}
