:root {
  --color-primary: #1e1b4b;
  --color-on-primary: #ffffff;
  --color-secondary: #4338ca;
  --color-accent: #22c55e;
  --color-background: #0f0f23;
  --color-foreground: #f8fafc;
  --color-muted: #27273b;
  --color-border: #312e81;
  --color-destructive: #ef4444;
  --color-ring: #818cf8;
  --surface: #16162e;
  --surface-2: #1c1c38;
  --text-muted: #94a3b8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --font: Inter, "Segoe UI", system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(67, 56, 202, 0.35), transparent 50%),
    radial-gradient(800px 400px at 90% 110%, rgba(34, 197, 94, 0.12), transparent 45%),
    var(--color-background);
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand.compact h1 {
  font-size: 1rem;
  line-height: 1.2;
}

.brand-kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-lead {
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-5);
}

.login-card label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-4);
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: start;
}

.password-row input {
  margin-bottom: var(--space-4);
}

.form-error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--color-muted);
  color: var(--color-foreground);
  font-weight: 600;
  transition: background 180ms ease, border-color 180ms ease, transform 120ms ease;
}

.btn:hover {
  background: #32324f;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  width: 100%;
  background: var(--color-secondary);
  color: var(--color-on-primary);
}

.btn.primary:hover {
  background: #4f46e5;
}

.btn.ghost {
  background: transparent;
  border-color: var(--color-border);
  min-height: 40px;
}

.btn.danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.text-btn {
  background: none;
  border: 0;
  color: var(--color-ring);
  min-height: 44px;
  padding: 0 var(--space-2);
  font-weight: 600;
}

.app-body {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.chrome {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 200;
  overflow: visible;
}

.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 0 8px 0 10px;
  background: #101028;
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 210;
  overflow: visible;
}

.menubar-brand {
  margin-right: 10px;
  gap: 8px;
}

.brand-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.menus {
  display: flex;
  align-items: center;
  gap: 2px;
}

.menu {
  position: relative;
  z-index: 1;
}

.menu.open {
  z-index: 20;
}

.menu-btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--color-foreground);
  font-weight: 600;
  font-size: 0.8125rem;
  position: relative;
  z-index: 2;
}

.menu-btn:hover,
.menu.open .menu-btn {
  background: rgba(67, 56, 202, 0.5);
}

.menu-panel {
  display: none;
  position: fixed;
  top: 32px;
  left: 80px;
  z-index: 4000;
  min-width: 268px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #1a1a34;
  box-shadow: var(--shadow);
}

.menu.open .menu-panel {
  display: flex;
  flex-direction: column;
}

.menu-panel button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
}

.menu-panel button:hover:not(:disabled) {
  background: var(--color-secondary);
}

.menu-panel button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.accel {
  color: var(--text-muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
}

.menubar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.transport-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 52px;
  padding: 0 var(--space-4);
  position: relative;
  z-index: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--surface);
}

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 120ms ease;
}

.icon-btn.small {
  width: 36px;
  height: 36px;
}

.icon-btn:hover {
  background: #32324f;
}

.icon-btn.play {
  background: var(--color-accent);
  color: #052e16;
  border-color: transparent;
}

.icon-btn.play[data-playing="true"] {
  background: #86efac;
}

.icon-btn.record {
  background: var(--color-muted);
}

.icon-btn.record[aria-pressed="true"] {
  background: var(--color-destructive);
  border-color: transparent;
}

.record-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-destructive);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.icon-btn.record[aria-pressed="true"] .record-dot {
  background: white;
  box-shadow: none;
}

.timecode {
  min-width: 96px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--color-foreground);
  text-align: left;
  margin-left: var(--space-2);
}

.user-chip {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 var(--space-2);
}

.file-btn {
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 0;
  position: relative;
  z-index: 0;
}

.track-lane {
  border-right: 1px solid var(--color-border);
  background: var(--surface);
  overflow: auto;
}

.lane-header {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
}

.track-header {
  height: 120px;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px;
}

.track-header.active {
  background: rgba(67, 56, 202, 0.18);
}

.track-name {
  width: 100%;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--color-foreground);
  font-weight: 600;
  padding: 0;
}

