/* Lyric Motion module */
.lyric-workspace {
  grid-template-columns: minmax(270px, 300px) minmax(500px, 1.25fr) minmax(360px, .75fr);
  align-items: start;
}

.controls-scroll {
  max-height: calc(100vh - 174px);
  overflow-y: auto;
}

.controls-panel,
.lines-panel {
  max-height: calc(100vh - 106px);
}

.controls-panel {
  overflow: hidden;
}

.lines-panel {
  overflow: auto;
}

.lyric-preview-panel {
  position: sticky;
  top: 92px;
  display: grid;
  max-height: calc(100vh - 106px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.playback-controls {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 8px;
}

.playback-button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  background: #0c0e13;
  cursor: pointer;
}

.playback-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.playback-button--main {
  color: #100d19;
  border-color: transparent;
  background: var(--violet-bright);
}

.timeline-readout {
  margin-top: 10px;
  font-family: "Courier New", monospace;
  font-size: 1.05rem;
  text-align: center;
}

.range-field {
  margin-bottom: 14px;
}

.range-field label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.range-field input,
.visual-controls input[type="color"] {
  width: 100%;
  accent-color: var(--violet-bright);
}

.audio-control input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.audio-upload {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  background: #0c0e13;
  cursor: pointer;
  font-size: .74rem;
}

.audio-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: .68rem;
}

.audio-file[hidden] {
  display: none;
}

.audio-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0d12;
}

.audio-player[hidden] { display: none; }

.audio-player__top {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

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

.audio-player__top strong { font-size: .72rem; }
.audio-player__top span { margin-top: 3px; color: var(--text-muted); font-family: "Courier New", monospace; font-size: .62rem; }

.audio-player__play {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #100d19;
  background: var(--violet-bright);
  cursor: pointer;
}

.audio-player > input[type="range"] {
  width: 100%;
  margin: 12px 0 8px;
  accent-color: var(--violet-bright);
}

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

.audio-segment .field { margin: 0; }

.advanced-settings {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
}

.advanced-settings summary {
  padding: 13px 14px;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.advanced-settings__body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
}

.visual-controls input[type="color"] {
  height: 42px;
  padding: 5px;
}

.lyric-table-wrap,
.song-table-wrap {
  min-height: 300px;
  overflow: auto;
}

.editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.editor-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 10px 7px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  background: #111319;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.editor-table td {
  padding: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.editor-table .table-input {
  min-width: 78px;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.7rem;
}

.editor-table td:nth-child(4) .table-input {
  min-width: 180px;
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  letter-spacing: -2px;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.table-icon {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 0;
}

.table-icon::before,
.table-icon::after {
  content: "";
  position: absolute;
}

.table-icon[data-action="duplicate"]::before {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: translate(2px, -2px);
}

.table-icon[data-action="duplicate"]::after {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: translate(-3px, 3px);
  opacity: .55;
}

.table-icon[data-action="delete"]::before,
.table-icon[data-action="delete"]::after,
#removeAudioButton::before,
#removeAudioButton::after {
  width: 13px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
}

.table-icon[data-action="delete"]::before,
#removeAudioButton::before {
  transform: rotate(45deg);
}

.table-icon[data-action="delete"]::after,
#removeAudioButton::after {
  transform: rotate(-45deg);
}

.table-icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.lyric-table-wrap.has-items .empty-state {
  display: none;
}

.preview-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.preview-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.preview-status.is-playing i {
  background: var(--violet-bright);
  box-shadow: 0 0 10px var(--violet);
}

.lyric-preview-stage {
  min-height: 0;
  padding: 18px;
  overflow: hidden;
}

.lyric-canvas {
  position: relative;
  display: flex;
  width: auto;
  max-width: 100%;
  height: min(100%, 560px);
  max-height: calc(100vh - 250px);
  aspect-ratio: 9 / 16;
  align-items: center;
  justify-content: center;
  padding: 11%;
  overflow: hidden;
  color: #fff;
  background: #0c0b12;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
  isolation: isolate;
  transition: width 180ms ease, aspect-ratio 180ms ease, background 180ms ease;
}

.lyric-canvas::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 100% 5px;
  content: "";
  pointer-events: none;
}

.lyric-canvas::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
}

.lyric-canvas.format-1-1 { width: min(100%, 460px); height: auto; aspect-ratio: 1; }
.lyric-canvas.format-4-5 { width: auto; height: min(100%, 540px); aspect-ratio: 4 / 5; }
.lyric-canvas.format-16-9 { width: min(100%, 620px); height: auto; aspect-ratio: 16 / 9; }

.canvas-kicker,
.canvas-counter {
  position: absolute;
  right: 7%;
  left: 7%;
  color: rgba(255, 255, 255, 0.5);
  font-family: "Courier New", monospace;
  font-size: 0.54rem;
  letter-spacing: 0.12em;
}

.canvas-kicker { top: 5%; }
.canvas-counter { bottom: 5%; text-align: right; }

.lyric-stack {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  transform: translate(0, 0);
}

.lyric-stack p {
  margin: 16px 0;
  overflow-wrap: anywhere;
}

.lyric-active {
  font-family: var(--font-display);
  font-size: 54px;
  line-height: 1.08;
  text-transform: uppercase;
}

