/* style.css — classic Audacity look: plain gray toolbars, blue-on-white
   waveforms, utilitarian dialogs. */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  font-family: Tahoma, 'Segoe UI', Geneva, Verdana, sans-serif;
  font-size: 12px;
  color: #222;
  background: #eeedea;
  overflow: hidden;
}
button { font-family: inherit; font-size: 12px; }
#app { display: flex; flex-direction: column; height: 100vh; min-width: 720px; }

/* ---------- menu bar ---------- */
.menu-bar {
  display: flex;
  background: linear-gradient(#f4f4f4, #e8e8e8);
  border-bottom: 1px solid #b3b3b3;
  padding: 1px 4px;
  user-select: none;
  flex: none;
}
.menu-title {
  background: none;
  border: 1px solid transparent;
  padding: 3px 10px;
  cursor: default;
  border-radius: 2px;
}
.menu-title:hover { background: #dfe8f6; border-color: #b8c8e4; }
.menu-title.active, .menu-title.active:hover {
  background: #316ac5;
  border-color: #274f9c;
  color: #fff;
}
.menu-dropdown {
  position: fixed;
  z-index: 1000;
  background: #fdfdfd;
  border: 1px solid #9a9a9a;
  box-shadow: 2px 3px 10px rgba(0,0,0,0.28);
  padding: 2px;
  min-width: 200px;
  user-select: none;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px 4px 4px;
  cursor: default;
  white-space: nowrap;
}
.menu-item:hover { background: #316ac5; color: #fff; }
.menu-item.disabled { color: #9c9c9c; }
.menu-item.disabled:hover { background: transparent; color: #9c9c9c; }
.menu-check { width: 16px; text-align: center; flex: none; }
.menu-label { flex: 1; }
.menu-accel { color: #777; padding-left: 22px; font-size: 11px; }
.menu-item:hover .menu-accel { color: #d9e4f7; }
.menu-sep { height: 1px; background: #d8d8d8; margin: 3px 6px; }
.menu-header { padding: 4px 8px; color: #555; font-style: italic; white-space: nowrap; }

/* ---------- toolbars ---------- */
.toolbars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px 4px;
  background: linear-gradient(#f2f2f0, #e7e6e2);
  border-bottom: 1px solid #b3b3b3;
  flex: none;
  align-items: stretch;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: linear-gradient(#f7f7f5, #eae9e5);
  border: 1px solid #b5b5ad;
  border-radius: 3px;
  padding: 2px 6px;
  min-height: 38px;
}
.tb-sep { width: 1px; align-self: stretch; background: #c9c9c1; margin: 2px 3px; }
.tb-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(#fdfdfd, #e3e3de);
  border: 1px solid #b0b0a8;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}
.tb-btn svg { width: 22px; height: 22px; pointer-events: none; }
.tb-btn:hover { background: linear-gradient(#ffffff, #efefe9); border-color: #8a8a82; }
.tb-btn:active, .tb-btn.active {
  background: linear-gradient(#d8d8d2, #e8e8e2);
  border-color: #7a7a72;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.22);
}
.tb-btn:disabled { opacity: 0.4; cursor: default; }
.tb-btn.round {
  border-radius: 50%;
  width: 32px; height: 32px;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e6e6e0 70%, #d8d8d1);
}
.tb-btn.round.active { box-shadow: inset 1px 2px 5px rgba(0,0,0,0.35); }
.tb-btn.toggle.active { border-color: #7a7a72; }

/* mixer */
.mix-group { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.mix-num { font-size: 10px; color: #555; width: 34px; text-align: center; }
.mix-slider-wrap { height: 26px; display: flex; align-items: center; }
input.mix-slider {
  -webkit-appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 22px; height: 24px;
}
input.mix-slider:not(.vertical) { writing-mode: horizontal-tb; width: 90px; height: 20px; }

/* meter toolbar */
.meter-pair { display: flex; flex-direction: column; gap: 2px; }
.meter-label { font-size: 9px; color: #666; text-align: center; }
.meter-bar {
  width: 110px; height: 7px;
  background: linear-gradient(to right, #2c5f2c 0%, #2c5f2c 55%, #b3b32a 80%, #b32a2a 100%);
  position: relative;
  border: 1px solid #9a9a90;
}
.meter-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(30, 30, 30, 0.72);
}
.meter-fill.hot { background: #c81e1e; }

/* ---------- track area ---------- */
.track-container { flex: 1; min-height: 0; display: flex; }
.track-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.track-scroll {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: #dfdfda;
}
.ruler-row {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  height: 27px;
  background: #ffffff;
  border-bottom: 1px solid #9a9a90;
  cursor: ew-resize;
  user-select: none;
}
.ruler-corner {
  width: 104px;
  flex: none;
  background: linear-gradient(#e8e8e4, #dcdcd6);
  border-right: 1px solid #a8a89e;
  z-index: 1;
}
.ruler-canvas { display: block; height: 26px; }

.track-rows { position: relative; }
.track-row {
  display: flex;
  border-bottom: 1px solid #b9b9b2;
  background: #f6f6f2;
}
.tcp {
  width: 104px;
  flex: none;
  background: linear-gradient(90deg, #f8f8f6, #e9e9e4 70%, #e2e2dc);
  border-right: 1px solid #a8a89e;
  border-top: 1px solid #ffffff55;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  user-select: none;
  overflow: hidden;
}
.tcp-top { display: flex; justify-content: space-between; }
.tcp-close, .tcp-collapse {
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: #555;
  padding: 0 4px;
  border-radius: 2px;
  line-height: 14px;
}
.tcp-close:hover, .tcp-collapse:hover { background: #dcdcd4; border-color: #b0b0a6; }
.tcp-title {
  text-align: left;
  background: #dcdcd4;
  border: 1px solid #b8b8ae;
  border-radius: 2px;
  padding: 1px 6px;
  cursor: pointer;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tcp-title:hover { background: #e8e8e0; }
.tcp-btnrow { display: flex; gap: 3px; }
.tcp-btn {
  flex: 1;
  font-size: 10px;
  padding: 2px 0;
  background: linear-gradient(#f4f4f0, #e6e6e0);
  border: 1px solid #b0b0a6;
  border-radius: 2px;
  cursor: pointer;
}
.tcp-btn.mute.on {
  background: #3d5fce;
  border-color: #2c4cad;
  color: #fff;
}
.tcp-btn.solo.on {
  background: #d9c748;
  border-color: #b5a52e;
}
.tcp-slider { display: flex; align-items: center; gap: 2px; }
.tcp-slider-lab { font-size: 9px; color: #666; width: 10px; text-align: center; }
.tcp-slider input[type='range'] { flex: 1; min-width: 0; height: 14px; }

.wave-cell { position: relative; cursor: text; }
.wave-canvas { position: absolute; left: 0; top: 0; display: block; }

.playhead-cursor {
  position: absolute;
  width: 1px;
  background: #10103a;
  box-shadow: 1px 0 0 rgba(16, 16, 58, 0.25);
  pointer-events: none;
  z-index: 7;
}
.drag-space { height: 160px; }

.hscroll { height: 15px; overflow-x: auto; overflow-y: hidden; background: #e8e8e3; flex: none; border-top: 1px solid #b3b3aa; }
.hscroll-filler { height: 1px; }

/* ---------- selection bar ---------- */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(#f0f0ec, #e6e6e0);
  border-top: 1px solid #b3b3aa;
  padding: 3px 8px;
  flex: none;
  flex-wrap: wrap;
  min-height: 30px;
}
.sb-group { display: flex; align-items: center; gap: 4px; }
.sb-sep { width: 1px; height: 18px; background: #c5c5bb; }
.sb-label { color: #444; white-space: nowrap; }
.sb-unit { color: #666; }
.sb-input-wrap { position: relative; display: inline-flex; }
.sb-input {
  width: 96px;
  border: 1px solid #a8a89e;
  background: #fff;
  padding: 2px 20px 2px 6px;
  font-family: inherit;
  font-size: 12px;
}
.sb-input:disabled { background: #efefe9; color: #333; }
.sb-spin {
  position: absolute;
  right: 1px;
  width: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 7px;
  color: #555;
  padding: 0;
}
.sb-spin.up { top: 0; height: 50%; }
.sb-spin.dn { bottom: 0; height: 50%; }
.sb-fmt, .sb-rate {
  border: 1px solid #a8a89e;
  background: #fff;
  font-size: 11px;
  max-width: 170px;
}

/* ---------- dialogs ---------- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog {
  background: #ececec;
  border: 1px solid #888;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.35);
  max-width: 96vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.dialog-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(#ececec, #dcdcdc);
  border-bottom: 1px solid #b5b5b5;
  padding: 4px 6px 4px 10px;
  font-weight: bold;
  cursor: move;
  user-select: none;
}
.dialog-x {
  border: 1px solid #a5a5a5;
  background: #e6e6e6;
  width: 20px; height: 18px;
  cursor: pointer;
  line-height: 14px;
  padding: 0;
}
.dialog-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #d5d5d5;
}
.btn {
  min-width: 74px;
  padding: 4px 12px;
  background: linear-gradient(#fdfdfd, #e8e8e4);
  border: 1px solid #9a9a90;
  border-radius: 3px;
  cursor: pointer;
}
.btn:hover { background: linear-gradient(#fff, #f0f0ea); }
.btn.default { border-color: #4a6a9a; box-shadow: 0 0 0 1px #b9c8e0; }

/* dialog widgets */
.fld-row { display: flex; align-items: center; gap: 8px; }
.fld-label { min-width: 150px; text-align: right; color: #333; }
.fld-unit { color: #666; }
.fld-num, .fld-text, .fld-select {
  border: 1px solid #a8a89e;
  background: #fff;
  padding: 3px 5px;
  font-family: inherit;
  font-size: 12px;
}
.fld-check { display: flex; align-items: center; gap: 6px; margin-left: 158px; }
.fld-slider-row { display: flex; align-items: center; gap: 6px; }
.fld-info { color: #555; }
input[type='range'] { accent-color: #3d5fce; }

/* EQ dialog */
.eq-grid { display: flex; gap: 3px; overflow-x: auto; padding: 4px 2px; }
.vslider { display: flex; flex-direction: column; align-items: center; width: 26px; }
.vslider-rail {
  position: relative;
  width: 22px;
  height: 130px;
  background: linear-gradient(to right, #d8d8d2, #efefe9);
  border: 1px solid #a8a89e;
  cursor: ns-resize;
}
.vslider-fill { position: absolute; left: 8px; width: 6px; background: #3d5fce88; }
.vslider-zero { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #b0b0aa; }
.vslider-handle {
  position: absolute;
  left: 2px;
  width: 16px; height: 7px;
  background: linear-gradient(#fdfdfd, #d8d8d2);
  border: 1px solid #7a7a72;
  border-radius: 2px;
}
.vslider-label { font-size: 8px; color: #555; margin-top: 2px; }
.eq-btnrow { display: flex; gap: 8px; }

/* spectrum + about */
.spectrum-canvas { border: 1px solid #a8a89e; background: #fff; }
.spectrum-peaks { font-family: 'Courier New', monospace; font-size: 11px; color: #333; white-space: pre; }
.about-logo { display: flex; justify-content: center; padding: 6px; }
.about-text h3 { margin: 4px 0 8px; }
.about-text p { margin: 4px 0; }
.about-text .dim { color: #666; }

/* hint chip */
.hint-chip {
  position: fixed;
  right: 14px;
  bottom: 42px;
  background: rgba(30, 34, 44, 0.92);
  color: #e8ecf4;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 3000;
  max-width: 420px;
}
.hint-chip.show { opacity: 1; }

/* misc */
.dim { color: #666; }
::-webkit-scrollbar { height: 12px; width: 12px; }
::-webkit-scrollbar-thumb { background: #c9c9c1; border-radius: 6px; border: 2px solid #e8e8e3; }
::-webkit-scrollbar-track { background: #e4e4de; }