.track-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chip {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.chip.on {
  color: var(--color-foreground);
  background: var(--color-secondary);
  border-color: transparent;
}

.chip.arm.on {
  background: var(--color-destructive);
}

.chip.solo.on {
  background: #ca8a04;
  color: #fff;
}

.chip.mute.on {
  background: #334155;
  color: #e2e8f0;
}

.track-fader {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: center;
}

.track-fader input[type="range"] {
  width: 100%;
  height: 24px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.vol-label {
  min-width: 58px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.field.check label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  color: var(--color-foreground);
}

.modal {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--color-foreground);
  padding: var(--space-5);
  width: min(420px, 92vw);
}

.modal::backdrop {
  background: rgba(8, 8, 20, 0.72);
}

.modal h2 {
  margin: 0 0 var(--space-4);
  font-size: 1.1rem;
}

.modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.modal select,
.modal input[type="url"],
.modal input[type="text"] {
  width: 100%;
  height: 40px;
  margin-bottom: var(--space-4);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  padding: 0 var(--space-3);
}

.clip-fx-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 16px;
  border-top: 1px solid var(--color-border);
  background: #14142c;
}

.clip-fx-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 8px;
}

.fx-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fx-icon:hover {
  background: #32324f;
}

.fx-icon.on {
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}

#btn-pitch-map {
  min-height: 40px;
  margin-left: 8px;
}

#btn-pitch-map.on {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.clip-detail-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #0f0f23;
  z-index: 5000;
  box-sizing: border-box;
  overflow: hidden;
}

.clip-detail-modal::backdrop {
  background: #05050c;
}

.clip-detail-chrome {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  height: 100%;
  width: 100%;
  min-height: 0;
}

.clip-detail-modal[data-editor-mode="tune"] .clip-detail-chrome {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.clip-detail-modal[data-editor-mode="tune"] [data-edit-only] {
  display: none !important;
}

.clip-detail-modal[data-editor-mode="edit"] [data-tune-only] {
  display: none !important;
}

.clip-mode-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: #1a1a1f;
  border: 1px solid #2e2e33;
}

.clip-mode-tab {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clip-mode-tab.on {
  background: #2a2a2e;
  color: #4cff8b;
}

.autotune-bar,
.flexpitch-bar,
.flexpitch-note-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border);
  background: #0a0a14;
}

.flexpitch-note-bar {
  background: #0d1520;
}

.flexpitch-note-bar[hidden] {
  display: none;
}

