:root {
  --bg: #f7f3eb;
  --card: #fffdf8;
  --text: #17130d;
  --muted: #706a5d;
  --line: #eadfcd;
  --gold: #c8912f;
  --gold-dark: #9d6d18;
  --green: #16834a;
  --red: #bb2d2d;
  --blue: #315b8c;
  --shadow: 0 18px 60px rgba(42, 31, 9, 0.10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #fff8e9 0, var(--bg) 36%, #f5ecdf 100%);
  min-height: 100vh;
}
button, input, select { font: inherit; }
.page-shell { max-width: 1240px; margin: 0 auto; padding: 36px 20px 60px; }
.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 34px;
  border-radius: 32px;
  background: linear-gradient(135deg, #211707 0%, #62400f 60%, #b07a23 100%);
  color: white;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.hero-copy { position: relative; z-index: 1; max-width: 760px; }
.eyebrow, .section-kicker, .preview-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #f4d68d;
  margin: 0 0 10px;
  font-weight: 800;
}
.section-kicker, .preview-kicker { color: var(--gold-dark); }
h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1; margin: 0 0 16px; letter-spacing: -0.04em; }
h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
h4 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.subtitle { max-width: 760px; color: rgba(255,255,255,0.84); font-size: 17px; margin: 0; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.hero-btn, .hero-pill, .chip, .muted-badge {
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 12px;
}
.hero-btn {
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
}
.hero-btn:hover { transform: translateY(-1px); }
.hero-pill { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.9); }
.health-card {
  position: relative;
  z-index: 1;
  min-width: 260px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 14px 16px;
  border-radius: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.health-card.ok { background: rgba(22,131,74,0.20); }
.health-card.warn { background: rgba(200,145,47,0.20); }
.health-card.bad { background: rgba(187,45,45,0.20); }
.health-card span { color: rgba(255,255,255,0.78); }
.grid { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 24px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head.compact { margin-bottom: 16px; }
.chip { border: 1px solid var(--line); color: var(--gold-dark); background: #fff6e3; }
.file-box {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  border: 2px dashed #d9c393;
  border-radius: 22px;
  padding: 34px 22px;
  background: #fff8ea;
  cursor: pointer;
  transition: 0.18s ease;
}
.file-box:hover { transform: translateY(-2px); border-color: var(--gold); }
.file-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: #f0d396; font-size: 28px; font-weight: 900; }
.file-box input { display: none; }
.file-box span:last-child { color: var(--muted); font-size: 13px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
label span { display: block; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
select, input[type="password"], input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: white; color: var(--text); outline: none;
}
select:focus, input[type="password"]:focus, input[type="text"]:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(200,145,47,0.12); }
.toggle-row { margin: 18px 0; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fffaf0; }
.toggle-row input { margin-top: 5px; }
.toggle-row small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.primary-btn, .ghost-btn, .download-btn, .danger-btn, .icon-btn {
  border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 900; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: 0.18s ease;
}
.primary-btn { width: 100%; color: white; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 10px 24px rgba(157,109,24,0.22); }
.primary-btn:hover, .download-btn:hover, .ghost-btn:hover, .danger-btn:hover, .icon-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ghost-btn { background: #f4ead8; color: #5d3d0f; }
.danger-btn { border: 1px solid rgba(187,45,45,0.35); background: rgba(187,45,45,0.08); color: var(--red); }
.inline-btn { width: auto; }
.small-btn { padding-inline: 14px; min-width: 74px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: #f5ecd8; color: #5d3d0f; font-size: 24px; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; line-height: 1.55; }
.hidden { display: none !important; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 22px; background: linear-gradient(180deg, #fffdf8 0%, #fff9ef 100%); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.job-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.job-topline h3 { margin: 0 0 5px; font-size: 20px; word-break: break-word; }
.job-topline p { margin: 0; color: var(--muted); font-size: 13px; }
.job-badge { text-transform: uppercase; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; padding: 8px 10px; border-radius: 999px; background: #eee2cf; color: #765018; white-space: nowrap; }
.job-badge.completed { color: var(--green); background: rgba(22,131,74,0.12); }
.job-badge.failed { color: var(--red); background: rgba(187,45,45,0.12); }
.job-badge.processing { color: var(--blue); background: rgba(49,91,140,0.12); }
.progress-panel { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: #fffaf1; }
.progress-header-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.progress-bar { height: 14px; background: #eee4d4; border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), #e5bb65); border-radius: inherit; transition: width 0.35s ease; }
.current-step { color: var(--muted); margin: 12px 0 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { border: 1px solid var(--line); border-radius: 14px; background: #fffaf1; padding: 12px; }
.stat strong { display: block; font-size: 13px; }
.stat span { color: var(--muted); font-size: 12px; }
.error-box {
  border: 1px solid rgba(187,45,45,0.18);
  background: rgba(187,45,45,0.06);
  color: #802020;
  border-radius: 18px;
  padding: 14px 16px;
  margin: 8px 0 16px;
  line-height: 1.5;
}
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px; }
.download-btn { background: #1c160d; color: white; font-size: 13px; }
.preview-card { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, #fffefb 0%, #fff8ef 100%); overflow: hidden; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.preview-kicker { margin-bottom: 5px; }
.muted-badge { background: #f8ebcb; color: #6d4d18; }
.preview-box {
  min-height: 300px;
  max-height: 520px;
  overflow: auto;
  padding: 20px;
  line-height: 1.72;
  white-space: pre-wrap;
  font-size: 14px;
  color: #20180e;
}
.logs-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); }
.logs-box summary { cursor: pointer; color: var(--text); font-weight: 800; }
#logs { margin-top: 12px; display: grid; gap: 8px; max-height: 260px; overflow: auto; font-size: 12px; }
.log-line { padding: 10px; background: #f8f0e0; border-radius: 10px; }
.history-card { margin-top: 24px; }
.history-list { display: grid; gap: 12px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fffaf0; }
.history-item h3 { margin: 0 0 4px; font-size: 15px; word-break: break-word; }
.history-item p { margin: 0; color: var(--muted); font-size: 12px; }
.history-actions { display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 460px; padding: 14px 16px; border-radius: 16px; background: #19140c; color: white; box-shadow: var(--shadow); z-index: 20; }
.toast.bad { background: var(--red); }
.toast.ok { background: var(--green); }
.chip-ok { color: var(--green); background: rgba(22,131,74,0.10); border: 1px solid rgba(22,131,74,0.25); }
.chip-warn { color: var(--gold-dark); background: #fff6e3; border: 1px solid var(--line); }
.modal { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26, 18, 5, 0.54); backdrop-filter: blur(4px); }
.modal-dialog {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 30px 100px rgba(31, 21, 6, 0.26);
  padding: 24px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.settings-form { display: grid; gap: 16px; }
.settings-form small { display: block; color: var(--muted); margin-top: 7px; line-height: 1.4; font-size: 12px; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
@media (max-width: 980px) {
  .hero, .grid { grid-template-columns: 1fr; display: grid; }
  .hero { padding: 26px; }
  .health-card { min-width: 0; width: 100%; }
  .field-grid, .stats-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .page-shell { padding-inline: 14px; }
  .preview-head, .settings-actions, .hero-actions { flex-direction: column; align-items: stretch; }
  .download-btn, .settings-actions button, .hero-btn { width: 100%; }
  .password-row { grid-template-columns: 1fr; }
}

.footer-credit { text-align: center; color: var(--muted); font-weight: 800; margin: 22px 0 0; font-size: 13px; }

.developer-credit { margin: 16px 0 0; color: rgba(255,255,255,0.86); font-weight: 800; letter-spacing: 0.02em; }


.player-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fffefb 0%, #fff8ef 100%);
  overflow: hidden;
  margin: 0 0 16px;
}

.player-card audio {
  display: block;
  width: calc(100% - 36px);
  margin: 18px;
  accent-color: var(--gold);
}

.timed-transcript {
  white-space: normal;
  display: block;
}

.phrase {
  display: inline;
  padding: 2px 3px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 2.05;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  border-bottom: 2px solid rgba(200, 145, 47, 0.28);
}

.phrase:hover {
  background: rgba(200, 145, 47, 0.10);
}

.phrase.active {
  background: rgba(200, 145, 47, 0.30);
  box-shadow: 0 0 0 3px rgba(200, 145, 47, 0.13);
  border-bottom-color: var(--gold-dark);
}

.phrase-time {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  color: var(--gold-dark);
  background: #fff1ce;
  border: 1px solid rgba(200,145,47,0.24);
  border-radius: 999px;
  padding: 1px 7px;
  margin: 0 5px 0 0;
  vertical-align: middle;
}
