/* PrivateMP3 — one committed light theme, direction "console".
   Warm rose on near-white. Reads as an audio editor, not a toy.
   Rose is a SIGNAL, not a wash: it marks the selection, the playhead and the
   primary action, and nothing else. Everything structural is a hairline.
   Full rules and rationale: DESIGN.md at the repo root. */
:root {
  /* Contrast ratios are recorded so the next edit cannot silently break AA.
     Do not put small white text on --rose (4.1:1) — use --rose-strong. */
  --rose:        #e23e6b;  /* accents: playhead, active handle, focus source */
  --rose-strong: #cf2f5f;  /* primary button bg; white label = 5.0:1 */
  --rose-deep:   #a81f4a;  /* links + emphasis text on light = 7.1:1 */
  --rose-wash:   #fdeaf0;  /* selection band, soft panel */
  --rose-hair:   #f1e6ea;
  --bg:          #fbf7f8;
  --surface:     #ffffff;
  --panel:       #faf6f7;  /* waveform bed */
  --ink:         #221a1d;  /* text + strokes. NEVER #000 = 17.0:1 */
  --ink-soft:    #6f5f65;  /* secondary text, timecodes = 6.0:1 */
  --wave:        #8d7c82;  /* waveform bars = 3.9:1, graphic not text */
  --muted:       #9a8a90;  /* ruler ticks, disabled = 3.3:1, graphics only */
  --hair:        #e8dde1;
  --hair-strong: #d9c9cf;
  --danger:      #b3261e;
  --r:           8px;
  --r-sm:        6px;
  --focus:       0 0 0 3px rgba(226, 62, 107, .28);
  --wrap:        720px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  /* System stack only. No web fonts: a Google Fonts link would send every
     visitor's IP to Google on a site whose whole pitch is that the file never
     leaves the device. */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Centred column — NEVER flex/grid on body: Auto Ads inject <ins> siblings. */
.app { max-width: var(--wrap); margin: 0 auto; padding: 16px 18px 40px; }

a { color: var(--rose-deep); }

/* ── header ── */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 4px 0 16px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 1.1rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark { width: 26px; height: 26px; display: block; }
.wordmark .mp3 { color: var(--rose-deep); }

.lang-switch { display: flex; gap: 4px; }
.lang-chip {
  font-size: .82rem; padding: 4px 9px; border-radius: 999px;
  text-decoration: none; color: var(--ink-soft); border: 1px solid transparent;
}
.lang-chip.is-current { color: var(--ink); border-color: var(--hair); background: var(--surface); }

/* ── headings ── */
h1 { font-size: 1.55rem; letter-spacing: -0.02em; margin: 4px 0 6px; font-weight: 650; }
.lead { margin: 0 0 6px; font-size: 1.02rem; }
.situation { margin: 0 0 18px; color: var(--ink-soft); font-size: .94rem; }

/* ── tool ── */
.tool { margin: 0 0 10px; }

.gate {
  border: 1px solid var(--hair-strong); border-left: 3px solid var(--rose);
  border-radius: 0; background: var(--surface);
  padding: 12px 14px; margin: 0 0 14px; font-size: .92rem;
}
.gate h2 { font-size: 1rem; margin: 0 0 4px; }
.gate p { margin: 0 0 4px; color: var(--ink-soft); }

.dropzone {
  background: var(--surface);
  border: 1px dashed var(--hair-strong);
  border-radius: var(--r);
  padding: 30px 18px; text-align: center; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dropzone:hover { border-color: var(--rose); }
.dropzone:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--rose); }
.dropzone.is-drag { border-color: var(--rose); background: var(--rose-wash); border-style: solid; }
.dz-mark { width: 30px; height: 30px; margin: 0 auto 8px; display: block; color: var(--rose-deep); }
.dz-text { font-size: .96rem; }
.dz-text .link { color: var(--rose-deep); text-decoration: underline; }
.dz-hint { font-size: .82rem; color: var(--ink-soft); margin-top: 5px; }

/* ── editor ── */
.editor {
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: var(--r); overflow: hidden;
}
.ed-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--rose-hair); font-size: .88rem;
}
.ed-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-meta { color: var(--ink-soft); white-space: nowrap; font-family: var(--mono); font-size: .8rem; }
.ed-head .btn-ghost { margin-left: auto; flex: none; }

