:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #080808;
  --panel-2: #0d0d0d;
  --line: #242424;
  --line-strong: #3d3d3d;
  --text: #f4f4f4;
  --muted: #989898;
  --dim: #666;
  --accent: #f2f2f2;
  --danger: #ff5a5f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #000; color: var(--text); }
body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
  line-height: 1.35;
}
button, input, select { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }

.app {
  width: min(100%, 660px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 720;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.openSmall {
  min-width: 70px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #101010;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: .06em;
}

.dropZone {
  min-height: calc(100dvh - 104px);
  border: 1px dashed #343434;
  border-radius: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  background: radial-gradient(circle at 50% 42%, #111 0, #050505 44%, #000 78%);
}
.dropZone.dragging { border-color: #777; background: #0b0b0b; }
.dropZone p { margin: 0; max-width: 300px; text-align: center; color: var(--muted); font-size: 14px; }
.openButton {
  min-width: 190px;
  height: 58px;
  border: 1px solid #eee;
  border-radius: 17px;
  background: #f2f2f2;
  color: #050505;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
}

.editor { display: grid; gap: 10px; }
.fileRow { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 44px; }
.fileText { min-width: 0; flex: 1; }
.fileText strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; font-weight: 680; }
.fileText span { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.localBadge { flex: none; color: #a0a0a0; font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; border: 1px solid #303030; border-radius: 999px; padding: 7px 9px; }

.waveCard,
.controlsCard,
.exportCard {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
}

.waveCard { position: relative; padding: 9px 9px 8px; overflow: hidden; }
.waveViewport {
  position: relative;
  height: 176px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  background: #020202;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.waveViewport::-webkit-scrollbar { display: none; }
.waveContent { position: relative; height: 100%; min-width: 100%; }
.waveCanvas {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  height: 100%;
  pointer-events: none;
}
.waveShade,
.playedShade {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.waveShade { z-index: 2; background: rgba(0,0,0,.82); }
.playedShade { z-index: 3; background: rgba(0,0,0,.52); }

.trimHandle,
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 7;
  width: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: none;
  user-select: none;
  outline: none;
}
.trimHandle { cursor: ew-resize; }
.handleLine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  border-radius: 3px;
  transform: translateX(-50%);
  background: #f7f7f7;
  box-shadow: 0 0 0 1px rgba(0,0,0,.7), 0 0 14px rgba(255,255,255,.16);
}
.trimHandle::before,
.trimHandle::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 8px;
  background: #f4f4f4;
  border-radius: 5px;
}
.trimHandle::before { top: 6px; }
.trimHandle::after { bottom: 6px; }
.trimHandle.dragging .handleLine { width: 4px; }

.playhead { width: 34px; cursor: ew-resize; }
.playheadLine {
  position: absolute;
  top: 7px;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: #cfcfcf;
  box-shadow: 0 0 7px rgba(255,255,255,.24);
}
.playheadCap {
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 3px 3px 8px 8px;
  background: #fff;
}
.playhead.dragging .playheadLine { width: 3px; background: #fff; }

.waveTooltip {
  position: absolute;
  top: 10px;
  z-index: 10;
  transform: translate(-50%, 0);
  padding: 6px 8px;
  border: 1px solid #484848;
  border-radius: 8px;
  background: rgba(5,5,5,.94);
  color: #fff;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  pointer-events: none;
}

.zoomControls {
  position: absolute;
  right: 17px;
  top: 17px;
  z-index: 12;
  width: 34px;
  display: grid;
  gap: 5px;
  pointer-events: none;
}
.zoomControls button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: rgba(7,7,7,.90);
  color: #d8d8d8;
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  pointer-events: auto;
}

.waveTimes {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 3px 0;
  font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #8c8c8c;
}
.waveTimes strong { color: #dedede; font-weight: 700; text-align: center; }
.waveTimes span:last-child { text-align: right; }

.transport { display: flex; justify-content: center; align-items: center; gap: 13px; padding: 2px 0; }
.roundButton,
.playButton {
  border: 1px solid var(--line);
  background: #0a0a0a;
  display: grid;
  place-items: center;
  padding: 0;
}
.roundButton { width: 48px; height: 48px; border-radius: 15px; color: #858585; }
.roundButton.active { color: #fff; border-color: #4b4b4b; background: #121212; }
.playButton { width: 58px; height: 58px; border-radius: 18px; background: #f1f1f1; color: #050505; border-color: #f1f1f1; }
.roundButton svg, .playButton svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.playButton svg { width: 24px; height: 24px; }
.playButton svg path:first-child { fill: currentColor; stroke: currentColor; }

.trimActions { display: grid; grid-template-columns: 1fr .66fr 1fr; gap: 7px; }
.trimActions button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #090909;
  color: #bbb;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .035em;
}

.controlsCard { padding: 4px 12px 7px; }
.controlRow {
  min-height: 52px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 72px;
  gap: 9px;
  align-items: center;
  border-bottom: 1px solid #171717;
}
.controlRow:last-of-type { border-bottom: 0; }
.controlName { font-size: 13px; font-weight: 800; letter-spacing: .06em; color: #d0d0d0; }
.valueButton {
  justify-self: end;
  min-width: 68px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #101010;
  padding: 0 8px;
  color: #f0f0f0;
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -.035em;
}
.range {
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  accent-color: #f2f2f2;
  touch-action: manipulation;
}
.range::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: #303030; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 23px;
  height: 23px;
  margin-top: -10px;
  border-radius: 8px;
  border: 1px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}
.range::-moz-range-track { height: 3px; border-radius: 4px; background: #303030; }
.range::-moz-range-thumb { width: 23px; height: 23px; border-radius: 8px; border: 1px solid #fff; background: #fff; }
.controlFoot { min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #737373; font-size: 11px; }
.clipWarning { color: var(--danger); font-weight: 800; letter-spacing: .04em; }

.exportCard { padding: 11px; }
.exportMeta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.exportMeta strong { font: 750 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.exportMeta span { color: var(--muted); font-size: 12px; text-align: right; }
.exportRow {
  display: grid;
  grid-template-columns: 68px 74px 72px minmax(82px, 1fr);
  gap: 6px;
  align-items: stretch;
}
.exportRow select,
.exportButton {
  min-width: 0;
  height: 44px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 740;
}
.exportRow select {
  padding: 0 8px;
  border: 1px solid #303030;
  background: #0b0b0b;
  color: #dedede;
  outline: none;
}
.exportButton { border: 1px solid #f1f1f1; background: #f1f1f1; color: #050505; letter-spacing: .035em; }
.exportButton:disabled { opacity: .42; }
.progressWrap { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #1a1a1a; }
.progressBar { width: 0%; height: 100%; border-radius: inherit; background: #e8e8e8; transition: width .16s linear; }
.progressWrap.indeterminate .progressBar { width: 35% !important; animation: indeterminate 1.05s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(315%); } }
.progressText { min-height: 24px; padding-top: 6px; display: flex; justify-content: space-between; gap: 8px; color: #8b8b8b; font-size: 12px; }
.status.error { color: var(--danger); }
.eta { flex: none; font-variant-numeric: tabular-nums; }
.shareButton { width: 100%; height: 42px; margin-top: 6px; border: 1px solid #303030; border-radius: 11px; background: #0b0b0b; color: #d0d0d0; font-size: 12px; font-weight: 760; letter-spacing: .04em; }

.hidden { display: none !important; }
button:active { transform: scale(.985); }
button:focus-visible, select:focus-visible, .trimHandle:focus-visible, .playhead:focus-visible { outline: 2px solid #777; outline-offset: 2px; }

@media (max-width: 385px) {
  .app { padding-left: 10px; padding-right: 10px; }
  .waveViewport { height: 164px; }
  .controlRow { grid-template-columns: 50px minmax(0,1fr) 66px; gap: 6px; }
  .valueButton { min-width: 62px; font-size: 15px; }
  .exportRow { grid-template-columns: 62px 67px 65px minmax(76px, 1fr); gap: 4px; }
  .exportRow select { padding: 0 5px; font-size: 12px; }
  .exportButton { font-size: 12px; }
}

@media (min-width: 560px) {
  .app { padding-left: 20px; padding-right: 20px; }
  .editor { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
