/* M4A to MP3 Converter — styles. Teal accent, animated UI, responsive, accessible. */
:root {
  --teal: #0f766e;
  --teal-dark: #0b5e57;
  --teal-soft: #ccfbf1;
  --ink: #134e4a;
  --body: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #15803d;
  --err: #b91c1c;
  --warn-bg: #fef9c3;
  --warn-ink: #854d0e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 118, 110, .12);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--body); background: var(--bg); line-height: 1.55;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--teal); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 10; }
.skip-link:focus { left: 0; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #14b8a6; outline-offset: 2px; border-radius: 4px; }

/* header / hero */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: baseline; gap: 8px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: .85rem; }
.hero { text-align: center; padding: 40px 0 8px; animation: fadeUp .5s ease both; }
.hero h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 5vw, 2.7rem); line-height: 1.1; color: var(--ink); letter-spacing: -.02em; }
.lede { font-size: 1.12rem; color: var(--body); max-width: 640px; margin: 0 auto 8px; }
.kw-line { color: var(--muted); font-size: .95rem; max-width: 640px; margin: 0 auto; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* tool */
.tool { margin-top: 24px; }
.dropzone {
  border: 2px dashed #99f6e4; border-radius: var(--radius); background: #fff;
  padding: 38px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  animation: fadeUp .5s .08s ease both;
}
.dropzone:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.dropzone.dragover {
  border-color: var(--teal); border-style: solid; background: var(--teal-soft);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .15), var(--shadow);
  transform: scale(1.01);
}
.dz-icon { color: var(--teal); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.dz-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); margin: 10px 0 4px; }
.dz-sub { margin: 0 0 6px; color: var(--body); }
.dz-note { margin: 0; color: var(--muted); font-size: .85rem; }
.linklike { background: none; border: none; padding: 0; color: var(--teal); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* settings */
.settings {
  margin: 18px 0 0; padding: 18px 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff;
  animation: fadeUp .5s .14s ease both;
}
.settings legend { font-weight: 700; color: var(--ink); padding: 0 8px; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 0; }
.setting-row + .setting-row { border-top: 1px dashed var(--line); }
.setting-label { font-weight: 600; min-width: 170px; }
.setting-hint { color: var(--muted); font-size: .85rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt span {
  display: inline-block; padding: 8px 20px; cursor: pointer; font-weight: 600;
  transition: background .15s, color .15s;
}
.seg-opt input:checked + span { background: var(--teal); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid #14b8a6; outline-offset: -3px; }

/* file cards */
.file-list { display: grid; gap: 12px; margin-top: 18px; }
.file-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; overflow: hidden;
  animation: cardIn .4s ease both;
  transition: border-color .2s, box-shadow .2s;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }
.file-card[data-status="done"] { border-color: #86efac; }
.file-card[data-status="error"] { border-color: #fca5a5; background: #fff7f7; }
.fc-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.fc-info { min-width: 0; flex: 1; }
.fc-name { display: block; font-weight: 700; color: var(--ink); word-break: break-all; }
.fc-meta { color: var(--muted); font-size: .88rem; }
/* Duration is the hero number on a voice-memo card: big, tabular, teal. */
.fc-duration {
  flex-shrink: 0; font-size: 1.35rem; font-weight: 800; color: var(--teal);
  font-variant-numeric: tabular-nums; line-height: 1.2; text-align: right; min-width: 64px;
}
.fc-status { flex-shrink: 0; font-size: .82rem; font-weight: 700; color: var(--muted); background: #f3f4f6; border-radius: 999px; padding: 4px 10px; }
.file-card[data-status="done"] .fc-status { background: #dcfce7; color: var(--ok); }
.file-card[data-status="error"] .fc-status { background: #fee2e2; color: var(--err); }
.fc-progress { height: 6px; background: #e5e7eb; border-radius: 999px; margin-top: 12px; overflow: hidden; }
.fc-bar { height: 100%; width: 0; background: linear-gradient(90deg, #14b8a6, var(--teal)); border-radius: 999px; transition: width .35s ease; }
.file-card[data-status="done"] .fc-bar { background: var(--ok); }
.fc-stage { margin-top: 8px; font-size: .88rem; color: var(--muted); }
.fc-detail { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font-size: .92rem; }
.fc-est { color: var(--muted); }
.fc-result { font-weight: 700; color: var(--ink); }
.fc-note { color: var(--muted); font-size: .85rem; }
.fc-warn { margin-top: 10px; padding: 8px 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; font-size: .88rem; }
.fc-error { margin-top: 10px; padding: 8px 12px; background: #fee2e2; color: var(--err); border-radius: 8px; font-size: .9rem; }
.fc-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.check {
  position: absolute; right: 16px; bottom: 14px; width: 26px; height: 26px; color: var(--ok);
  opacity: 0; transform: scale(.5);
}
.file-card[data-status="done"] .check { opacity: 1; transform: scale(1); transition: opacity .3s .1s, transform .3s .1s cubic-bezier(.34, 1.56, .64, 1); }
.file-card[data-status="done"] .check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .45s .15s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* buttons + batch bar */
.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 11px 20px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 4px 14px rgba(15, 118, 110, .35); }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-ghost { background: #fff; color: var(--body); border: 1px solid var(--line); }
.btn-small { padding: 8px 14px; font-size: .9rem; background: var(--teal); color: #fff; }
.batch-bar {
  margin-top: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px;
  animation: fadeUp .4s ease both;
  position: sticky; bottom: 12px; box-shadow: var(--shadow);
}
.batch-stats { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.batch-stats .sep { color: var(--muted); }
.batch-stats .arrow { color: var(--teal); font-weight: 700; }
.saved-pill { background: #dcfce7; color: var(--ok); font-weight: 700; font-size: .85rem; border-radius: 999px; padding: 3px 10px; }
.saved-pill:empty { display: none; }
.batch-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* privacy / guide / faq */
.privacy, .guide, .faq { margin-top: 44px; }
.privacy h2, .guide h2, .faq h2 { color: var(--ink); font-size: 1.4rem; margin-bottom: 8px; }
.privacy { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius); padding: 20px 22px; }
.privacy-meter { font-size: 1.05rem; }
.privacy-meter strong { font-size: 1.3rem; color: var(--teal); }
.privacy-ok { color: var(--ok); font-weight: 600; }
.privacy-note { color: var(--muted); font-size: .9rem; }
.privacy-engine { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.privacy-engine code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: .85em; }
.privacy-steps { margin: 10px 0 0; padding-left: 22px; }
.privacy-steps li { margin: 4px 0; }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font: .85em ui-monospace, monospace; }
.guide .steps { padding-left: 22px; }
.guide .steps li, .guide ul li { margin: 6px 0; }
.guide code { background: #f3f4f6; border-radius: 4px; padding: 1px 5px; font-size: .9em; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 700; color: var(--ink); cursor: pointer; }
.faq summary:hover { color: var(--teal); }
.faq details p { margin: 8px 0 2px; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: #fff; padding: 24px 0 34px; color: var(--muted); font-size: .9rem; }
.site-footer .fine { font-size: .82rem; }

/* responsive */
@media (max-width: 640px) {
  .hero { padding-top: 28px; }
  .dropzone { padding: 28px 14px; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .setting-label { min-width: 0; }
  .batch-bar { position: static; }
  .fc-top { flex-wrap: wrap; }
  .fc-duration { font-size: 1.15rem; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