.flexpitch-note-hint {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* —— Topline-inspired Vocal Tune surface —— */
.tvt-panel {
  --tvt-bg: #1c1c1e;
  --tvt-panel: #141416;
  --tvt-chrome: #2a2a2e;
  --tvt-neon: #4cff8b;
  --tvt-neon-dim: rgba(76, 255, 139, 0.35);
  --tvt-text: #e8e8ea;
  --tvt-muted: #8b8b90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px 16px 16px;
  background:
    radial-gradient(120% 80% at 50% 0%, #242428 0%, var(--tvt-bg) 55%),
    var(--tvt-bg);
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--tvt-text);
  overflow: auto;
}

.tvt-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.tvt-brand {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: #f3f3f4;
}

.tvt-scale {
  margin-left: 4px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #3a3a40;
  background: #101012;
  color: var(--tvt-neon);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  max-width: min(280px, 50vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tvt-scale:hover {
  border-color: var(--tvt-neon);
}

.tvt-top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.tvt-mini {
  height: 30px;
  padding: 0 12px;
  font-size: 0.75rem;
}

.tvt-stage {
  display: grid;
  grid-template-rows: minmax(160px, 1fr) auto;
  gap: 8px;
  min-height: 220px;
  padding: 12px 14px 14px;
  border-radius: 12px;
  background: var(--tvt-panel);
  border: 1px solid #2c2c30;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tvt-viz {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
}

.tvt-waves {
  position: absolute;
  inset: 8% 10%;
  width: 80%;
  height: 84%;
  opacity: 0.9;
  pointer-events: none;
}

.tvt-wave-path {
  animation: tvt-wave 3.6s ease-in-out infinite;
  transform-origin: center;
}

.tvt-wave-path.delay {
  animation-delay: -1.2s;
}

.tvt-wave-path.delay2 {
  animation-delay: -2.1s;
}

@keyframes tvt-wave {
  0%,
  100% {
    transform: scaleY(0.92) scaleX(1);
    opacity: 0.55;
  }
  50% {
    transform: scaleY(1.08) scaleX(1.02);
    opacity: 1;
  }
}

.tvt-note-orb {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, #3a3a40 0%, #1a1a1e 70%);
  border: 2px solid var(--tvt-neon);
  box-shadow:
    0 0 18px var(--tvt-neon-dim),
    0 0 42px rgba(76, 255, 139, 0.18),
    inset 0 0 18px rgba(76, 255, 139, 0.12);
  animation: tvt-glow 2.4s ease-in-out infinite;
}

.tvt-note-orb.live {
  border-color: #7dffad;
}

@keyframes tvt-glow {
  0%,
  100% {
    box-shadow:
      0 0 14px var(--tvt-neon-dim),
      0 0 28px rgba(76, 255, 139, 0.12);
  }
  50% {
    box-shadow:
      0 0 22px rgba(76, 255, 139, 0.55),
      0 0 48px rgba(76, 255, 139, 0.28);
  }
}

.tvt-note-letter {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--tvt-neon);
  line-height: 1;
  text-shadow: 0 0 12px var(--tvt-neon-dim);
}

.tvt-piano {
  display: flex;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #333338;
  background: #0e0e10;
  user-select: none;
  touch-action: none;
}

.tvt-key {
  position: relative;
  flex: 1 1 0;
  border: 0;
  border-right: 1px solid #2a2a2e;
  background: #d6d6d8;
  cursor: pointer;
  padding: 0;
  min-width: 0;
}

.tvt-key:last-child {
  border-right: 0;
}

.tvt-key.black {
  flex: 0.62 1 0;
  background: #1a1a1e;
  z-index: 1;
  margin: 0 -1px;
  height: 62%;
  border-right: 1px solid #0a0a0c;
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
}

.tvt-key.in-scale:not(.black) {
  background: #f0f0f2;
  box-shadow: inset 0 -3px 0 #4cff8b66;
}

.tvt-key.in-scale.black {
  background: #2e2e34;
  box-shadow: inset 0 -2px 0 #4cff8b88;
}

.tvt-key.active,
.tvt-key:active {
  background: #4cff8b !important;
  box-shadow: 0 0 12px var(--tvt-neon-dim);
}

.tvt-key.black.active,
.tvt-key.black:active {
  background: #2fd46e !important;
}

.tvt-macros {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1.6fr;
  gap: 0;
  padding: 8px 4px 4px;
  border-top: 1px solid #2e2e33;
}

.tvt-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-right: 1px solid #2e2e33;
}

.tvt-section:last-child {
  border-right: 0;
}

.tvt-section-title {
  margin: 0;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tvt-muted);
}

.tvt-knob-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.tvt-knob {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 72px;
}

.tvt-knob-lg {
  width: 88px;
}

.tvt-knob-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--tvt-neon) calc(var(--pct) * 1%), #3a3a40 0);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px #111;
  transition: filter 120ms ease;
}

.tvt-knob-lg .tvt-knob-ring {
  width: 72px;
  height: 72px;
}

