:root {
  --background: #fff;
  --foreground: #111;
  --muted: #737373;
  --border: #eaeaea;
  --surface: #f7f7f7;
  --peach: #ffd8c2;
  --peach-soft: #fff6ef;
  --peach-border: #eed9cc;
  --danger: #a32929;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--foreground); outline-offset: 4px; }

.header { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px max(20px, env(safe-area-inset-left)); }
.brand { color: var(--foreground); font-size: 17px; font-weight: 650; letter-spacing: -.55px; text-decoration: none; }
main { width: min(100%, 760px); margin: 0 auto; padding: 28px 20px max(48px, env(safe-area-inset-bottom)); }
h1 { font-size: 28px; font-weight: 550; letter-spacing: -.9px; line-height: 1.2; text-align: center; margin: 0 0 30px; }
h2 { font-size: 19px; font-weight: 550; letter-spacing: -.45px; margin: 0; }
.upload-form { width: min(100%, 560px); margin: 0 auto; }
.dropzone {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  gap: 10px;
  padding: 28px 20px;
  border: 1px dashed var(--peach-border);
  border-radius: 28px;
  background: var(--peach-soft);
  cursor: pointer;
  text-align: center;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.dropzone strong { font-size: 18px; line-height: 1.5; font-weight: 500; max-width: 100%; overflow-wrap: anywhere; letter-spacing: -.35px; }
#file-subtitle { color: var(--muted); font-size: 13px; line-height: 1.5; }
.formats { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 12px; }
.dropzone.drag { background: var(--peach); border-color: var(--foreground); }
.options { padding: 14px 2px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px; font-size: 13px; cursor: pointer; }
.toggle input { appearance: none; position: relative; flex: 0 0 40px; width: 40px; height: 24px; margin: 0; border: 1px solid transparent; border-radius: 999px; background: #e6e6e6; cursor: pointer; transition: background-color 150ms ease; }
.toggle input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #00000015; transition: transform 150ms ease; }
.toggle input:checked { background: var(--peach); }
.toggle input:checked::before { transform: translateX(16px); background: var(--foreground); box-shadow: none; }
.toggle input:disabled { opacity: .45; cursor: not-allowed; }
.toggle:has(input:disabled) { cursor: not-allowed; color: var(--muted); }
button { border: 1px solid var(--border); border-radius: 999px; min-height: 44px; padding: 10px 16px; color: var(--foreground); background: #fff; transition: background-color 150ms ease; }
button:disabled { cursor: not-allowed; background: var(--surface); border-color: var(--border); color: #8c8c8c; }
.primary { width: 100%; min-height: 50px; background: #111; border-color: transparent; color: #fff; font-size: 14px; font-weight: 500; }
.quiet { font-size: 13px; background: #fff; padding: 10px 16px; }
.availability { text-align: center; font-size: 13px; line-height: 1.6; color: var(--muted); margin: 0 0 14px; }
.progress-panel { width: min(100%, 560px); padding: 22px 2px 0; margin: 0 auto; }
.progress-heading, .result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-heading strong { font-size: 14px; font-weight: 500; }
progress { display: block; width: 100%; height: 5px; margin-top: 14px; border: 0; border-radius: 999px; overflow: hidden; accent-color: var(--peach); background: var(--surface); }
progress::-webkit-progress-bar { background: var(--surface); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--peach); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--peach); }
.progress-detail { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 12px 0 0; overflow-wrap: anywhere; }
.result-panel { margin-top: 32px; border-radius: 32px; background: var(--peach-soft); padding: 8px; }
.result-sheet { border-radius: 25px; background: #fff; padding: 18px 18px 6px; }
.export-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 20px; border-bottom: 1px dotted #dedede; }
.export-bar .toggle { justify-content: flex-start; gap: 12px; }
.transcript { height: clamp(280px, 54dvh, 520px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 12px; }
#download { background: var(--peach); border-color: transparent; font-size: 13px; }
#download-dialog { width: min(400px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 22px; border: 1px solid var(--border); border-radius: 28px; color: var(--foreground); background: #fff; box-shadow: 0 20px 80px #00000018; }
#download-dialog::backdrop { background: #00000025; }
body:has(#download-dialog[open]) { overflow: hidden; }
.downloads { display: grid; gap: 8px; margin-top: 18px; }
.downloads button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 54px; border-radius: 16px; font-size: 14px; padding: 14px 16px; text-align: left; }
.format-extension { color: var(--muted); font-size: 12px; }
.segment { padding: 22px 0; }
.segment + .segment { border-top: 1px solid #f3f3f3; }
.segment-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.time { font-variant-numeric: tabular-nums; }
.speaker { color: #505050; font-weight: 500; }
.segment p { font-size: 14px; line-height: 1.85; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.has-result .dropzone { min-height: 124px; padding-top: 20px; padding-bottom: 20px; }
.has-result .formats { margin-top: 2px; }
.login-panel { width: min(100%, 360px); margin: 20px auto 0; }
.login-form { display: grid; gap: 10px; }
.login-form label { font-size: 13px; margin-top: 10px; }
.login-form input { width: 100%; min-height: 48px; border: 1px solid #e3e3e3; border-radius: 14px; padding: 12px 14px; background: #fff; color: var(--foreground); }
.login-form .primary { margin-top: 16px; }
.error, .warning { color: var(--danger); background: #fff4f1; border-radius: 16px; font-size: 13px; line-height: 1.7; padding: 14px 16px; overflow-wrap: anywhere; }
.error { width: min(100%, 560px); margin: 20px auto 0; }
.warning { color: #795020; background: var(--peach-soft); margin: 14px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (min-width: 640px) {
  .header { min-height: 80px; padding: 16px 36px; }
  main { padding: 44px 24px 64px; }
  h1 { font-size: 30px; margin-bottom: 32px; }
  .dropzone { min-height: 232px; }
  .result-panel { padding: 12px; }
  .result-sheet { padding: 22px 30px 8px; }
  .export-bar { flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; }
  .segment p { font-size: 15px; }
}
@media (hover: hover) {
  .dropzone:hover { background: #ffefe4; border-color: #e9c8b5; }
  .primary:not(:disabled):hover { background: #333; }
  .quiet:hover, .downloads button:hover { background: var(--surface); }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; } }
@media (forced-colors: active) { .toggle input { appearance: auto; } .toggle input::before { display: none; } }
