:root {
  --paper: #101512;
  --paper-deep: #1c2821;
  --ink: #eef5ef;
  --muted: #a5b3a8;
  --line: #35483c;
  --accent: #ff8a65;
  --forest: #7ed3a0;
  --white: #18221c;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(126, 211, 160, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 211, 160, .055) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--ink); border-radius: 50%; }
.brand-mark i { width: 2px; background: var(--ink); border-radius: 2px; }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(5) { height: 7px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 14px; }
.brand-mark i:nth-child(3) { height: 20px; }
.privacy { display: inline-flex; align-items: center; gap: 8px; color: var(--forest); font-size: .82rem; font-weight: 650; }
.privacy i { width: 8px; height: 8px; border-radius: 50%; background: #4b9b73; box-shadow: 0 0 0 4px rgba(75, 155, 115, .13); }

.intro { padding: 96px 0 54px; max-width: 850px; }
.kicker { margin: 0 0 13px; color: var(--accent); font: 750 .69rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .17em; }
h1 { margin: 0; max-width: 820px; font: 500 clamp(2.55rem, 6vw, 5.15rem)/1.04 Georgia, "Times New Roman", serif; letter-spacing: -.045em; }
h1 em { display: inline-block; margin-top: .1em; color: var(--forest); font-weight: 400; }
.lede { max-width: 590px; margin: 30px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.22rem); line-height: 1.55; }

.workspace, .status-card, .result-card, .history-card { border: 1px solid var(--line); background: rgba(24, 34, 28, .92); box-shadow: var(--shadow); }
.workspace { padding: 18px; }
.dropzone { min-height: 280px; padding: 46px 24px; border: 1px dashed #627668; background: rgba(11, 17, 13, .45); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.dropzone:hover, .dropzone.dragging { background: var(--white); border-color: var(--accent); transform: translateY(-2px); }
.dropzone:focus-within { outline: 3px solid rgba(233, 83, 47, .25); outline-offset: 3px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 22px; border-radius: 50%; color: var(--white); background: var(--forest); font-size: 1.55rem; }
.dropzone strong { font: 500 1.55rem/1.2 Georgia, "Times New Roman", serif; }
.dropzone span:not(.drop-icon) { margin-top: 7px; color: var(--muted); }
.dropzone small { margin-top: 26px; color: var(--muted); font: .68rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 2px 0; }
.form-foot p { color: var(--muted); font: .67rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.form-foot p span { color: var(--accent); }
.primary { min-height: 50px; padding: 0 22px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 24px; color: #071109; background: var(--forest); text-decoration: none; font-weight: 700; cursor: pointer; transition: transform .16s ease, background .16s ease, opacity .16s ease; }
.primary:hover:not(:disabled) { background: #a0e6b9; transform: translateY(-2px); }
.primary:focus-visible, .text-button:focus-visible, summary:focus-visible { outline: 3px solid rgba(233, 83, 47, .35); outline-offset: 3px; }
.primary:disabled { opacity: .42; cursor: not-allowed; }
.primary b { font-size: 1.25rem; }

.status-card, .result-card, .history-card { margin-top: 26px; padding: 30px; }
.status-head, .result-top, .preview-head, .dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); overflow-wrap: anywhere; }
.status-pill { padding: 7px 10px; color: var(--forest); border: 1px solid #3e7654; background: #15291d; font: 700 .66rem ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.status-pill.failed { color: #8e291d; border-color: #d49a8d; background: #f8e5df; }
.progress { height: 7px; margin-top: 28px; overflow: hidden; background: var(--paper-deep); }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .4s ease; }
.status-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: .82rem; }
.error, .warnings { padding: 13px 15px; white-space: pre-wrap; line-height: 1.5; }
.error { color: #8e291d; background: #f8e5df; }

.result-card { background: var(--white); }
.result-top { align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.result-top p:not(.kicker) { color: var(--muted); margin: 10px 0 0; }
.download { min-width: 190px; }
.warnings { color: #74500c; background: #fff3d5; }
.speakers-block { padding: 22px 0; border-bottom: 1px solid var(--line); }
.speakers-block summary { width: fit-content; cursor: pointer; font-weight: 750; }
.speakers-block > p { color: var(--muted); font-size: .87rem; }
#speakerList { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.speaker { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.speaker label { color: var(--muted); font: .68rem ui-monospace, monospace; }
.speaker input { min-width: 0; padding: 11px 12px; color: var(--ink); border: 1px solid var(--line); background: var(--paper); }
.preview-head { align-items: baseline; padding: 26px 0 14px; }
.preview-head span { color: var(--muted); font-size: .8rem; }
.segments { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.segment { display: grid; grid-template-columns: 165px 1fr; gap: 22px; padding: 18px; background: var(--white); }
.segment-meta { color: var(--forest); font: 700 .68rem/1.5 ui-monospace, monospace; }
.segment p { margin: 0; line-height: 1.58; }
.segment small { grid-column: 2; color: #74500c; }
.preview-note { padding: 18px; color: var(--muted); background: var(--paper); text-align: center; }
.history-note { margin: 8px 0 18px; color: var(--muted); }
.history-list { display: grid; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--white); }
.history-item strong, .history-item span { display: block; overflow-wrap: anywhere; }
.history-item span { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.history-item a { color: var(--forest); font-weight: 700; text-decoration: none; white-space: nowrap; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 2px 0; color: var(--muted); font-size: .78rem; }
.text-button { padding: 0; color: var(--muted); border: 0; border-bottom: 1px solid currentColor; background: none; cursor: pointer; }
.hidden { display: none !important; }

dialog { width: min(650px, calc(100% - 32px)); padding: 26px; color: var(--ink); border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(22, 28, 23, .55); backdrop-filter: blur(3px); }
.dialog-head button { width: 36px; height: 36px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 1.4rem; }
dialog pre { max-height: 55vh; overflow: auto; padding: 16px; color: #dfe9e1; background: #1d2b24; font-size: .75rem; white-space: pre-wrap; }

@media (max-width: 700px) {
  .shell { width: min(100% - 24px, 1040px); padding-top: 18px; }
  .privacy { max-width: 160px; text-align: right; font-size: .7rem; }
  .intro { padding: 66px 0 40px; }
  h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .workspace { padding: 10px; }
  .dropzone { min-height: 250px; }
  .form-foot, .result-top, footer { align-items: stretch; flex-direction: column; }
  .form-foot .primary, .download { width: 100%; }
  .status-card, .result-card, .history-card { padding: 22px 18px; }
  .history-item { align-items: flex-start; flex-direction: column; }
  .segment { grid-template-columns: 1fr; gap: 8px; }
  .segment small { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
