:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e4e8ee;
  --text: #1b2430;
  --muted: #6b7785;
  --blue: #1e6bff;
  --blue-dark: #1554d1;
  --blue-soft: #e8f0ff;
  --shadow: 0 4px 16px rgba(27, 36, 48, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; min-height: 100vh; }
.hidden { display: none !important; }

.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo {
  width: 24px; height: 24px; border-radius: 6px; background: var(--blue);
  color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.wordmark { font-weight: 700; letter-spacing: -0.02em; }
.sep { color: var(--border); }
.section { color: var(--muted); font-weight: 500; }
.build-chip {
  font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}

.toolbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.search-box {
  flex: 1; min-width: 240px; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px;
}
.search-box svg { color: var(--muted); flex-shrink: 0; }
.search-box input { flex: 1; border: 0; outline: none; font: inherit; background: transparent; }
.search-box kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; color: var(--muted);
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.chip.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head h1 { font-size: 22px; letter-spacing: -0.02em; }
.sub { color: var(--muted); margin-top: 4px; margin-bottom: 20px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 8px 0 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.hl-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
  text-align: left; font: inherit; color: inherit; padding: 0; display: block; width: 100%;
}
.hl-card:hover { border-color: #c8d4e8; box-shadow: var(--shadow); }
.hl-thumb {
  aspect-ratio: 16/10; background: linear-gradient(145deg, #2a3544, #1b2430);
  position: relative; display: flex; align-items: center; justify-content: center;
}
.play-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.95); color: var(--text);
  border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700;
  border: 0; pointer-events: none;
}
.play-btn em { font-style: normal; color: var(--blue); }
.dur-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 4px; padding: 2px 6px;
}
.hl-body { padding: 12px 14px 14px; }
.hl-quote { font-size: 13.5px; font-weight: 500; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hl-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag { background: var(--bg); border-radius: 4px; padding: 2px 6px; font-weight: 600; font-size: 11px; }
.fmt-tag { color: var(--blue); font-weight: 700; font-size: 11px; }

.quote-hits { margin-bottom: 28px; }
.hit {
  width: 100%; text-align: left; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font: inherit; color: inherit;
}
.hit:hover { border-color: var(--blue); }
.hit .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.hit mark { background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; padding: 0 2px; border-radius: 2px; }
.empty-grid { color: var(--muted); padding: 32px 0; grid-column: 1 / -1; }

.drawer {
  position: fixed; inset: 0; z-index: 20; background: rgba(27,36,48,0.35);
  display: flex; justify-content: flex-end;
}
.drawer-panel {
  width: min(420px, 100%); background: #fff; height: 100%; overflow: auto;
  padding: 20px; box-shadow: -8px 0 32px rgba(0,0,0,0.12); position: relative;
}
.drawer-close {
  position: absolute; top: 12px; right: 12px; border: 0; background: var(--bg);
  width: 32px; height: 32px; border-radius: 8px; font-size: 18px; cursor: pointer; color: var(--muted);
}
.drawer-player {
  aspect-ratio: 16/9; border-radius: 10px; background: #1b2430;
  display: flex; align-items: center; justify-content: center; margin: 12px 0 16px;
}
.play-dur {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 0; border-radius: 999px; padding: 10px 16px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.play-dur em { font-style: normal; color: var(--blue); }
.drawer-quote { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.drawer-meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.transcript.mini { margin-bottom: 16px; }
.t-line { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.t-line.on { background: var(--blue-soft); margin: 0 -8px; padding: 8px; border-radius: 6px; border-bottom: 0; }
.t-line .who { font-weight: 700; font-size: 11px; color: var(--muted); display: block; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn-primary, .btn-ghost {
  border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 14px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }

.snip-modal {
  position: fixed; inset: 0; z-index: 30; background: rgba(27,36,48,0.4);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.snip-card {
  background: #fff; border-radius: 12px; padding: 22px; width: min(400px, 100%);
  box-shadow: var(--shadow);
}
.snip-card h2 { font-size: 16px; margin-bottom: 8px; }
.modal-quote { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.field-label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.durations, .formats { display: flex; gap: 6px; }
.durations button, .formats button {
  flex: 1; border: 1px solid var(--border); background: #fff;
  border-radius: 7px; padding: 8px; font: inherit; cursor: pointer;
}
.durations button.on, .formats button.on {
  border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 600;
}
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; z-index: 40;
}
