* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #000;
  color: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 20px 28px;
  padding-top: calc(10px + env(safe-area-inset-top, 47px));
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  background: #1d1d1f;
}

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

#trackName {
  margin: 4px 0 0;
  color: #86868b;
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

#donate {
  color: #86868b;
  text-decoration: none;
  font-size: 15px;
}

.open {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 980px;
  background: #f5f5f7;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#audio {
  display: none !important;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: #86868b;
}

.clock strong {
  color: #f5f5f7;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.clock .keep { margin-left: auto; font-size: 13px; }

.wave-shell {
  background: #111;
  border-radius: 12px;
  overflow: hidden;
}

#timeline { height: 16px; opacity: 0.7; }
#waveform {
  height: 168px;
  min-height: 168px;
  cursor: ew-resize;
  touch-action: none;
}

.trimmer {
  position: relative;
  height: 28px;
  margin-top: 10px;
  background: #1d1d1f;
  border-radius: 6px;
  touch-action: none;
}

.fill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 10%;
  display: flex;
  border-radius: 4px;
  background: rgba(10, 132, 255, 0.45);
  opacity: 0.45;
}

.thumb {
  width: 8px;
  border: 0;
  background: #0a84ff;
  cursor: ew-resize;
}

.body {
  flex: 1;
  border: 0;
  background: transparent;
  cursor: grab;
}

.hint {
  margin: 8px 0 0;
  color: #86868b;
  font-size: 13px;
  text-align: center;
  min-height: 1.2em;
}

.io {
  display: none;
}

.edit-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 16px 0 18px;
}

.io-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.io-col small {
  color: #86868b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.io-col b {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 13px;
}

.io-col span { display: flex; gap: 6px; }

.io-col button,
.actions button,
.transport button {
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #1d1d1f;
  color: #f5f5f7;
  font-size: 16px;
  cursor: pointer;
}

.io-col button { width: 36px; }

.transport {
  display: grid;
  grid-template-columns: 36px 64px 36px;
  justify-content: center;
  justify-items: center;
  align-items: center;
  column-gap: 6px;
  row-gap: 6px;
}

.transport em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 11px;
  color: #86868b;
  font-variant-numeric: tabular-nums;
}

#play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f5f5f7;
  color: #000;
  font-size: 14px;
  font-weight: 600;
}

#skipBack, #skipFwd {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.export {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 12px;
  background: #0a84ff;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}

details {
  color: #86868b;
  font-size: 15px;
  margin-bottom: 16px;
}

details summary { cursor: pointer; margin-bottom: 12px; }

details label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

details input[type="range"] { flex: 1; accent-color: #0a84ff; }

details select {
  margin-left: auto;
  background: #1d1d1f;
  color: #f5f5f7;
  border: 0;
  border-radius: 8px;
  padding: 8px;
}

#cutList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cut-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid #222;
  font-size: 14px;
}

.cut-item button {
  margin-left: auto;
  background: none;
  border: 0;
  color: #0a84ff;
  cursor: pointer;
}

.cut-item .remove-cut { color: #ff453a; margin-left: 8px; }
.swatch { width: 8px; height: 8px; border-radius: 8px; }

.hint.error, .status.error { color: #ff453a; }
.hint.ok, .status.ok { color: #30d158; }

button:disabled { opacity: 0.28; cursor: default; }

@media (min-width: 860px) {
  .app {
    max-width: 980px;
    padding: 28px 32px 40px;
  }

  header {
    margin-bottom: 28px;
  }

  .logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  h1 { font-size: 28px; }

  .clock strong { font-size: 36px; }

  .wave-shell {
    display: grid;
  }

  #waveform {
    height: 280px;
    min-height: 280px;
  }

  .io {
    display: none;
  }

  .export {
    max-width: 420px;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
}