.tvt-knob-ring.muted {
  background: conic-gradient(#5a5a60 calc(var(--pct) * 1%), #2e2e32 0);
}

.tvt-knob-cap {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: linear-gradient(160deg, #3a3a40, #1a1a1e);
  border: 1px solid #4a4a50;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.tvt-knob input[type="range"] {
  position: absolute;
  inset: 0 0 28px;
  width: 100%;
  height: calc(100% - 28px);
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.tvt-knob-label {
  font-size: 0.68rem;
  color: #c4c4c8;
  text-align: center;
}

.tvt-knob-label em {
  font-style: normal;
  color: #6b7280;
  font-size: 0.58rem;
}

.tvt-knob-val {
  font-size: 0.65rem;
  color: var(--tvt-muted);
  font-variant-numeric: tabular-nums;
}

.tvt-knob:active .tvt-knob-ring:not(.muted) {
  filter: brightness(1.12);
}

.tvt-depth {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 0.68rem;
  color: var(--tvt-muted);
}

.tvt-depth input[type="range"] {
  flex: 1;
  accent-color: var(--tvt-neon);
}

.tvt-mode-dot {
  width: 14px;
  height: 14px;
  margin-top: 22px;
  border-radius: 50%;
  border: 1px solid #3b82f6;
  background: #1e3a5f;
  padding: 0;
  flex-shrink: 0;
}

.tvt-mode-dot.on {
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.65);
}

.tvt-shift-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.tvt-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.tvt-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tvt-switch-ui {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #2a2a2e;
  border: 1px solid #444;
  position: relative;
}

.tvt-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #888;
  transition: transform 150ms ease, background 150ms ease;
}

.tvt-switch input:checked + .tvt-switch-ui {
  border-color: var(--tvt-neon);
}

.tvt-switch input:checked + .tvt-switch-ui::after {
  transform: translateX(14px);
  background: var(--tvt-neon);
}

.tvt-shift.disabled-look .tvt-shift-row {
  opacity: 0.45;
}

.tvt-stub {
  opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
  .tvt-wave-path,
  .tvt-note-orb {
    animation: none;
  }
}

@media (max-width: 900px) {
  .tvt-macros {
    grid-template-columns: 1fr;
  }

  .tvt-section {
    border-right: 0;
    border-bottom: 1px solid #2e2e33;
  }

  .tvt-section:last-child {
    border-bottom: 0;
  }
}

.autotune-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.autotune-scale-chip {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 4px 10px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.autotune-scale-chip:hover {
  border-color: #38bdf8;
  color: #f8fafc;
}

.autotune-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.autotune-field select,
.autotune-field input[type="range"] {
  accent-color: #38bdf8;
}

.autotune-field select {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: #12122a;
  color: var(--color-foreground);
  padding: 0 8px;
}

.autotune-field input[type="range"] {
  width: 110px;
}

.ctx-menu {
  position: fixed;
  z-index: 9000;
  min-width: 220px;
  max-width: min(320px, 92vw);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid #2a2a3d;
  background: #050508;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  color: #e2e8f0;
}

.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.ctx-item:hover:not(:disabled) {
  background: #161622;
}

.ctx-item:disabled {
  opacity: 0.35;
  cursor: default;
}

.ctx-item.danger {
  color: #fca5a5;
}

.ctx-sep {
  height: 1px;
  margin: 4px 6px;
  background: #222233;
}

.ctx-heading {
  padding: 6px 12px 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7c88a3;
}

.clip-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--color-border);
}

.clip-detail-head h2 {
  margin: 0;
  margin-right: auto;
  font-size: 1.05rem;
}

.clip-detail-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-chip:has(input:checked) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.clip-detail-chrome > .hint {
  margin: 0;
  padding: 8px 16px;
}

.clip-detail-canvas-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
}

#clip-detail-canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--color-border);
  background: #101028;
  touch-action: none;
}

.clip-detail-modal .btn.primary {
  width: auto;
}

@media (max-width: 720px) {
  .clip-detail-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .clip-detail-head {
    gap: 8px;
    padding: 10px 12px 8px;
  }
}

.scale-chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.scale-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.root-scale-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.root-scale-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-muted-foreground, #94a3b8);
}

