/* spiel — talk first, cut later */
* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #0b0c10;
  --bg2: #12141a;
  --card: #171a22;
  --card2: #1e222d;
  --line: #2a2f3d;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #ffb454;
  --accent2: #ff7e5f;
  --ok: #6fdd8b;
  --err: #ff6470;
  --wave: rgba(255, 180, 84, .6);
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
.mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; }
.tiny { font-size: .74rem; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--line); background: var(--card); padding: 7px 14px; transition: border-color .12s, background .12s; }
button:hover { border-color: var(--accent); }
.ghost { background: transparent; }
.mini { padding: 1px 10px; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #201409; border: none; font-weight: 650; }
.primary:hover { filter: brightness(1.08); }
select, input[type="text"], input[type="number"], input:not([type]) { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; }
select:focus, input:focus { outline: none; border-color: var(--accent); }
kbd { background: var(--card2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-family: ui-monospace, monospace; font-size: .78em; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.brand { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .word { display: inline; color: var(--text); }
.logo { font-size: 1.2rem; }
.pill { font-size: .74rem; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; color: var(--muted); }
.pill.private { border-color: rgba(111, 221, 139, .4); color: var(--ok); }

/* ---------- home ---------- */
#home { flex: 1; display: flex; flex-direction: column; max-width: 980px; width: 100%; margin: 0 auto; padding: 0 24px; }
.hero { text-align: center; padding: 64px 12px 40px; }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.15; letter-spacing: -.02em; margin-bottom: 18px; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.hero em { color: var(--text); font-style: normal; border-bottom: 2px solid var(--accent); }
.cta { font-size: 1.1rem; padding: 13px 30px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #201409; border: none; border-radius: 12px; font-weight: 700; box-shadow: 0 8px 28px rgba(255, 140, 80, .25); }
.cta:hover { transform: translateY(-1px); filter: brightness(1.07); }
.hero .tiny { margin-top: 14px; }
.recs { padding: 8px 0 40px; }
.recs h2 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.reclist { display: flex; flex-direction: column; gap: 10px; }
.reccard { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; cursor: pointer; transition: border-color .12s; }
.reccard:hover { border-color: var(--accent); }
.reccard .t { font-weight: 600; }
.reccard .meta { color: var(--muted); font-size: .8rem; }
.reccard button { padding: 3px 10px; font-size: .78rem; }
.foot { display: flex; gap: 10px; justify-content: center; padding: 26px 0 34px; color: var(--muted); font-size: .76rem; }

/* ---------- editor chrome ---------- */
#editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.edbar { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.titlein { background: transparent; border-color: transparent; font-weight: 650; min-width: 220px; }
.titlein:hover, .titlein:focus { border-color: var(--line); background: var(--card); }
.dirty { color: var(--accent); }
.ctl { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; }
.ctl.dev { gap: 5px; }
.ctl.dev select { max-width: 190px; font-size: .76rem; padding: 4px 7px; text-overflow: ellipsis; }
.ctl.dev select:disabled { opacity: .45; }
.num { width: 58px; padding: 3px 6px; font-size: .8rem; }
.num.wide { width: 68px; }
.ctl.toggle { cursor: pointer; gap: 6px; user-select: none; }
.ctl.toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.ctl.toggle:has(input:checked) { color: var(--accent); }
.toolrow { display: flex; align-items: center; gap: 22px; padding: 8px 22px; border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap; }
#txStatus { color: var(--accent); }
#txStatus .bar { display: inline-block; width: 90px; height: 5px; background: var(--card2); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
#txStatus .bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- stage / timeline ---------- */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 24px; padding: 18px 3vw; min-height: 0; overflow: hidden; }
.bigmsg { font-size: 1.35rem; color: var(--muted); min-height: 1.6em; text-align: center; }
.bigmsg.recing { color: var(--err); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.tl-scroll { max-width: 94vw; overflow-x: auto; padding: 6px 10px 14px; }
.tl-ruler { position: relative; height: 17px; margin-bottom: 5px; }
.tick { position: absolute; top: 0; font-size: .62rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 3px; height: 14px; }
.tl-strip { position: relative; height: 72px; }
.clip { position: absolute; top: 5px; height: 62px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--card); flex-shrink: 0; overflow: hidden; transition: border-color .1s; }
.clip:hover { border-color: var(--muted); }
.clip.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.clip.unsaved { border-style: dashed; }
.clip canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.clip .lab { position: absolute; left: 5px; bottom: 2px; font-size: .62rem; color: var(--muted); z-index: 1; }
.gap { position: absolute; top: 5px; height: 62px; cursor: pointer; border: 1px dashed var(--line); border-radius: 8px; background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,.045) 5px, rgba(255,255,255,.045) 10px); }
.gap .lab { position: absolute; left: 4px; bottom: 2px; font-size: .62rem; color: var(--muted); }
.gap.cur { border-color: var(--accent); }
.caret { position: absolute; top: 0; margin-left: -1px; width: 3px; height: 72px; background: var(--accent); border-radius: 2px; animation: pulse 1.2s infinite; z-index: 2; }
.ph { position: absolute; top: -5px; bottom: -5px; width: 2px; background: #fff; z-index: 3; pointer-events: none; }
.ph .lab { position: absolute; top: -17px; left: 5px; font-size: .62rem; color: #fff; white-space: nowrap; background: rgba(11,12,16,.75); padding: 0 5px; border-radius: 5px; }
.trimh { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; z-index: 2; background: linear-gradient(90deg, var(--accent), transparent); opacity: .9; }
.trimh.r { right: 0; background: linear-gradient(270deg, var(--accent), transparent); }
.trimh.l { left: 0; }
.clip.rec { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); animation: pulse 1.2s infinite; }
.clip.dragging, .gap.dragging { opacity: .4; }
.clip.dropover, .gap.dropover { outline: 2px solid var(--accent); }

/* ---------- video feeds ---------- */
.feeds { display: flex; gap: 14px; justify-content: center; align-items: flex-end; padding: 4px 0 10px; flex-wrap: wrap; }
.feed { position: relative; background: #000; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-width: 160px; }
.feed video, .feed canvas { display: block; max-height: 30vh; max-width: 42vw; background: #000; }
.feed #feedPlay { min-width: 160px; min-height: 90px; }
.flab { position: absolute; left: 8px; top: 6px; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: rgba(11,12,16,.6); padding: 2px 7px; border-radius: 999px; }
#feedLiveWrap .flab { color: var(--err); }
.fnone { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .78rem; background: var(--bg2); }
.cropbtn { position: absolute; right: 6px; bottom: 6px; background: rgba(11,12,16,.7); font-size: .7rem; }
.cropui { position: absolute; inset: 0; background: #000; }
.cropui video { width: 100%; height: 100%; object-fit: contain; opacity: .55; max-width: none; max-height: none; }
.croprect { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; }
.croprect .h { position: absolute; width: 12px; height: 12px; background: var(--accent); border-radius: 3px; }
.croprect .nw { left: -6px; top: -6px; cursor: nwse-resize; }
.croprect .ne { right: -6px; top: -6px; cursor: nesw-resize; }
.croprect .sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.croprect .se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.croptools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; justify-content: center; padding: 6px; background: rgba(11,12,16,.8); }
.croptools button { font-size: .7rem; }

/* ---------- transcript ---------- */
.transcript { max-width: 88vw; max-height: 20vh; overflow-y: auto; font-size: .95rem; line-height: 1.75; color: var(--muted); padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); resize: vertical; }
.transcript .tx { cursor: pointer; padding: 1px 4px; border-radius: 5px; }
.transcript .tx:hover { background: var(--card2); }
.transcript .tx.live { color: var(--text); background: rgba(255, 180, 84, .13); }
.transcript .tx.pending { opacity: .5; font-style: italic; }

/* ---------- key bar + bottom ---------- */
.keybar { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 6px 14px 10px; color: var(--muted); font-size: .74rem; }
.edbottom { display: flex; align-items: center; gap: 16px; padding: 12px 22px 16px; border-top: 1px solid var(--line); }
.recbtn { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--err); background: var(--err); padding: 0; }
.recbtn.recording { animation: pulse 1.2s infinite; border-radius: 14px; }
#micMeter { opacity: .35; }
#micMeter.on { opacity: 1; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 18px; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-color: var(--err); }

@media (max-width: 720px) {
  .tag { display: none; }
  .keybar { display: none; }
  .toolrow { gap: 12px; }
}

/* features */
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding: 6px 0 34px; }
.feat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.feat h3 { font-size: 1rem; margin-bottom: 8px; }
.feat p { color: var(--muted); font-size: .88rem; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .top { padding: 10px 14px; gap: 10px; }
  .pill { display: none; }
  .hero { padding: 40px 6px 26px; }
  .feats { grid-template-columns: 1fr; }
  #home { padding: 0 14px; }

  .edbar, .toolrow, .edbottom { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .edbar .spacer, .toolrow .spacer { display: none; }
  .titlein { flex: 1 1 45%; min-width: 0; }
  .edbar .ctl, .toolrow .ctl { font-size: .78rem; }

  /* the feeds stack rather than shrink to nothing */
  .feeds { gap: 8px; padding: 4px 8px 8px; }
  .feed video, .feed canvas { max-width: 90vw; max-height: 34vh; }
  .tl-scroll { max-width: 100vw; padding: 6px 8px 12px; }

  /* the shortcut list is keyboard-only, and there is no keyboard here */
  .keybar { display: none; }
  .transcript { max-width: 94vw; max-height: 26vh; }

  .edbottom { position: sticky; bottom: 0; background: var(--bg2); border-top: 1px solid var(--line); z-index: 5; }
  .recbtn { width: 54px; height: 54px; }
  .ctl.dev select { max-width: 34vw; }
  /* a finger needs more than ten pixels to grab a trim edge */
  .trimh { width: 18px; }
  .croprect .h { width: 18px; height: 18px; }
  .croprect .nw, .croprect .sw { left: -9px; }
  .croprect .ne, .croprect .se { right: -9px; }
  .croprect .nw, .croprect .ne { top: -9px; }
  .croprect .sw, .croprect .se { bottom: -9px; }
}
@media (max-width: 520px) {
  .feeds { flex-direction: column; align-items: center; }
  .feed video, .feed canvas { max-height: 26vh; }
  .brand { font-size: 1.15rem; }
  .edbar button, .toolrow button { padding: 6px 10px; }
}
