/* Secret Lyrics — local styles
   Tokens, reset, body, .chip, focus-visible live in /assets/base.css.
   This file overrides only what's specific to this app. */

html, body { height: 100%; }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- top bar ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  flex-shrink: 0;
}
.brand-link { color: inherit; }
.brand-mark {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
.brand-link:hover .brand-mark { opacity: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- shared motion ---------- */
:root {
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.32, 1.6, 0.4, 1);
  --t-fast: 0.12s;
  --t-med: 0.22s;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- buttons ---------- */
.ghost,
.ghost-sm,
.primary,
.chip {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.ghost:active:not(:disabled),
.primary:active:not(:disabled),
.chip:active:not(:disabled) {
  transform: scale(0.97);
}
.ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 7px 14px;
}
.ghost:hover:not(:disabled) { color: var(--text); }
.ghost-sm {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
}
.ghost-sm:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.primary {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  padding: 7px 16px;
  font-weight: 600;
}
.primary:hover:not(:disabled) { opacity: 0.9; }
.ghost:disabled, .primary:disabled, .chip:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- topbar divider ---------- */
.topbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ---------- play button (icon-driven) ---------- */
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.play-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
}
.play-btn:active:not(:disabled) { transform: scale(0.97); }
.play-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.play-btn svg { display: block; }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-pause { display: block; }

/* ---------- mode switch (Dynamic ⇄ Static) ---------- */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  transition: color var(--t-fast) var(--ease);
}
.mode-switch:hover { color: var(--text); }
.mode-track {
  position: relative;
  width: 32px;
  height: 18px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  transition: background var(--t-med) var(--ease);
}
.mode-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  transition: transform var(--t-med) var(--ease-spring);
}
.mode-switch[aria-checked="true"] .mode-track { background: var(--accent); }
.mode-switch[aria-checked="true"] .mode-thumb { transform: translateX(14px); }
.mode-label { min-width: 56px; text-align: left; }

/* ---------- style picker popover ---------- */
.style-picker { position: relative; }
.has-caret {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.has-caret:hover { border-color: var(--accent); }
.style-swatch-mini {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  background: #fafafa;     /* default = Light */
  display: inline-block;
}
.has-caret .caret {
  font-size: 10px;
  color: var(--muted);
  transition: transform var(--t-fast) var(--ease);
}
.has-caret[aria-expanded="true"] .caret { transform: rotate(-180deg); }
.style-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  min-width: 180px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.style-popover.hidden { display: none; }
.style-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.style-popover-item:hover { background: rgba(255,255,255,0.05); }
.style-popover-item.active { background: var(--accent-soft); }
.style-popover-item .swatch {
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0;
  border: 1px solid var(--line);
}
.style-popover-item .label { flex: 1; }
.style-popover-item .check { color: var(--accent); font-size: 14px; opacity: 0; }
.style-popover-item.active .check { opacity: 1; }

/* ---------- toasts ---------- */
.toast-stack {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(20, 20, 28, 0.95);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease-spring);
}
.toast.toast-out { animation: toast-out 0.2s var(--ease) forwards; }
.toast-success { border-color: var(--accent); }
.toast-error { border-color: #ff5e5e; color: #ff8e8e; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}
.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
}
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip.block { display: block; width: 100%; text-align: center; margin-top: 8px; }