.root-scale-label {
  color: var(--color-accent, #22c55e);
}

.root-scale-field select {
  height: 32px;
  min-width: 5.5rem;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #0f172a;
  color: var(--color-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.root-scale-field select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.root-scale-hint {
  font-size: 0.75rem;
  color: var(--color-muted-foreground, #94a3b8);
}

@media (max-width: 900px) {
  .root-scale-hint {
    display: none;
  }
}

.scale-modal {
  width: min(640px, 96vw);
  max-height: min(92vh, 900px);
}

.scale-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 12px;
}

.scale-controls label {
  margin: 0;
}

.scale-controls #scale-play-speed {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent, #c45c26);
}

.scale-speed-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  opacity: 0.85;
  white-space: nowrap;
  min-width: 4.5rem;
}

.scale-style-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.scale-tab {
  border: 1px solid var(--color-border, #334155);
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

.scale-tab.on {
  background: #1e293b;
  border-color: #38bdf8;
  color: #f8fafc;
}

.scale-search-label {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0 0 4px;
}

#scale-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
}

.scale-library-list {
  max-height: 180px;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #020617;
  margin-bottom: 8px;
}

.scale-library-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #1e293b;
  background: transparent;
  color: #e2e8f0;
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.scale-library-item:hover {
  background: #1e293b;
}

.scale-library-item.on {
  background: #0c4a6e;
  color: #f0f9ff;
}

.scale-library-item .scale-item-meta {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}

.scale-aro-line {
  min-height: 2.4em;
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.scale-select-btn {
  min-width: 9rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--color-border, #334155);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.scale-select-btn:hover,
.scale-select-btn:focus {
  border-color: #38bdf8;
  outline: none;
}

.scale-piano .white-key.playing,
.scale-piano .black-key.playing {
  background: #fbbf24 !important;
  color: #422006 !important;
  border-color: #d97706 !important;
}

.scale-piano {
  position: relative;
  height: 140px;
  margin: 0 0 12px;
  user-select: none;
}

.scale-piano .white-keys {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  height: 100%;
}

.scale-piano .white-key {
  border: 1px solid #334155;
  border-radius: 0 0 8px 8px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
}

.scale-piano .white-key.on {
  background: #22c55e;
  border-color: #166534;
  color: #052e16;
}

.scale-piano .black-keys {
  position: absolute;
  inset: 0 0 auto;
  height: 58%;
  pointer-events: none;
}

.scale-piano .black-key {
  position: absolute;
  top: 0;
  width: 9.5%;
  height: 100%;
  border: 1px solid #020617;
  border-radius: 0 0 6px 6px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  z-index: 2;
}

.scale-piano .black-key.on {
  background: #4ade80;
  color: #052e16;
  border-color: #166534;
}

.tuner-chip {
  margin-left: 4px;
}

.tuner-modal {
  width: min(420px, 94vw);
}

.tuner-display {
  text-align: center;
  margin: 8px 0 4px;
}

.tuner-note {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f8fafc;
  line-height: 1.1;
}

.tuner-hz {
  font-size: 1.1rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.tuner-cents {
  font-size: 1.25rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.tuner-cents.in-tune {
  color: #4ade80;
}

.tuner-swara {
  margin-top: 6px;
  color: #7dd3fc;
  font-size: 0.95rem;
}

.tuner-gauge {
  display: block;
  width: min(280px, 100%);
  margin: 8px auto 4px;
}

.tuner-bar-track {
  position: relative;
  height: 10px;
  margin: 8px 0 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #1e293b 45%, #22c55e 50%, #1e293b 55%, #f97316);
  border: 1px solid #334155;
}

.tuner-bar-center {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: #f8fafc;
  transform: translateX(-50%);
}

.tuner-bar-needle {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  border-radius: 2px;
  background: #f8fafc;
  left: 50%;
  transition: left 0.06s linear;
}

.tuner-bar-needle.in-tune {
  background: #4ade80;
}

.tuner-actions {
  flex-wrap: wrap;
}

.stickiness-field {
  display: grid;
  grid-template-columns: auto 1fr 2.5rem;
  gap: 10px;
  align-items: center;
  margin: 10px 0 0;
}

.stickiness-label {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  white-space: nowrap;
}

.stickiness-field input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent, #38bdf8);
}

.stickiness-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--color-foreground, #e2e8f0);
  text-align: right;
}

.stickiness-hint {
  margin: 4px 0 8px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.fx-preset-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: var(--space-4);
}

.fx-preview-strip {
  margin: 0 0 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: #101028;
  overflow: hidden;
}

#fx-preview-canvas {
  display: block;
  width: 100%;
  height: 72px;
  cursor: ew-resize;
  touch-action: none;
}

.fx-preset-row label {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.fx-preset-row select {
  margin-bottom: 0;
}

.fx-preset-row .btn {
  min-height: 40px;
}

.fx-sliders {
  display: grid;
  gap: 12px;
  margin-bottom: var(--space-4);
}

.fx-slider {
  display: grid;
  grid-template-columns: 110px 1fr 64px;
  gap: 10px;
  align-items: center;
}

.fx-slider label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.fx-slider input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent);
}

.fx-slider .fx-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--color-foreground);
  text-align: right;
}