.lyric-neighbor {
  min-height: 1.5em;
  color: rgba(255,255,255,.24);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.preset-dark-neon { background: radial-gradient(circle at 18% 16%, #4a1c74, transparent 34%), radial-gradient(circle at 85% 78%, #123b53, transparent 42%), #08070d; }
.preset-dark-neon::after { background: linear-gradient(115deg, transparent 44%, rgba(255,255,255,.055) 45%, transparent 46%); }
.preset-viper-green { color: #d9ffe4; background: radial-gradient(circle at 70% 30%, #1d6a3c, transparent 38%), #050907; }
.preset-viper-green::after { inset: 5%; border: 1px solid rgba(141,231,172,.28); box-shadow: inset 0 0 40px rgba(69,255,130,.07); }
.preset-viper-green .lyric-active { font-style: italic; letter-spacing: -.055em; }
.preset-blood-red { color: #fff1ef; background: linear-gradient(155deg, #160406, #080203 60%, #34080d); }
.preset-blood-red::after { background: radial-gradient(ellipse at 50% 110%, rgba(180,19,34,.5), transparent 48%); }
.preset-blood-red .lyric-active { font-family: Georgia, serif; font-style: italic; }
.preset-luxury-black { color: #f0dfaa; background: radial-gradient(circle at 50% 30%, #242016, transparent 42%), #030303; }
.preset-luxury-black::after { inset: 6%; border: 1px solid rgba(240,223,170,.32); }
.preset-luxury-black .lyric-active { font-family: Georgia, serif; font-weight: 500; letter-spacing: .03em; }
.preset-glam-metal { color: #fff; background: linear-gradient(135deg, #58144d, #0b0b12 53%, #15515a); }
.preset-glam-metal::after { background: linear-gradient(118deg, transparent 34%, rgba(255,255,255,.18) 35%, transparent 37% 63%, rgba(86,217,232,.12) 64%, transparent 66%); }
.preset-glam-metal .lyric-active { color: #ffb8e5 !important; text-shadow: 4px 4px 0 #176b73 !important; transform: skewY(-3deg); }
.preset-vhs-glitch { color: #f7f7f7; background: linear-gradient(120deg, #151023, #071f24); box-shadow: 7px 0 #db4777, -7px 0 #36cbd2, 0 28px 70px rgba(0,0,0,.5); }
.preset-vhs-glitch::after { background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.045) 3px 4px); }
.preset-vhs-glitch .lyric-active { text-shadow: 4px 0 #db4777, -4px 0 #36cbd2 !important; }
.preset-sad-lyrics { color: #e8efff; background: radial-gradient(circle at 50% 0, #314460, transparent 42%), linear-gradient(#0b101a, #05070c); }
.preset-sad-lyrics::after { background: linear-gradient(90deg, transparent 49.8%, rgba(220,233,255,.12) 50%, transparent 50.2%); }
.preset-sad-lyrics .lyric-active { font-family: Georgia, serif; font-weight: 400; text-transform: none; }
.preset-clean-tiktok { color: #111; background: linear-gradient(145deg, #fff, #ecece7); }
.preset-clean-tiktok::after { inset: auto 8% 7%; height: 4px; background: linear-gradient(90deg, #ff3158 0 48%, #20d5d2 48%); }
.preset-clean-tiktok .lyric-active { font-family: Arial, sans-serif; font-weight: 900; letter-spacing: -.06em; }
.preset-clean-tiktok .lyric-neighbor,
.preset-clean-tiktok .canvas-kicker,
.preset-clean-tiktok .canvas-counter { color: rgba(0,0,0,.4); }

.preview-toolbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.preview-toolbar .icon-button {
  width: 42px;
  padding: 0;
  border-color: var(--border);
  background: #0c0e13;
}

.preview-toolbar .is-active {
  border-color: var(--violet);
  color: var(--violet-bright);
}

.anim-fade-in { animation: fade-in .45s ease both; }
.anim-zoom-in { animation: zoom-in .45s ease both; }
.anim-slide-up { animation: slide-up .45s ease both; }
.anim-slide-down { animation: slide-down .45s ease both; }
.anim-slide-left { animation: slide-left .45s ease both; }
.anim-slide-right { animation: slide-right .45s ease both; }
.anim-blur-reveal { animation: blur-reveal .55s ease both; }
.anim-glow-pulse { animation: glow-pulse .8s ease both; }
.anim-neon-flicker { animation: neon-flicker .65s steps(2) both; }
.anim-typewriter { animation: fade-in .3s ease both; }
.anim-glitch { animation: glitch .45s steps(2) both; }
.anim-bounce { animation: bounce .55s ease both; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.72); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(35px); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-35px); } }
@keyframes slide-left { from { opacity: 0; transform: translateX(35px); } }
@keyframes slide-right { from { opacity: 0; transform: translateX(-35px); } }
@keyframes blur-reveal { from { opacity: 0; filter: blur(14px); } }
@keyframes glow-pulse { 50% { filter: brightness(1.8); } }
@keyframes neon-flicker { 0%, 30%, 60% { opacity: .2; } 20%, 45%, 100% { opacity: 1; } }
@keyframes glitch { 25% { transform: translate(5px, -2px); } 55% { transform: translate(-5px, 2px); } }
@keyframes bounce { 0% { opacity: 0; transform: translateY(-24px); } 60% { transform: translateY(8px); } }

@media (max-width: 1280px) {
  .lyric-workspace { grid-template-columns: 280px minmax(430px, 1fr); }
  .lyric-preview-panel { grid-column: 1 / -1; position: static; max-height: none; min-height: 620px; }
}

@media (max-width: 1080px) {
  .lyric-workspace { grid-template-columns: 280px 1fr; }
  .lyric-workspace .preview-panel { grid-column: 1 / -1; }
  .lyric-preview-panel {
    position: static;
    max-height: none;
  }
  .controls-panel,
  .lines-panel { max-height: none; }
}

@media (max-width: 760px) {
  .lyric-workspace { display: flex; }
  .lyric-workspace > .panel { width: 100%; }
  .controls-scroll { max-height: none; }
  .lines-panel { min-height: 520px; }
  .lyric-preview-stage { min-height: 560px; padding: 20px; }
  .lyric-canvas { height: auto; }
}