/* ---------- layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  grid-template-rows: 1fr;
  gap: 28px;
  padding: 0 24px 24px;
  min-height: 0;
  overflow: hidden;
}
.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.panel.left, .panel.right { overflow-y: auto; }
.panel.center { gap: 16px; }

/* ---------- helpers ---------- */
.muted { color: var(--muted); }
.hint { font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }
kbd {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- inputs ---------- */
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { border-color: var(--accent); }
textarea {
  min-height: 110px;
  max-height: 240px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- left panel: dropzone, tabs, lyric input ---------- */
.dropzone {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: rgba(255,255,255,0.02);
}
.dropzone.reject {
  border-color: #ff5e5e;
  background: rgba(255,94,94,0.05);
  cursor: not-allowed;
}
.drop-text { display: block; font-weight: 500; font-size: 14px; }
.drop-sub { display: block; font-size: 11px; margin-top: 4px; letter-spacing: 0.02em; }
.audio-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 0 4px;
}
.meta-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta-time { font-family: var(--font-mono); flex-shrink: 0; }
.audio-unload {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.audio-unload:hover { color: #ff5e5e; background: rgba(255,94,94,0.1); }

.tabs {
  display: flex;
  gap: 2px;
  font-size: 12px;
  padding: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab-panel { display: flex; flex-direction: column; gap: 10px; }

.results { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.result-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: border-color 0.15s ease;
}
.result-item:hover { border-color: var(--accent); }
.result-item .title { font-weight: 600; }
.result-item .sub { color: var(--muted); margin-top: 2px; font-size: 11px; }

/* ---------- center: preview ---------- */
.preview-area {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.preview-frame {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.18s ease, height 0.18s ease;
}
/* Show a checkerboard behind the canvas when the active style is
   transparent, so the user can clearly see what's transparent. */
body.style-transparent .preview-frame {
  background-color: #1a1a1f;
  background-image:
    linear-gradient(45deg, #2a2a32 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a32 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a32 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a32 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
#preview {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- timeline editor (bottom panel) ---------- */
.timeline-editor {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 180px;
  background: rgba(255,255,255,0.015);
  border-top: 1px solid var(--line);
}
.tl-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tl-time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tl-time-sep { color: var(--muted); }
.tl-spacer { flex: 1; }
.tl-hint { font-size: 11px; }

.tl-tracks {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}
.tl-labels {
  width: 56px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.18);
  border-right: 1px solid var(--line);
}
.tl-label {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tl-label:last-child { border-bottom: 0; }
.tl-label-ruler { height: 22px; flex: 0 0 auto; }

.tl-scroll {
  flex: 1;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
}
.tl-scroll::-webkit-scrollbar { height: 6px; }
.tl-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 4px; }
.tl-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

.tl-bodies {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;            /* JS sets this to (zoom * 100)% */
  height: 100%;
  min-height: 0;
}

/* Zoom controls in the timeline toolbar. */
.tl-zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tl-zoom .ghost-sm { padding: 2px 8px; font-family: var(--font-mono); }
#zoom-level { min-width: 36px; text-align: center; }
.tl-row {
  position: relative;
  flex: 1;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-height: 0;
}
.tl-row:last-of-type { border-bottom: 0; }

/* Ruler — tick marks at fixed intervals. */
.tl-row.tl-ruler {
  flex: 0 0 22px;
  background: rgba(0,0,0,0.18);
}
.tl-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.06);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tl-tick::after {
  content: attr(data-label);
  position: absolute;
  left: 4px;
  top: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* Waveform track */
.tl-waveform { background: rgba(0,0,0,0.06); }
#waveform { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; display: block; }

/* Words track */
.tl-words { background: rgba(0,0,0,0.04); }
.word-blocks { position: absolute; inset: 0; pointer-events: none; }
.word-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  display: flex;
  align-items: center;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.word-block:hover { background: rgba(255, 255, 255, 0.18); }
.word-block:active { cursor: grabbing; }
.word-block.is-active { background: var(--accent); color: #0b0b12; border-color: var(--accent); font-weight: 600; }
.word-block.dragging { opacity: 0.7; }

/* Playhead — vertical line spanning the bodies (not the labels). */
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(to bottom, transparent, var(--accent) 6%, var(--accent) 94%, transparent);
  pointer-events: none;
  z-index: 6;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.waveform-wrap {
  position: relative;
  width: 100%;
  height: 64px;
}
#waveform { width: 100%; height: 100%; cursor: crosshair; display: block; }
/* Lyric blocks overlaid on the waveform — drag to retime, click to seek. */
.lyric-blocks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.lyric-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(138, 124, 255, 0.20);
  border: 1px solid rgba(138, 124, 255, 0.6);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.lyric-block:hover { background: rgba(138, 124, 255, 0.36); }
.lyric-block:active { cursor: grabbing; }
.lyric-block.is-active {
  background: var(--accent);
  color: #0b0b12;
  border-color: var(--accent);
  font-weight: 600;
}
.lyric-block.dragging { opacity: 0.7; }
.seek-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: crosshair;
  z-index: 2;
}
.waveform-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.waveform-status.hidden { display: none; }

.time-bar {
  display: flex;
  align-items: center;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 0 4px;
}
.time-spacer { flex: 1; }

/* ---------- right: sync editor ---------- */
.sync-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.sync-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  flex: 1;
}
.lyric-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lyric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.4;
  transition: background 0.15s ease;
}
.lyric-row:hover { background: rgba(255,255,255,0.03); }
.lyric-row.active { background: rgba(255,255,255,0.06); }
.lyric-row.dragging { opacity: 0.4; }
.add-line {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}
.add-line:hover { color: var(--accent); }
.waveform-wrap.drop-target #waveform,
#waveform.drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.lyric-row.synced .time { color: var(--accent); }
.lyric-row .time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}
.lyric-row .text-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lyric-row .del {
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.lyric-row:hover .del { opacity: 1; }
.lyric-row .del:hover { color: var(--accent); }
.lyric-edit {
  width: 100%;
  padding: 4px 6px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  outline: none;
}
.time-edit {
  width: 100%;
  padding: 2px 4px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  outline: none;
  box-sizing: border-box;
}
.lyric-row .time, .word-row .time { cursor: text; }
.lyric-row .time:hover, .word-row .time:hover { color: var(--accent); }
.word-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  letter-spacing: 0.04em;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
}
.word-badge:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* Word sub-rows shown when a line is expanded. */
.word-row {
  display: grid;
  grid-template-columns: 48px 1fr 18px;
  gap: 8px;
  align-items: center;
  padding: 4px 4px 4px 24px;     /* indented from line rows */
  margin-bottom: 2px;
  border-radius: 6px;
  cursor: grab;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  transition: background 0.15s ease;
  user-select: none;
}
.word-row:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.word-row.dragging { opacity: 0.4; }
.word-row.synced .time { color: var(--accent); }
.word-row .time {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  color: var(--muted);
}
.word-row .text-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.word-row .del {
  color: var(--muted); border: 0; background: transparent; cursor: pointer;
  padding: 0; font-size: 14px; line-height: 1; opacity: 0;
  transition: opacity 0.15s ease;
}
.word-row:hover .del { opacity: 1; }
.word-row .del:hover { color: var(--accent); }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  z-index: 50;
  backdrop-filter: blur(6px);
}
.modal-card {
  width: min(440px, 92vw);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.modal-card h2 {
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 16px;
}
.form-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.form-row select {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  font: inherit;
}
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}
.bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  transition: width 0.2s ease;
}
.export-progress { margin: 14px 0 0; }

/* ---------- shortcuts dialog ---------- */
.ghost-icon {
  width: 28px;
  height: 28px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid var(--line);
}
.shortcut-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shortcut-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.shortcut-list kbd {
  text-align: center;
  padding: 3px 6px;
  font-size: 12px;
}

/* ---------- mobile floating tap bar ---------- */
.mobile-fab {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 80px;        /* above the mobile-tabbar */
  z-index: 9;
  padding: 0 12px;
  gap: 8px;
}
.mobile-fab button {
  flex: 1;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: #0b0b12;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease;
}
.mobile-fab button:active { transform: scale(0.96); }
@media (max-width: 900px) {
  .mobile-fab:not(.hidden) { display: flex; }
}

/* ---------- footer ---------- */
footer {
  text-align: center;
  padding: 4px;
  color: var(--muted);
  font-size: 10px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  gap: 12px;
}
.footer-shortcuts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 11px;
}
.footer-shortcuts kbd { margin-right: 2px; }
.footer-credit { font-size: 10px; opacity: 0.6; flex-shrink: 0; }
@media (max-width: 700px) {
  .footer-shortcuts { display: none; }
  .app-footer { justify-content: center; }
}

