/* yescord — one stylesheet, both themes, phone-first. */
:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --panel: #ffffff;
  --ink: #1c1b1f;
  --muted: #5d5a63;
  --line: #dcd7cf;
  --rec: #d42a3c;
  --rec-ink: #ffffff;
  --accent-soft: #fbe3e5;
  --ok: #1f7a4d;
  --focus: #1f5fd1;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --panel: #1c1c21;
    --ink: #ececf0;
    --muted: #a6a3ad;
    --line: #34333b;
    --rec: #ff5566;
    --rec-ink: #1a0a0c;
    --accent-soft: #3a1c21;
    --ok: #5fd39a;
    --focus: #7aa7ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 0; }
.brand { font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; }
.brand .dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--rec); display: inline-block; }
.top .tag { color: var(--muted); font-size: .85rem; text-align: right; }

h1 { font-size: clamp(1.45rem, 5.2vw, 2.3rem); line-height: 1.15; margin: .2rem 0 .3rem; letter-spacing: -.02em; }
.lede { margin: 0 0 1rem; color: var(--muted); }

.recorder { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.mode {
  appearance: none; border: 2px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 12px; padding: .55rem .3rem; font: inherit; font-weight: 650; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .15rem; min-height: 3.6rem;
}
.mode svg { width: 1.45rem; height: 1.45rem; }
.mode[aria-checked="true"] { border-color: var(--rec); background: var(--accent-soft); }
.mode:disabled { opacity: .45; cursor: not-allowed; }
.reason { font-size: .85rem; color: var(--muted); margin: .45rem 0 0; }

.opts { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: .75rem 0 0; font-size: .92rem; }
.opts label.check { display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; }
.opts input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--rec); }
.opts .pick { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; font-size: .8rem; color: var(--muted); }
.opts select { font: inherit; font-size: .92rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .4rem; width: 100%; min-width: 0; }
.opts .note { font-size: .8rem; color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9rem; }
.btn {
  appearance: none; font: inherit; font-weight: 700; border-radius: 999px; padding: .7rem 1.25rem;
  border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; min-height: 3rem;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.start { background: var(--rec); border-color: var(--rec); color: var(--rec-ink); display: inline-flex; align-items: center; gap: .5rem; }
.btn.start::before { content: ""; width: .8rem; height: .8rem; border-radius: 50%; background: currentColor; }
.btn.stop { background: var(--ink); color: var(--bg); }
.timer { font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 700; margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; }
.timer .live { width: .7rem; height: .7rem; border-radius: 50%; background: var(--muted); }
.is-recording .timer .live { background: var(--rec); animation: blink 1.2s steps(2, start) infinite; }
.is-paused .timer .live { background: var(--muted); }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .is-recording .timer .live { animation: none; } }
.format { font-size: .8rem; color: var(--muted); margin: .45rem 0 0; }
.status { min-height: 1.3em; margin: .5rem 0 0; font-size: .92rem; }
.status.err { color: var(--rec); font-weight: 600; }

.stage { margin-top: .8rem; }
.stage video { width: 100%; max-height: 50vh; background: #000; border-radius: 10px; display: block; }
.meter { height: .7rem; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .5rem; }
.meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }

.results { margin-top: 1rem; display: grid; gap: 1rem; }
.results:empty { display: none; }
.result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.result h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.result video { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; display: block; }
.result audio { width: 100%; display: block; }
.result .meta { margin: .5rem 0; color: var(--muted); font-size: .9rem; }
.result .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn.download { background: var(--ok); border-color: var(--ok); color: var(--bg); text-decoration: none; display: inline-flex; align-items: center; }
.results-note { font-size: .85rem; color: var(--muted); margin: 0; }

.info { margin: 2rem 0; }
.info h2 { font-size: 1.25rem; margin: 1.8rem 0 .4rem; letter-spacing: -.01em; }
.info p, .info li { max-width: 44rem; }
.info ul { padding-left: 1.2rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 36rem; }
th, td { text-align: left; padding: .45rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--panel); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.yes { color: var(--ok); }
td.no { color: var(--rec); }
.src { font-size: .82rem; color: var(--muted); }

