:root {
  --bg: oklch(0.12 0.025 260);
  --panel: oklch(0.18 0.028 260);
  --panel-soft: oklch(0.23 0.03 260);
  --ink: oklch(0.96 0.012 95);
  --muted: oklch(0.72 0.025 260);
  --line: oklch(0.35 0.035 260);
  --accent: oklch(0.78 0.18 86);
  --accent-strong: oklch(0.82 0.2 72);
  --danger: oklch(0.64 0.18 24);
  --shadow: 0 24px 70px rgb(0 0 0 / 34%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 74% 18%, oklch(0.27 0.055 295 / 0.72), transparent 34%),
    linear-gradient(135deg, oklch(0.09 0.025 250), var(--bg) 54%, oklch(0.11 0.035 220));
  color: var(--ink);
  font-family:
    "Avenir Next", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.primary-action {
  border-color: transparent;
  background: var(--accent);
  color: oklch(0.16 0.025 90);
  font-weight: 800;
}

.app-shell {
  width: min(1600px, 100%);
  height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  padding: clamp(16px, 3vw, 34px);
}

.control-panel,
.stage-panel {
  min-width: 0;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(0.16 0.028 260 / 0.92);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: grid;
  gap: 8px;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.panel-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

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

textarea {
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: oklch(0.11 0.02 260);
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.78 0.18 86 / 0.18);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-grid span {
  color: var(--ink);
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.stage-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: oklch(0.08 0.02 260);
  box-shadow: var(--shadow);
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.prompter {
  --font-size: 52px;
  --line-height: 1.45;
  --focus-top: 42%;
  position: relative;
  overflow: hidden;
  scroll-behavior: auto;
  min-height: 0;
  background:
    linear-gradient(180deg, rgb(0 0 0 / 72%) 0%, transparent 18%, transparent 78%, rgb(0 0 0 / 76%) 100%),
    radial-gradient(circle at 50% var(--focus-top), oklch(0.24 0.06 86 / 0.5), transparent 28%),
    oklch(0.06 0.018 260);
}

.focus-band {
  position: absolute;
  top: var(--focus-top);
  left: 0;
  right: 0;
  z-index: 2;
  height: 0;
  pointer-events: none;
}

.focus-band::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -46px;
  height: 92px;
  border-top: 1px solid oklch(0.78 0.18 86 / 0.68);
  border-bottom: 1px solid oklch(0.78 0.18 86 / 0.4);
  background: linear-gradient(90deg, oklch(0.78 0.18 86 / 0.24), transparent 28%, transparent 72%, oklch(0.78 0.18 86 / 0.16));
}

.focus-band::after {
  content: "";
  position: absolute;
  left: 20px;
  top: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 28px var(--accent);
}

.lyrics-track {
  display: grid;
  gap: 14px;
  padding: 42vh clamp(22px, 5vw, 80px) 58vh;
  will-change: transform;
}

.lyric-line {
  position: relative;
  margin: 0;
  color: oklch(0.76 0.02 260);
  font-size: var(--font-size);
  line-height: var(--line-height);
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0.54;
  transform: translateX(0) scale(1);
  transform-origin: left center;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease,
    text-shadow 180ms ease;
}

.lyric-line.active {
  color: var(--accent-strong);
  opacity: 1;
  transform: translateX(22px) scale(1.045);
  text-shadow:
    0 0 22px oklch(0.82 0.2 72 / 0.58),
    0 2px 0 rgb(0 0 0 / 40%);
}

.lyric-line.active::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 0.24em;
  bottom: 0.24em;
  width: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 22px var(--accent);
}

.lyric-line.empty {
  min-height: calc(var(--font-size) * 0.45);
}

.show-controls {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  background: var(--accent);
  color: oklch(0.16 0.025 90);
  font-weight: 800;
}

body.focus-mode .app-shell {
  max-width: none;
  grid-template-columns: 1fr;
  padding: 0;
}

body.focus-mode .control-panel {
  display: none;
}

body.focus-mode .stage-panel {
  min-height: 100svh;
  border: 0;
  border-radius: 0;
}

body.focus-mode .stage-toolbar {
  display: none;
}

body.focus-mode .lyrics-track {
  padding-left: clamp(26px, 8vw, 128px);
  padding-right: clamp(26px, 8vw, 128px);
}

@media (max-width: 980px) {
  .app-shell {
    height: auto;
    min-height: 100svh;
    grid-template-columns: 1fr;
  }

  .stage-panel {
    min-height: 72svh;
  }
}

@media (max-width: 620px) {
  .control-panel {
    padding: 18px;
  }

  .settings-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .lyrics-track {
    padding-left: 20px;
    padding-right: 20px;
  }

  .lyric-line.active {
    transform: translateX(12px) scale(1.03);
  }
}
