:root {
  color-scheme: dark light;
  font-family: "Segoe UI", Roboto, sans-serif;
  background-color: #0f172a;
  color: #e2e8f0;
}

body {
  margin: 0;
  padding: 0;
}

.app {
  margin: 0 auto;
  max-width: 1200px;
  padding: 16px 24px 32px;
}

.app__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.subtitle {
  margin-top: -8px;
  color: #94a3b8;
}

.header__actions {
  display: flex;
  gap: 8px;
}

.chart-panel {
  margin-top: 16px;
  min-height: auto;
}

.chart-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-layer-group {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-layer-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-layer-group__title {
  font-weight: 600;
  color: #e2e8f0;
}

.chart-layer-group__actions {
  display: flex;
  gap: 6px;
}

.chart-layer-group__actions button {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #e2e8f0;
}

.chart-layer-group__actions button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.chart-layer-list .empty {
  text-align: center;
  color: #94a3b8;
  padding: 12px 0;
}

.chart-layer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.65);
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.chart-layer.is-active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.chart-layer.is-hidden {
  opacity: 0.65;
}

.chart-layer__info {
  flex: 1;
  min-width: 160px;
}

.chart-layer__title {
  font-weight: 600;
}

.chart-layer__meta {
  font-size: 0.85rem;
  color: #94a3b8;
}

.chart-layer__controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-layer__controls label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
}

.chart-layer__controls input[type="radio"],
.chart-layer__controls input[type="checkbox"] {
  accent-color: #38bdf8;
}

button {
  background-color: #38bdf8;
  color: #0f172a;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

.media-panel {
  margin-top: 24px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 16px;
}

.waveform-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

#waveformCanvas,
#overlayCanvas {
  display: block;
  width: 100%;
  height: 240px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.7);
}

#overlayCanvas {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
}

.add-note-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  pointer-events: none;
  z-index: 3;
}

.add-note-toolbar.is-hidden {
  display: none;
}

.add-note-btn {
  position: absolute;
  top: 4px;
  margin-left: -8px;
  pointer-events: auto;
  background: rgba(14, 165, 233, 0.85);
  color: #0f172a;
  border: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(8, 47, 73, 0.35);
  transition: background 0.15s ease;
}

.note-picker {
  position: absolute;
  width: 180px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 10px 24px rgba(8, 47, 73, 0.4);
  backdrop-filter: blur(6px);
  z-index: 4;
}

.note-picker.is-hidden {
  display: none;
}

.note-picker__header {
  font-weight: 600;
  margin-bottom: 8px;
}

.note-picker__options {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.note-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.note-picker__option input[type="checkbox"] {
  accent-color: #38bdf8;
}

.note-picker__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.note-picker__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.note-picker__actions button {
  background: rgba(56, 189, 248, 0.85);
  color: #0f172a;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.note-picker__actions button[data-action="cancel"] {
  background: rgba(148, 163, 184, 0.45);
  color: #e2e8f0;
}

.note-picker__actions button:hover {
  transform: translateY(-1px);
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.controls input[type="range"] {
  width: 200px;
}

#timeDisplay {
  font-family: "JetBrains Mono", "Fira Mono", monospace;
}

.panels {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.panels--split .panel {
  min-height: 320px;
}

.log-panel {
  display: flex;
  flex-direction: column;
}

.log-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.log-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.6);
}

.log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry--add {
  color: #34d399;
}

.log-entry--remove {
  color: #f87171;
}

.log-entry__time {
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 0.8rem;
  color: #cbd5f5;
  margin-right: 12px;
}

.panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 16px;
  min-height: 260px;
  overflow: hidden;
}

.note-list {
  max-height: 360px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.note-row {
  display: grid;
  grid-template-columns: 80px 80px auto;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.note-row--new {
  background: rgba(34, 197, 94, 0.15);
}

.note-row:last-child {
  border-bottom: none;
}

.note-row:hover {
  background-color: rgba(56, 189, 248, 0.15);
}

.note-row.is-selected {
  background-color: rgba(96, 165, 250, 0.25);
}

.app__footer {
  margin-top: 32px;
  font-size: 0.85rem;
  color: #94a3b8;
}

@media (max-width: 960px) {
  .app {
    max-width: none;
    padding: 16px;
  }
  .panels {
    grid-template-columns: 1fr;
  }
}

.beat-marker-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.45) 25%, rgba(148, 163, 184, 0.45) 75%, rgba(148, 163, 184, 0) 100%);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}

.log-list .empty {
  text-align: center;
  padding: 12px 0;
  color: #94a3b8;
}

.note-row--status {
  text-align: right;
  font-size: 0.85rem;
  color: #22c55e;
  font-weight: 600;
}
