:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #10b981;
  --warn: #f59e0b;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
    "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; }

.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  padding: 28px 32px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 16px; max-width: 980px; margin: 0 auto; }
.brand .logo { font-size: 38px; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.brand .tag { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.85); }

.container { max-width: 980px; margin: 0 auto; padding: 24px 24px 64px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 18px; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700;
}

.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: #f1f5f9; border-radius: 10px; padding: 4px;
  width: fit-content;
}
.tab {
  background: transparent; border: none; padding: 8px 16px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tab-pane { animation: fadeIn 0.18s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.warn-banner {
  background: #fffbeb; border: 1px solid #fcd34d;
  color: #92400e; padding: 10px 14px;
  border-radius: 10px; font-size: 13px; line-height: 1.6;
  margin-bottom: 14px;
}
.warn-banner a { color: #b45309; font-weight: 700; text-decoration: underline; }

.rec-panel {
  background: #fafbff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.rec-status {
  display: flex; align-items: center; gap: 12px;
  font-weight: 600; font-size: 15px; margin-bottom: 14px;
}
.rec-dot {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 50%; background: #cbd5e1;
}
.rec-dot.recording {
  background: #ef4444;
  animation: pulse 1.1s ease-in-out infinite;
}
.rec-dot.paused { background: var(--warn); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}
.rec-timer {
  margin-left: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: 0.05em;
}
.rec-meter-wrap {
  width: 100%; height: 8px; background: #e5e7eb;
  border-radius: 999px; overflow: hidden; margin-bottom: 16px;
}
.rec-meter {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 100%);
  transition: width 0.06s linear;
}
.rec-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-hint {
  margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7;
}
.rec-hint strong { color: #b45309; }
.rec-hint code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; color: var(--text);
}

.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.05s;
  background: #fafbff;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: #eff4ff;
}
.dropzone.dragover { transform: scale(1.005); }
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-main { margin: 0; font-weight: 600; }
.drop-sub  { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.file-meta {
  margin-top: 14px; padding: 10px 14px;
  background: #f1f5f9; border-radius: 10px;
  font-size: 13px; color: var(--text);
}
.file-meta strong { color: var(--primary); }

#audioPreview { margin-top: 12px; width: 100%; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em;
}
select, input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
textarea { resize: vertical; margin-bottom: 14px; }

button {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { background: var(--primary); color: #fff; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.ghost {
  background: #fff; color: var(--text); border-color: var(--border);
}
.ghost:hover:not(:disabled) { background: #f3f4f6; }

.progress-box { margin-top: 16px; }
.progress-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.progress-bar {
  width: 100%; height: 8px; background: #eef2f7;
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  width: 0%; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
}

.lang-info {
  display: inline-block;
  background: #ecfdf5; color: #047857;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; margin-bottom: 12px;
}

.transcript-toolbar {
  display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.transcript {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  min-height: 200px;
  max-height: 480px;
  overflow-y: auto;
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.8;
}
.transcript:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.ts-chunk { display: block; margin-bottom: 6px; }
.ts-time {
  display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; color: var(--muted); margin-right: 8px;
  background: #eef2f7; padding: 2px 6px; border-radius: 6px;
}
.transcript.hide-ts .ts-time { display: none; }

.export-bar { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.foot { margin-top: 28px; color: var(--muted); font-size: 13px; }
.foot details { background: #fff; padding: 12px 18px; border-radius: 10px; border: 1px solid var(--border); }
.foot summary { cursor: pointer; font-weight: 600; color: var(--text); }
.foot ul { margin: 10px 0 0; padding-left: 20px; }

.hidden { display: none !important; }

@media print {
  .app-header, .dropzone, .progress-box, button, .transcript-toolbar, .foot, #fileMeta, #audioPreview { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; padding: 8px 0; margin: 0; }
  .container { max-width: 100%; padding: 12mm; }
  .step { background: #333; }
}
