:root {
  --bg: #0d1218;
  --bg-elev: #151c24;
  --bg-elev-2: #1c2630;
  --border: #2a3540;
  --text: #e8eef4;
  --text-dim: #93a0ad;
  --accent: #60a5fa;
  --accent-700: #3b82f6;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --green: #3fb950;
  --green-soft: rgba(63, 185, 80, 0.15);
  --red: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 16px;
}

.brand span {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  transition: width 0.2s ease;
}

.app-sidebar.collapsed {
  width: 56px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-toggle {
  padding: 6px 10px;
  min-width: 36px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.sidebar-link:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.sidebar-label {
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-title {
  display: none;
}

.app-sidebar.collapsed .sidebar-link {
  justify-content: center;
  padding: 10px;
}

.app-sidebar.collapsed .sidebar-head {
  justify-content: center;
  padding: 12px 8px;
}

.page-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.page-panel.active {
  display: flex;
}

.page-actions-history.hidden,
.page-actions-analyze.hidden {
  display: none;
}

.muted {
  color: var(--text-dim);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-status {
  margin: 0;
  font-size: 14px;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-stat-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.history-stat-value {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--accent);
}

.history-overview-card,
.history-chart-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.history-chart-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.history-chart-hint {
  margin: 0 0 10px;
  font-size: 13px;
}

.history-chart {
  display: block;
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.history-table th,
.history-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.history-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--bg-elev);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.history-row:hover {
  background: rgba(96, 165, 250, 0.06);
}

.history-row.active td {
  background: rgba(96, 165, 250, 0.1);
}

.history-row.expanded td {
  border-bottom: none;
}

.history-col-chevron,
.history-row-chevron {
  width: 28px;
  padding-left: 10px !important;
  padding-right: 4px !important;
  color: var(--text-dim);
  font-size: 12px;
}

.history-col-actions,
.history-col-actions {
  width: 88px;
  text-align: right;
  white-space: nowrap;
}

.history-delete-btn {
  min-width: 64px;
}

.history-expand-row td {
  padding: 0 14px 16px;
  background: rgba(96, 165, 250, 0.04);
  border-bottom: 1px solid var(--border);
}

.history-row-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0 4px;
}

.history-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 20px;
  margin: 0;
}

.history-info-item dt {
  margin: 0 0 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.history-info-item dd {
  margin: 0;
  font-size: 13px;
  word-break: break-word;
}

.history-info-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

.history-info-link {
  color: var(--accent);
  text-decoration: none;
}

.history-info-link:hover {
  text-decoration: underline;
}

.history-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 16px !important;
}

.history-detail {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-detail.hidden {
  display: none;
}

.history-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-detail-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.history-detail-meta {
  margin: 0;
  font-size: 13px;
}

.history-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.history-charts-grid--single {
  grid-template-columns: 1fr;
}

.history-track-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-log-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.history-log-text {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}

.analyzed-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}

.analyzed-badge:empty {
  display: none;
}

.analyzed-badge.on {
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.08);
}

.live-position {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

.live-missing {
  background: var(--bg-elev-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}

.live-missing.hidden {
  display: none;
}

.live-missing p {
  margin: 0 0 6px;
}

.live-missing p:last-child {
  margin-bottom: 0;
  font-size: 13px;
}

.live-current-line-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.live-current-line {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  word-break: break-word;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  flex-wrap: wrap;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.live-dot.on {
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-soft);
}

.live-dot.streaming {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  animation: live-pulse 1.5s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.status-label {
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.main-panel {
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-header.compact {
  margin-bottom: 10px;
}

.section-header-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.section-header.compact .page-title {
  font-size: 16px;
}

.page-lead {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
  max-width: 62ch;
}

.stream-panel,
.params-panel {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stream-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.stream-url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.stream-default-view,
.stream-custom-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.stream-url-display {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-custom-view input[type="text"] {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}

.stream-custom-view input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.now-playing-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.now-playing-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.now-playing-title {
  font-weight: 600;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-artist {
  color: var(--text-dim);
}

.now-playing-artist:not(:empty)::before {
  content: "· ";
  opacity: 0.5;
}

.now-playing-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
}

.btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.btn.primary {
  background: var(--accent-700);
  color: #eff6ff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--text-dim);
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover:not(:disabled) {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.08);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.view-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.view-tab {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-tab:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.view-tab.active {
  background: var(--accent-soft);
  border-color: rgba(96, 165, 250, 0.45);
  color: var(--accent);
}

.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 16px;
}

.slider-row {
  display: grid;
  grid-template-columns: 56px 1fr 52px;
  align-items: center;
  gap: 8px;
}

.slider-label {
  font-size: 13px;
  color: var(--text-dim);
}

.slider-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.slider-row.is-disabled {
  opacity: 0.45;
}

.slider-row.is-disabled input[type="range"] {
  cursor: not-allowed;
}

.workspace {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
}

.beat-log-lane {
  width: 196px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 420px;
  box-shadow: var(--shadow);
  transition: width 0.2s, opacity 0.2s, margin 0.2s;
}

.beat-log-lane.hidden {
  width: 0;
  opacity: 0;
  margin: 0;
  border-width: 0;
  pointer-events: none;
}

.beat-log-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.beat-log-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.beat-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.beat-log-btn {
  flex: 1 1 calc(33% - 6px);
  min-width: 0;
}

.beat-log-body {
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.beat-log-text {
  height: 100%;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 120px;
  max-height: 380px;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.35) transparent;
}

.beat-log-empty,
.beat-log-hint {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 1rem 0.35rem;
}

.beat-log-block {
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.beat-log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.beat-log-marker {
  color: var(--accent);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.beat-log-meta {
  color: var(--text-dim);
  font-size: 10px;
}

.beat-log-sep {
  height: 1px;
  margin: 8px 0 4px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.35), transparent);
}

.beat-log-beat {
  color: var(--text);
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

.beat-log-beat:hover {
  background: rgba(255, 255, 255, 0.04);
}

.beat-log-time {
  color: var(--accent);
  font-weight: 600;
}

.beat-log-plain {
  color: var(--text-dim);
}

.beat-log-show {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.workspace-board {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lights-rail {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lights-rail-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.band-light-strip {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  flex: 1;
  gap: 6px;
  width: 100%;
  min-height: 220px;
}

.band-light {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: hsla(var(--hue), 75%, 52%, calc(0.07 + var(--dim, 0) * 0.55));
  border: 1px solid hsla(var(--hue), 70%, 58%, calc(0.12 + var(--dim, 0) * 0.35));
  box-shadow: 0 0 calc(2px + var(--dim, 0) * 10px) hsla(var(--hue), 100%, 58%, calc(var(--dim, 0) * 0.4));
  transition: box-shadow 0.06s linear, transform 0.06s linear, background 0.08s linear;
}

.band-light.beat {
  transform: scale(calc(1 + var(--pulse, 0) * 0.35));
  box-shadow:
    0 0 calc(6px + var(--pulse, 0) * 20px) hsla(var(--hue), 100%, 65%, calc(var(--pulse, 0) * 0.95)),
    0 0 calc(2px + var(--dim, 0) * 8px) hsla(var(--hue), 100%, 58%, calc(var(--dim, 0) * 0.35));
  background: hsla(var(--hue), 90%, 62%, calc(0.2 + var(--pulse, 0) * 0.75));
}

.view-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.view-panel.active {
  display: flex;
}

.visualizer {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  position: relative;
  overflow: hidden;
}

#equalizer,
#beat-canvas {
  width: 100%;
  height: 240px;
  display: block;
  border-radius: var(--radius-sm);
}

#cycle-colors.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.band-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.meter {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bpm-meter {
  border-color: rgba(96, 165, 250, 0.35);
}

.meter-label {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 40px;
}

.meter-bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-700), var(--accent));
  border-radius: 999px;
  transition: width 0.08s linear;
}

.meter-value {
  font-family: var(--mono);
  font-size: 13px;
  min-width: 36px;
  text-align: right;
}

.meter-value.large {
  font-size: 1.25rem;
  color: var(--accent);
  min-width: auto;
}

.bpm-value.pulse {
  animation: bpm-flash 0.15s ease;
}

@keyframes bpm-flash {
  0% { transform: scale(1.08); color: #fff; }
  100% { transform: scale(1); color: var(--accent); }
}

.beat-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.beat-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.beat-card-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.beat-card-bpm {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.beat-card-unit {
  font-size: 11px;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .app-body {
    flex-direction: column;
  }

  .app-sidebar,
  .app-sidebar.collapsed {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar-link {
    flex: 0 0 auto;
  }

  .history-summary-grid {
    grid-template-columns: 1fr;
  }

  .main-panel {
    padding: 14px;
  }

  .workspace {
    flex-direction: column;
  }

  .beat-log-lane:not(.hidden) {
    width: 100%;
    max-height: 220px;
  }

  .lights-rail {
    width: 100%;
    flex-direction: row;
    padding: 10px 12px;
  }

  .lights-rail-label {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .band-light-strip {
    flex-direction: row;
    min-height: auto;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand {
    font-size: 15px;
  }

  .stream-url-row {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