footer { border-top: 1px solid var(--line); padding: 1rem 0 2rem; color: var(--muted); font-size: .85rem; }

@media (min-width: 760px) {
  .recorder { padding: 1.4rem; }
  .modes { max-width: 30rem; }
}

/* ---------- header nav (both pages) ---------- */
.nav { display: flex; gap: .25rem; font-size: .92rem; }
.nav a { text-decoration: none; padding: .45rem .7rem; border-radius: 999px; color: var(--muted); font-weight: 650; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.btn.trim { border-color: var(--rec); color: var(--ink); }

/* ---------- /trim/ ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.open { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.file-btn { cursor: pointer; }
.file-btn::before { display: none; }
.open .hint { margin: 0; flex: 1 1 16rem; font-size: .88rem; color: var(--muted); }
#file:focus-visible + .hint, .open:focus-within .file-btn { outline: 3px solid var(--focus); outline-offset: 2px; }
body.dropping .trimmer { outline: 3px dashed var(--rec); outline-offset: 4px; }
.editor { margin-top: .6rem; }
.filename { margin: 0 0 .5rem; font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.editor video { width: 100%; max-height: 55vh; background: #000; border-radius: 10px; display: block; }

.timeline { position: relative; height: 2.75rem; margin: .9rem .9rem 0; touch-action: none; }
.track { position: absolute; left: 0; right: 0; top: 50%; height: .7rem; margin-top: -.35rem; border-radius: 999px; background: var(--line); cursor: pointer; }
.sel { position: absolute; top: 0; bottom: 0; background: var(--rec); opacity: .75; border-radius: 999px; }
.playhead { position: absolute; top: -.45rem; bottom: -.45rem; width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.handle {
  position: absolute; top: 50%; width: 1.5rem; height: 2.6rem; margin: -1.3rem 0 0 -.75rem;
  border-radius: 8px; background: var(--panel); border: 2px solid var(--rec); cursor: ew-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.handle::after { content: ""; width: 2px; height: 1.1rem; background: var(--rec); box-shadow: 4px 0 0 var(--rec); margin-left: -4px; }
.handle.dragging, .handle:focus-visible { background: var(--accent-soft); }
.keys { font-size: .78rem; color: var(--muted); margin: .35rem 0 0; }

.times { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: flex-end; margin-top: .6rem; }
.times .pick { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); flex: 1 1 7rem; max-width: 11rem; }
.times input { font: inherit; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; width: 100%; }
.times input[aria-invalid="true"] { border-color: var(--rec); }
.times .len { margin: 0 0 .45rem; font-variant-numeric: tabular-nums; }
.controls.tight { margin-top: .6rem; gap: .45rem; }
.btn.small { padding: .45rem .9rem; min-height: 2.5rem; font-size: .9rem; }

.outputs { display: grid; gap: .8rem; margin-top: 1rem; }
.output { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.output h2 { font-size: 1.05rem; margin: 0 0 .35rem; }
.output .opts { margin-top: 0; }
.output .btn { margin-top: .6rem; }
.output .btn.start::before { display: none; }
.btn.start:disabled { opacity: .5; }
.fps { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .1rem .8rem; align-items: center; font-size: .92rem; }
.fps legend { font-size: .8rem; color: var(--muted); padding: 0; margin-bottom: .1rem; width: 100%; }
.fps input { accent-color: var(--rec); width: 1.1rem; height: 1.1rem; }

.progress { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-top: .9rem; }
.progress progress { flex: 1 1 100%; height: .8rem; accent-color: var(--rec); }
.progress span { flex: 1 1 12rem; font-size: .88rem; font-variant-numeric: tabular-nums; }
.result img.gif { max-width: 100%; height: auto; display: block; border-radius: 10px; image-rendering: auto; }
h3 { font-size: 1.05rem; margin: 1.3rem 0 .3rem; }

@media (min-width: 760px) {
  .outputs { grid-template-columns: 1fr 1fr; }
}