.eq-bands {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.eq-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.eq-band input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 28px;
  height: 140px;
  accent-color: var(--color-accent);
}

.eq-band span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.eq-band .fx-val {
  font-variant-numeric: tabular-nums;
  color: var(--color-foreground);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.youtube-copy-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin: 0.35rem 0 0.75rem;
}

.youtube-copy-row input {
  flex: 1;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
}

.youtube-panel code {
  font-size: 0.9em;
}

.new-project-modal {
  width: min(420px, 92vw);
}

.new-project-modal #new-project-message {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--color-foreground, #e2e8f0);
  margin: 0 0 4px;
}

.modal .btn.primary {
  width: auto;
}

.track-fx {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.timeline-wrap {
  min-width: 0;
  overflow: auto;
  background:
    linear-gradient(#12122a, #12122a) 0 0 / 100% 32px no-repeat,
    var(--color-background);
}

#timeline {
  display: block;
  cursor: default;
  touch-action: none;
}

.inspector {
  border-top: 1px solid var(--color-border);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
}

.inspector-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inspector-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 140px;
}

.field.grow {
  flex: 1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.field label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.field input {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  padding: 0 var(--space-3);
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.shortcut-list {
  margin: 0 0 var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.shortcut-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-3);
  align-items: center;
}

.shortcut-list dt {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-foreground);
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 8px;
  text-align: center;
}

.shortcut-list dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.help-modal {
  width: min(460px, 92vw);
}

.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.transpose-modal {
  width: min(420px, 94vw);
}

.transpose-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}

.transpose-semitones {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.transpose-semitones input {
  width: 72px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #12122a;
  color: var(--color-foreground);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
}

.raga-modal {
  width: min(720px, 96vw);
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: hidden;
  position: relative;
}

.raga-list-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  line-height: 1.35;
  cursor: pointer;
}

.raga-list-btn:hover,
.raga-list-btn:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  outline: none;
}

.raga-list-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45);
}

