:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181b21;
  --panel-strong: #20242c;
  --text: #f7f3ea;
  --muted: #b8c0cc;
  --accent: #ff9ed8;
  --accent-strong: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.16);
  --mandarin: #9bd6ff;
  --border: rgba(255, 255, 255, 0.12);
}

body.singer-elphaba {
  --accent: #79e6a3;
  --accent-strong: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.16);
  --mandarin: #b6f5cb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(24px + env(safe-area-inset-bottom));
}

.back-link {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
  border-color: var(--accent);
}

.stage {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 10px;
  background: linear-gradient(var(--bg) 88%, rgba(16, 17, 20, 0));
}

.song-video {
  display: block;
  width: 100%;
  max-height: 48vh;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #050608;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.overlay {
  position: absolute;
  right: 8px;
  bottom: 18px;
  left: 8px;
  padding: 14px 14px 16px;
  text-align: center;
  background: linear-gradient(rgba(4, 7, 12, 0.18), rgba(4, 7, 12, 0.84));
  border-radius: 8px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.section-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pronunciation {
  margin: 0;
  color: #fff8dd;
  font-size: clamp(1.7rem, 9vw, 3.2rem);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.characters {
  margin: 8px 0 0;
  color: var(--mandarin);
  font-size: clamp(1rem, 5vw, 1.45rem);
  font-weight: 650;
}

.controls,
.practice,
.tips {
  margin-top: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.transport,
.line-meta,
.toggle-row,
.slider-row,
.practice-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport {
  justify-content: center;
}

.icon-button,
.primary-button,
.small-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-strong);
}

.icon-button {
  width: 54px;
  font-size: 2rem;
  line-height: 1;
}

.primary-button {
  min-width: 132px;
  padding: 0 22px;
  color: #16120a;
  font-weight: 800;
  background: var(--accent);
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--accent);
  font-size: 0.88rem;
}

.line-meta {
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

#english {
  max-width: 68%;
  text-align: right;
}

.toggle-row,
.slider-row {
  justify-content: space-between;
  margin-top: 14px;
  color: var(--text);
}

.toggle-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-strong);
}

.slider-row input {
  flex: 1;
  accent-color: var(--accent-strong);
}

.slider-row output {
  width: 44px;
  color: var(--muted);
  text-align: right;
}

.practice-header {
  justify-content: space-between;
  margin-bottom: 10px;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
}

.line-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.line-card {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #14171d;
  color: inherit;
  text-align: left;
}

.line-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.line-pronunciation {
  color: #fff3c4;
  font-size: 1.08rem;
  font-weight: 800;
}

.line-characters {
  color: var(--mandarin);
  font-size: 0.98rem;
}

.line-english {
  color: var(--muted);
  font-size: 0.86rem;
}

.hide-hanzi .characters,
.hide-hanzi .line-characters {
  display: none;
}

.tips ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.tips li + li {
  margin-top: 8px;
}