/* ---------- mobile tabbar (created via JS) ---------- */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(11, 11, 18, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 4px;
  gap: 2px;
}
.mobile-tabbar button {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.mobile-tabbar button.active { background: rgba(255,255,255,0.06); color: var(--text); }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* ---------- responsive ---------- */
/* Big desktops: more breathing room + taller timeline. */
@media (min-width: 1500px) {
  .layout { grid-template-columns: minmax(280px, 320px) 1fr minmax(280px, 320px); gap: 32px; }
  .timeline-editor { height: 220px; }
}

/* Default desktop is the current 280/1fr/300. Step down at narrower widths. */
@media (max-width: 1280px) {
  .layout { grid-template-columns: minmax(220px, 260px) 1fr minmax(220px, 260px); gap: 22px; }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(200px, 240px) 1fr minmax(200px, 240px); gap: 16px; }
  .timeline-editor { height: 150px; }
  .tl-controls { padding: 4px 10px; font-size: 11px; }
}

/* Tablet → stacked panels with mobile tab switcher. */
@media (max-width: 900px) {
  body { overflow: auto; }
  .layout {
    display: block;
    padding: 0 12px 80px;
  }
  .panel { display: none; margin-bottom: 16px; }
  .panel.mobile-show { display: flex; }
  .panel.center.mobile-show { height: calc(100vh - 80px - 80px); }
  .preview-area { min-height: 60vh; }
  .mobile-tabbar { display: flex; }

  .top { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .top-actions { gap: 4px; flex-wrap: wrap; }
  .timeline-editor { height: 140px; }
  .tl-labels { width: 44px; }
  .tl-label { padding: 0 6px; font-size: 9px; }
  textarea, input[type="text"], input[type="password"] { padding: 12px; font-size: 16px; }
}

/* Phone-ish — compress topbar, icon-only play. */
@media (max-width: 700px) {
  .topbar-divider { display: none; }
  .top-actions .ghost { padding: 5px 9px; font-size: 12px; }
  .play-btn { padding: 5px 11px 5px 9px; font-size: 12px; gap: 0; }
  .play-label { display: none; }
}

/* Phone — hide Open/Save chips and brand text. */
@media (max-width: 540px) {
  .top { padding: 6px 10px; }
  #btn-open-project, #btn-save-project { display: none; }
  .timeline-editor { height: 130px; }
  .tl-controls { gap: 4px; padding: 4px 8px; font-size: 11px; }
  .tl-zoom .ghost-sm { padding: 2px 6px; }
  .tl-hint { display: none; }
  .ghost-icon { width: 26px; height: 26px; }
  .brand-mark { display: none; }
}
