:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --on-solid: #ffffff;
  --error: #c0362c;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --text: #f2f2f2;
    --muted: #7d7d7d;
    --line: #232323;
    --line-strong: #3a3a3a;
    --on-solid: #0b0b0b;
    --error: #ff7a6e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
}
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

button, input, select, a { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.top { display: flex; justify-content: flex-end; min-height: 44px; }
.top.start { justify-content: flex-start; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); margin: 0 -10px; }
.icon-btn svg { width: 22px; height: 22px; }

.title { font-size: 17px; font-weight: 500; line-height: 1.3; margin: 0; text-wrap: balance; }
.sub { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.error { color: var(--error); font-size: 14px; margin: 16px 0 0; }

/* ---------- home ---------- */
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding-bottom: 12vh; }

.field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 5px 5px 18px;
}
.field:focus-within { border-color: var(--text); }
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 16px; /* prevents iOS zoom */
  padding: 8px 0;
}
.field input::placeholder { color: var(--muted); }
.go {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--text);
  color: var(--on-solid);
  display: grid; place-items: center;
}
.go svg { width: 18px; height: 18px; stroke-width: 2; }
.go .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.go.loading .ico-arrow { display: none; }
.go.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

#preview { margin-top: 32px; }
.solid {
  margin-top: 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--on-solid);
  font-weight: 500;
  padding: 12px 28px;
}
.solid:disabled { opacity: .4; cursor: default; }
#progress { margin-top: 20px; }
.line { height: 2px; background: var(--line); border-radius: 1px; overflow: hidden; }
.line span { display: block; height: 100%; width: 0; background: var(--text); transition: width .3s; }

/* recent: terminal-style list */
.recent { font-family: var(--mono); font-size: 13px; }
.recent-label { color: var(--muted); margin: 0 0 6px; }
#recent { list-style: none; margin: 0; padding: 0; }
#recent li { display: flex; align-items: center; }
#recent .open {
  flex: 1; min-width: 0;
  text-align: left;
  padding: 7px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono);
}
#recent .open::before { content: "· "; color: var(--muted); }
#recent .del { color: var(--muted); padding: 7px 0 7px 14px; font-family: var(--mono); }

/* ---------- player ---------- */
#player { text-align: center; }
.head { padding: 8px 8px 0; }
.head .title { font-size: 19px; }
.transport { flex: 1; display: flex; align-items: center; justify-content: center; gap: 36px; }
.play {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--text);
  color: var(--on-solid);
  display: grid; place-items: center;
}
.play svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
#ico-play { transform: translateX(2px); }
.skip { position: relative; width: 52px; height: 52px; display: grid; place-items: center; color: var(--muted); }
.skip svg { width: 40px; height: 40px; stroke-width: 1.4; }
.skip span { position: absolute; font-size: 11px; font-weight: 600; padding-top: 2px; }

.scrub { margin-bottom: 20px; }
#seek {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px;
  background: transparent; margin: 0;
  --p: 0%;
}
#seek::-webkit-slider-runnable-track {
  height: 2px; border-radius: 1px;
  background: linear-gradient(var(--text), var(--text)) 0 / var(--p) 100% no-repeat, var(--line);
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; margin-top: -5px;
  border-radius: 50%; background: var(--text); border: 0;
}
#seek::-moz-range-track { height: 2px; background: var(--line); }
#seek::-moz-range-progress { height: 2px; background: var(--text); }
#seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.extras { display: flex; justify-content: center; align-items: center; gap: 28px; padding-bottom: 8px; }
.quiet { color: var(--muted); font-size: 15px; min-width: 44px; height: 44px; display: grid; place-items: center; text-decoration: none; }
.quiet svg { width: 20px; height: 20px; }

/* ---------- settings ---------- */
.form { display: flex; flex-direction: column; padding-top: 8px; }
.form label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form input, .form select {
  width: 100%;
  font-size: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  outline: 0;
}
.form select { -webkit-appearance: none; appearance: none; padding-right: 36px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px;
}
.form input:focus, .form select:focus { border-color: var(--text); }
.form #model { margin-bottom: 8px; }
.form .solid { align-self: center; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 22px 16px; }
.hint a { color: var(--text); }
.notice { font-size: 14px; margin: 4px 0 20px; text-align: center; }