.raga-preview-pop {
  position: absolute;
  z-index: 40;
  width: min(340px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0c0c18;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  color: #e2e8f0;
}

.raga-preview-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.raga-preview-pop-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.raga-preview-pop-title {
  font-size: 1.05rem;
  line-height: 1.25;
}

.raga-preview-pop-meta {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
}

.raga-preview-pop-x {
  flex-shrink: 0;
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.raga-preview-pop-notations {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.raga-preview-pop-notations > div {
  display: grid;
  gap: 2px;
}

.raga-preview-pop-notations dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.raga-preview-pop-notations dd {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.raga-preview-pop-actions {
  display: flex;
  gap: 8px;
}

.raga-preview-pop-play {
  min-width: 88px;
}

.raga-chrome {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  max-height: min(90vh, 900px);
  overflow: auto;
}

.raga-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.raga-head h2 {
  margin: 0;
}

.raga-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.raga-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.raga-field select {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: #12122a;
  color: var(--color-foreground);
  padding: 0 8px;
}

.raga-hist-wrap {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #0a0a14;
  padding: 8px;
}

.live-raga-viz-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-raga-input {
  position: relative;
  min-height: 96px;
}

#live-raga-input-canvas {
  width: 100%;
  height: 96px;
  display: block;
  border-radius: 6px;
}

.live-raga-pitch {
  position: absolute;
  right: 10px;
  top: 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  pointer-events: none;
  text-align: right;
  line-height: 1.15;
}

.live-raga-swara {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s ease, opacity 0.12s ease;
}

.live-raga-hz {
  font-size: 0.72rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.live-raga-pitch.is-idle .live-raga-swara {
  color: #64748b;
  font-weight: 500;
}

.live-raga-pitch.is-soft .live-raga-swara {
  color: #94a3b8;
  opacity: 0.72;
}

.live-raga-pitch.is-soft .live-raga-hz {
  color: #64748b;
}

.live-raga-pitch.is-confident .live-raga-swara {
  color: #7dd3fc;
}

.live-raga-pitch.is-confident .live-raga-hz {
  color: #bae6fd;
}

#raga-histogram {
  width: 100%;
  height: 140px;
  display: block;
}

.raga-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.raga-columns h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.raga-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.raga-list li {
  line-height: 1.35;
}

.raga-list .conf {
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.raga-meta {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.raga-disclaimer {
  margin-top: 4px;
  opacity: 0.85;
}

.live-raga-banner {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-raga-banner:not(:empty) {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #12122a;
}

.live-raga-banner-dwell {
  font-size: 0.85rem;
  color: #94a3b8;
}

#live-raga-histogram {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: 6px;
}

.live-raga-toolbar {
  gap: 8px;
}

#live-raga-shruti[aria-pressed="true"] {
  border-color: #38bdf8;
  color: #e0f2fe;
  background: #1e293b;
}

.raga-compositions {
  margin-top: 4px;
}

.raga-compositions h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.raga-comp-for {
  margin: 0 0 6px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.raga-comp-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.raga-lore {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  background: rgba(30, 27, 75, 0.28);
}

.raga-lore h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.raga-lore h4 {
  margin: 8px 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.raga-train {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f0f1c;
}

.raga-train-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.raga-train-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-right: 4px;
}

.raga-train-status,
.raga-train-hint {
  margin: 8px 0 0;
}

.raga-train-wrong.is-active {
  border-color: #38bdf8;
  color: #e0f2fe;
}

.lore-bhava,
.lore-usage,
.lore-swaras,
.lore-alt {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e2e8f0;
}

.lore-usage {
  color: #cbd5e1;
}

.lore-swaras,
.lore-alt {
  font-size: 0.82rem;
  color: #94a3b8;
}

.lore-swaras strong,
.lore-alt strong {
  color: #cbd5e1;
  font-weight: 600;
}

.lore-pakad ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lore-pakad li,
.lore-phrase {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.86rem;
}

.lore-notes {
  min-width: 0;
  flex: 1 1 auto;
}

.lore-meta {
  flex: 0 0 auto;
  white-space: nowrap;
}

.lore-pakad code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
  padding: 2px 6px;
}

.lore-pakad li.heard code {
  color: #86efac;
  background: rgba(22, 101, 52, 0.28);
}

.lore-pakad li.partial code {
  color: #fde68a;
}

.lore-tag {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
}

.lore-tag.heard {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.18);
}

.lore-tag.partial {
  color: #fde68a;
  background: rgba(234, 179, 8, 0.16);
}

.lore-summary {
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0;
  color: #86efac;
}

.lore-summary.muted {
  color: #64748b;
}

.notate-modal {
  width: min(720px, 96vw);
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: hidden;
}

.notate-chrome {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  max-height: min(90vh, 900px);
  overflow: auto;
}

.notate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notate-head h2 {
  margin: 0;
}

.notate-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.notate-scale {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-right: auto;
}

.notate-view-toggle {
  display: inline-flex;
  gap: 4px;
}

.notate-view.on {
  background: #1e293b;
  color: #f8fafc;
  border-color: #38bdf8;
}

.notate-body {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #0a0a14;
  padding: 14px 16px;
  min-height: 120px;
  max-height: min(50vh, 420px);
  overflow: auto;
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.notate-token {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: #151528;
}

.notate-token.foreign {
  opacity: 0.55;
  font-style: italic;
}

.notate-token .swara {
  color: #fbbf24;
  font-weight: 600;
}

.notate-token .west {
  color: #93c5fd;
  font-weight: 500;
}

.notate-token .sep {
  color: #64748b;
  margin: 0 2px;
}

.notate-plain {
  white-space: pre-wrap;
  color: #e2e8f0;
}

.notate-legend {
  margin: 0;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .raga-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: var(--space-2) var(--space-3);
  }

  .app-body {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .menubar {
    flex-wrap: wrap;
    min-height: 0;
    padding: 6px 8px;
  }

  .workspace {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .top-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
