:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --border: #e6e9e6;
  --text: #1a1f1a;
  --muted: #6b756b;
  --mint: #12b76a;
  --mint-dark: #039855;
  --mint-soft: #e8f8ef;
  --mint-line: #a6f4c5;
  --shadow: 0 8px 24px rgba(16, 24, 16, 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; }

.topnav {
  height: 48px; display: flex; align-items: center; gap: 20px;
  padding: 0 18px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); }
.wordmark { border: 0; background: none; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; letter-spacing: -0.02em; }
nav { display: flex; gap: 4px; }
.nav {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500;
  color: var(--muted); padding: 6px 10px; border-radius: 6px; cursor: pointer;
}
.nav.on { color: var(--text); background: var(--mint-soft); }
.nav:disabled { opacity: 0.4; cursor: not-allowed; }
.build-chip {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; background: #fff;
}

.search-wrap { max-width: 680px; margin: 48px auto; padding: 0 20px; }
.search-wrap h1 { font-size: 28px; letter-spacing: -0.03em; margin-bottom: 6px; }
.sub { color: var(--muted); margin-bottom: 20px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.search-box svg { color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: none; font: inherit; font-size: 15px; background: transparent; }
.search-box kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border-radius: 4px; padding: 3px 6px; color: var(--muted);
}
.scope { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.chip.on { border-color: var(--mint); background: var(--mint-soft); color: var(--mint-dark); }
.label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 16px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.hit-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.hit {
  text-align: left; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color 0.12s;
}
.hit:hover { border-color: var(--mint); }
.hit .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.hit .line { font-size: 14px; }
.hit mark { background: var(--mint-soft); color: var(--mint-dark); font-weight: 700; padding: 0 2px; border-radius: 2px; }
.empty { color: var(--muted); padding: 20px 0; }

.studio { display: grid; grid-template-columns: 1.4fr 0.9fr; height: calc(100vh - 48px); }
.studio-left {
  border-right: 1px solid var(--border); background: #fff;
  display: flex; flex-direction: column; min-height: 0;
}
.studio-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.back { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; font-size: 13px; }
.ep-meta { font-size: 13px; font-weight: 600; flex: 1; }
.tx-search { width: 100%; }
.tx-search input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font: inherit; outline: none;
}
.tx-search input:focus { border-color: var(--mint); }
.transcript { overflow: auto; padding: 8px 0; flex: 1; }

.t-line {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px;
  padding: 10px 16px; align-items: start; cursor: pointer;
  border-left: 3px solid transparent;
}
.t-line:hover { background: #f3faf6; }
.t-line.on {
  background: var(--mint-soft);
  border-left-color: var(--mint);
}
.t-line .ts { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; }
.t-line .who { font-weight: 700; font-size: 12px; color: var(--muted); display: block; margin-bottom: 2px; }
.t-line .spoken { font-size: 14px; }
.t-line.on .spoken { font-weight: 500; }
.scissors {
  border: 1px solid var(--mint-line); background: #fff; color: var(--mint-dark);
  border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; opacity: 0;
}
.t-line:hover .scissors, .t-line.on .scissors { opacity: 1; }

.studio-right {
  display: flex; flex-direction: column; background: var(--bg); min-height: 0;
}
.video-ph {
  margin: 16px; aspect-ratio: 16/9; border-radius: 10px;
  background: #1f2923; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.play {
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,0.92); cursor: pointer;
}
.video-ph .ts {
  position: absolute; bottom: 10px; right: 10px;
  font-size: 11px; color: #fff; background: rgba(0,0,0,0.5);
  border-radius: 4px; padding: 2px 6px;
}
.tabs { padding: 0 16px; border-bottom: 1px solid var(--border); }
.tab {
  border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px;
  color: var(--mint-dark); padding: 10px 4px; border-bottom: 2px solid var(--mint); cursor: pointer;
}
.clips-rail { flex: 1; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.clip-item {
  display: grid; grid-template-columns: 72px 1fr; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px;
}
.thumb {
  aspect-ratio: 16/10; border-radius: 6px; background: linear-gradient(135deg, #2d3b32, #1a2420);
  display: grid; place-items: center; color: rgba(255,255,255,0.7); font-size: 10px; font-weight: 700;
}
.clip-item p { font-size: 12px; }
.clip-item .cmeta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.snip-bar {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: #fff;
}

.page { max-width: 900px; margin: 32px auto; padding: 0 20px; }
.page h1 { font-size: 24px; margin-bottom: 4px; }
.clips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.snip-card-ui {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.snip-card-ui .badge { display: inline-block; font-size: 11px; font-weight: 700; background: var(--mint-soft); color: var(--mint-dark); border-radius: 4px; padding: 2px 6px; margin-bottom: 8px; }
.snip-empty { color: var(--muted); padding: 24px 0; }

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

.snip-modal {
  position: fixed; inset: 0; z-index: 30; background: rgba(16,24,16,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(--mint); background: var(--mint-soft); color: var(--mint-dark); font-weight: 600;
}
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }

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

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .studio-right { border-top: 1px solid var(--border); }
}