.transport {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--rose-hair);
}
.transport .grow { flex: 1; }
.tc {
  font-family: var(--mono); font-size: .82rem;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
}
.tc-sep { color: var(--muted); font-size: .8rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }
.icon-btn:hover { border-color: var(--hair-strong); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn.is-on { color: var(--rose-strong); border-color: var(--rose); }

.wave-panel { padding: 10px 12px 4px; }
.ruler {
  position: relative; height: 15px; margin: 0 0 3px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  user-select: none;
}
.ruler span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ruler span::after {
  content: ""; position: absolute; left: 50%; top: 13px;
  width: 1px; height: 4px; background: var(--hair-strong);
}

.wave-stage {
  position: relative; height: 132px;
  background: var(--panel); border: 1px solid var(--rose-hair); border-radius: var(--r-sm);
  overflow: hidden; cursor: crosshair;
  /* Pointer Events drive selection; without this the browser steals the drag. */
  touch-action: none;
}
.wave-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wave-over { pointer-events: none; }

/* Playhead and handles are positioned divs moved with transform, so dragging
   never repaints a canvas. */
.playhead {
  position: absolute; top: 0; left: 0; width: 2px; height: 100%;
  background: var(--rose); pointer-events: none; will-change: transform;
}
.handle {
  position: absolute; top: 0; width: 11px; height: 100%; margin-left: -5px;
  cursor: ew-resize; will-change: transform; touch-action: none;
}
.handle::before {
  content: ""; position: absolute; left: 5px; top: 0;
  width: 1px; height: 100%; background: var(--rose-strong);
}
.handle::after {
  content: ""; position: absolute; left: 1px; top: 50%; margin-top: -13px;
  width: 9px; height: 26px; border-radius: 3px;
  background: var(--rose-strong);
}
.handle:focus-visible { outline: none; }
.handle:focus-visible::after { box-shadow: var(--focus); }
.wave-stage.is-empty .handle, .wave-stage.is-empty .playhead { display: none; }

/* Progressive scan: the waveform paints left to right while the audio is read,
   and this covers the part not yet drawn. */
.scan {
  position: absolute; top: 0; right: 0; height: 100%;
  background: repeating-linear-gradient(90deg,
    var(--panel) 0 6px, var(--rose-hair) 6px 7px);
  opacity: .5; pointer-events: none;
}
.wave-note { margin: 6px 2px 0; font-size: .8rem; color: var(--ink-soft); min-height: 1.2em; }

.sel-row {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px;
  padding: 4px 12px 10px;
}
.tc-field { display: flex; flex-direction: column; gap: 3px; font-size: .76rem; color: var(--ink-soft); }
.tc-field input {
  font: inherit; font-family: var(--mono); font-size: .84rem;
  font-variant-numeric: tabular-nums;
  width: 104px; padding: 6px 8px; color: var(--ink);
  border: 1px solid var(--hair-strong); border-radius: var(--r-sm); background: var(--surface);
}
.tc-field input:focus { outline: none; border-color: var(--rose); box-shadow: var(--focus); }
.btn-cut {
  font: inherit; font-size: .86rem; font-weight: 600;
  padding: 7px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--rose-strong); background: var(--rose-wash);
  color: var(--rose-deep); cursor: pointer;
}
.btn-cut:hover { background: #fbdde6; }
.btn-cut:disabled { opacity: .45; cursor: not-allowed; }

/* Touch model: a phone cannot hit an 11px handle, so the waveform pans under a
   fixed centre playhead and these act at the playhead instead. Desktop hides it. */
.touch-row { display: none; gap: 8px; padding: 0 12px 10px; }

.cut-list { list-style: none; margin: 0; padding: 0 12px 10px; }
.cut-list:empty { padding: 0; }
.cut-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 0 0 5px;
  background: var(--rose-wash); border-radius: var(--r-sm); font-size: .84rem;
}
.cut-list .cut-tc { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--rose-deep); }
.cut-list .cut-len { color: var(--ink-soft); margin-left: auto; }
.cut-list button {
  font: inherit; font-size: .8rem; padding: 3px 9px;
  border: 1px solid var(--hair-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.cut-list button:hover { color: var(--ink); border-color: var(--rose); }

/* ── controls ── */
.controls { margin: 14px 0 0; display: flex; flex-direction: column; gap: 12px; }
.ctl-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ctl-label { font-size: .82rem; color: var(--ink-soft); min-width: 58px; }

/* Segmented control rather than pills: it reads as a tool, and the selected
   segment is unambiguous. */
.seg { display: inline-flex; border: 1px solid var(--hair-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button {
  font: inherit; font-size: .88rem; padding: 7px 14px;
  border: 0; border-left: 1px solid var(--hair); background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--rose-strong); color: #fff; font-weight: 600; }
.seg button:disabled { color: var(--muted); cursor: not-allowed; background: var(--panel); }
.seg button:focus-visible { outline: none; box-shadow: inset var(--focus); }

.sel, .num {
  font: inherit; font-size: .88rem; padding: 7px 9px;
  border: 1px solid var(--hair-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
.sel:focus, .num:focus { outline: none; border-color: var(--rose); box-shadow: var(--focus); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--ink-soft); }
.check input { accent-color: var(--rose-strong); }

/* ── action ── */
.action-row { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; flex-wrap: wrap; }
.btn-go {
  font: inherit; font-size: .96rem; font-weight: 600;
  padding: 12px 26px; border-radius: var(--r);
  border: 1px solid var(--rose-strong); background: var(--rose-strong);
  color: #fff; cursor: pointer;
}
.btn-go:hover:not(:disabled) { background: var(--rose-deep); border-color: var(--rose-deep); }
.btn-go:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-go:disabled { opacity: .42; cursor: not-allowed; }
.btn-ghost {
  font: inherit; font-size: .84rem; padding: 6px 12px;
  border: 1px solid var(--hair-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--rose); }
.est { font-size: .84rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.status { margin: 12px 0 0; color: var(--ink-soft); font-size: .9rem; min-height: 1.2em; }
.status.is-error { color: var(--danger); }
.progress {
  height: 4px; margin: 8px 0 0; border-radius: 2px;
  background: var(--rose-hair); overflow: hidden;
}
.progress i { display: block; height: 100%; background: var(--rose-strong); width: 0; }

.result {
  margin: 14px 0 0; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--rose); border-radius: var(--r);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.result .r-name { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-meta { font-size: .82rem; color: var(--ink-soft); font-family: var(--mono); }
/* The save control is a real anchor with a download attribute, fired by a direct
   user click. Never an auto-download, never behind a timer: both are AdSense
   policy violations and both are user-hostile. */
.btn-save {
  font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none;
  margin-left: auto; padding: 10px 20px; border-radius: var(--r);
  background: var(--rose-strong); color: #fff; border: 1px solid var(--rose-strong);
}
.btn-save:hover { background: var(--rose-deep); }

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

/* ── related chips ── */
.related {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 20px 0 0; padding: 11px 13px;
  background: var(--rose-wash); border-radius: var(--r-sm);
}
.rel-label { font-size: .82rem; color: var(--ink-soft); }
.rel-chip {
  font-size: .85rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: 999px; padding: 5px 12px;
}
.rel-chip:hover { border-color: var(--rose); }

/* ── tool cards ── */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px; margin: 22px 0 0;
}
.tool-card {
  display: block; background: var(--surface);
  border: 1px solid var(--hair); border-radius: var(--r);
  padding: 14px; text-decoration: none; color: var(--ink);
}
.tool-card:hover { border-color: var(--rose); }
.tool-card h2 { font-size: .98rem; margin: 0 0 3px; }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: .87rem; }

/* ── faq / prose ── */
.faq { margin: 24px 0 0; }
.faq h2, .content h2 { font-size: 1.06rem; margin: 22px 0 8px; }
.faq h2 { margin-top: 0; }
.faq-item {
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  background: var(--surface); margin: 0 0 7px; padding: 0 12px;
}
.faq-item summary { cursor: pointer; padding: 11px 0; font-size: .93rem; }
.faq-item summary::marker { color: var(--muted); }
.faq-item .faq-a { padding: 0 0 12px; color: var(--ink-soft); font-size: .91rem; }

.content { margin: 20px 0 0; }
.content h1 { margin-bottom: 10px; }
.content p { margin: 0 0 10px; }
.content ul, .content ol { margin: 0 0 10px; padding-left: 22px; color: var(--ink); }
.content table {
  width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: .89rem;
  /* Wide tables scroll inside their own box; the page never scrolls sideways. */
  display: block; overflow-x: auto; white-space: nowrap;
}
.content th, .content td {
  border-bottom: 1px solid var(--hair); padding: 7px 12px 7px 0; text-align: left;
}
.content th { font-weight: 600; color: var(--ink-soft); font-size: .82rem; }
.content td { font-variant-numeric: tabular-nums; }
.updated { margin: 20px 0 0; font-size: .8rem; color: var(--muted); }

/* ── ad zone ──
   Collapsed to zero height until an ad actually paints, so the many unfilled
   requests a small site gets leave no hole in the page. Placement rule lives in
   the template, not here: never in the band containing the drop zone, the
   controls or the save button. */
.ad-zone { margin: 26px 0 0; }
.ad-spacer { height: 0; }
.ad-zone:has(.ad-slot iframe) .ad-spacer { height: 150px; }
.ad-label {
  height: 0; overflow: hidden;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.ad-zone:has(.ad-slot iframe) .ad-label { height: auto; margin: 0 0 4px; }

/* ── footer ── */
.site-foot {
  margin: 36px 0 0; padding: 16px 0 0; border-top: 1px solid var(--hair);
  color: var(--ink-soft); font-size: .83rem;
}
.site-foot nav { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; }
.site-foot a { color: var(--ink-soft); text-decoration: none; }
.site-foot a:hover { color: var(--ink); }
.foot-note { margin: 0; }

/* ── touch / small screens ──
   Drag handles are unusable with a finger, so below 720px the waveform pans
   under a fixed centre playhead and the Set start / Set end buttons act there.
   Hit targets go to 44px. */
@media (max-width: 720px) {
  .touch-row { display: flex; }
  .touch-row .btn-ghost { flex: 1; padding: 11px 10px; font-size: .9rem; }
  .handle { width: 22px; margin-left: -11px; }
  .handle::before { left: 10px; }
  .handle::after { left: 6px; width: 11px; height: 34px; margin-top: -17px; }
  .wave-stage { height: 118px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn-go { width: 100%; padding: 14px 20px; }
  .action-row { gap: 8px; }
  .tc-field input { width: 100%; }
  .tc-field { flex: 1 1 40%; }
}

@media (max-width: 420px) {
  h1 { font-size: 1.36rem; }
  .app { padding: 12px 14px 32px; }
  .dropzone { padding: 24px 14px; }
  .ed-meta { display: none; }
}

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