:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1f2330;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #6ee7b7;
  --accent2: #7c9cff;
  --warn: #fbbf24;
  --bad: #f87171;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
header {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid #262b3a;
}
.brand { font-weight: 700; letter-spacing: .5px; color: var(--accent); }
.meter { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 13px; }
.meter-bar { width: 140px; height: 8px; background: #2a2f40; border-radius: 99px; overflow: hidden; }
#meter-fill { height: 100%; width: 0%; background: var(--accent); transition: width .4s, background .4s; }
select, button, textarea {
  background: var(--panel2); color: var(--text); border: 1px solid #2d3348; border-radius: 8px;
  padding: 7px 10px; font: inherit;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent2); }
button:disabled { opacity: .5; cursor: default; }
button:active:not(:disabled) { transform: translateY(1px) scale(.97); filter: brightness(1.15); }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
input[type=text] { background: var(--panel2); color: var(--text); border: 1px solid #2d3348; border-radius: 8px; padding: 7px 10px; font: inherit; }
.new-row { display: flex; gap: 8px; padding: 0 10px 8px; }
.new-row input { flex: 1; min-width: 0; }
.composer button#stop { background: #5b2430; color: #ffd9de; padding: 0 16px; }
body.busy .composer #send { background: #3a6b5a; color: #cfeee3; }
.working { align-self: flex-start; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 4px 2px; }
.working .wt { opacity: .7; font-variant-numeric: tabular-nums; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bob 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.ideas { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); }
.ideas-t { width: 100%; font-size: 14px; }
.chip { background: var(--panel2); border: 1px solid #2d3348; border-radius: 99px; padding: 6px 12px; color: var(--text); font-size: 14px; }
.status.retry { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
main { flex: 1; display: grid; grid-template-columns: minmax(320px, 42%) 1fr; min-height: 0; }
.chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #262b3a; }
.chat-top { display: flex; gap: 8px; padding: 10px; }
.chat-top select { flex: 1; min-width: 0; }
.log { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: #26407a; }
.msg.assistant { align-self: flex-start; background: var(--panel2); }
.msg pre { background: #0b0d12; padding: 8px; border-radius: 8px; overflow-x: auto; margin: 6px 0; font-size: 13px; }
.status { align-self: flex-start; color: var(--muted); font-size: 13px; }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #262b3a; }
.composer textarea { flex: 1; resize: none; }
.composer button { background: var(--accent); color: #062; border: 0; font-weight: 700; padding: 0 18px; }
.preview { display: flex; flex-direction: column; min-height: 0; position: relative; }
.preview-top { display: flex; align-items: center; gap: 8px; padding: 10px; color: var(--muted); }
.spacer { flex: 1; }
#frame { flex: 1; width: 100%; border: 0; background: #fff; }
.share-box {
  position: absolute; left: 12px; right: 12px; bottom: 12px; background: var(--panel);
  border: 1px solid var(--accent2); border-radius: 10px; padding: 10px 12px; font-size: 14px; word-break: break-all;
}
.share-box button { margin-left: 8px; }
@media (max-width: 800px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .meter-label { display: none; }
}

a { color: var(--accent2); }
header a { font-size: 13px; text-decoration: none; }
header .spacer { flex: 1; }
.center { align-items: center; justify-content: center; }
.card { background: var(--panel); border: 1px solid #262b3a; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 12px; width: min(360px, 92vw); }
.card.wide { width: 100%; max-width: 760px; }
.card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.card input { background: var(--panel2); color: var(--text); border: 1px solid #2d3348; border-radius: 8px; padding: 9px 10px; font: inherit; }
.card button[type=submit] { background: var(--accent); color: #062; border: 0; font-weight: 700; padding: 10px; }
.brand.big { font-size: 22px; text-align: center; }
.page { overflow-y: auto; }
.admin { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; flex: 1; }
.admin h2, .admin h3 { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #262b3a; font-size: 14px; }
tr.off td { color: var(--muted); }
td button { margin-right: 6px; padding: 4px 8px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1; min-width: 140px; }
.reveal { background: #0b0d12; border: 1px solid var(--accent); border-radius: 8px; padding: 10px; font-family: ui-monospace, monospace; word-break: break-all; user-select: all; }

[hidden] { display: none !important; }

/* ---- plan bar ---- */
.plan { padding: 0 10px 6px; }
.plan-head { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 7px 10px; font-size: 13px; color: var(--muted); }
.plan-head b { color: var(--text); font-weight: 600; }
.plan-segs { display: flex; gap: 3px; }
.plan-segs i { flex: 1; height: 6px; border-radius: 99px; background: #2a2f40; }
.plan-segs i.done { background: var(--accent); }
.plan-segs i.now { background: var(--accent2); }
.plan-list { margin: 6px 0 0; padding: 8px 10px 8px 30px; background: var(--panel2); border-radius: 8px; font-size: 13px; color: var(--muted); }
.plan-list li.done { color: var(--text); text-decoration: line-through; opacity: .7; }
.plan-list li.now { color: var(--text); font-weight: 600; }

/* ---- tap choices ---- */
.choices { align-self: flex-start; display: flex; flex-direction: column; gap: 8px; max-width: 92%; }
.choices .q { font-size: 14px; color: var(--text); }
.choices .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.choices .chip.first { border-color: var(--accent); }

/* ---- history ---- */
.history-box { max-height: 55%; overflow-y: auto; }
.history-box .h-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #262b3a; word-break: normal; }
.history-box .h-row:last-child { border-bottom: 0; }
.history-box .h-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-box .h-when { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- video clips ---- */
.composer button#cam { background: var(--panel2); color: var(--text); border: 1px solid #2d3348; font-weight: 400; padding: 0 12px; font-size: 18px; }
.overlay { position: fixed; inset: 0; background: rgba(5, 7, 12, .78); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; z-index: 20; }
.sheet { width: min(640px, 100%); background: var(--panel); border: 1px solid #262b3a; border-radius: 14px; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sheet h2, .sheet h3 { margin: 0; }
.sheet h3 { font-size: 15px; color: var(--muted); margin-top: 6px; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; }
.stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage video.mirror { transform: scaleX(-1); }
.rec-badge { position: absolute; top: 10px; left: 10px; background: rgba(180, 20, 40, .9); color: #fff; padding: 3px 10px; border-radius: 99px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); }
.note.bad { color: var(--bad); }
.note.warn { color: var(--warn); }
.name-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.name-row input { flex: 1; min-width: 0; }
.rec-buttons { align-items: center; }
.rec-buttons button.primary { background: var(--accent); color: #062; border: 0; font-weight: 700; }
.rec-buttons button.rec { background: #b3162d; color: #fff; border: 0; font-weight: 700; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-left: auto; }
.clip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.clip { background: var(--panel2); border: 1px solid #2d3348; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.clip .pic { aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; display: grid; place-items: center; color: #555; font-size: 28px; }
.clip .pic video { width: 100%; height: 100%; object-fit: cover; }
.clip .meta { padding: 6px 8px; font-size: 13px; }
.clip .meta .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip .meta .d { color: var(--muted); font-size: 12px; }
.clip .acts { display: flex; gap: 6px; padding: 0 8px 8px; }
.clip .acts button { padding: 4px 8px; font-size: 12px; }
.clip .acts .use { background: var(--accent); color: #062; border: 0; font-weight: 700; flex: 1; }
@media (max-width: 800px) {
  .overlay { padding: 8px; }
  .check { margin-left: 0; }
}
.card label.check { flex-direction: row; align-items: center; margin-left: 0; color: var(--text); }

/* ---- home / opening screen ---- */
.brand-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; letter-spacing: .5px; color: var(--accent); cursor: pointer; text-align: left; }
.brand-btn:hover { border: 0; filter: brightness(1.15); }
.home { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 16px 40px; }
.home-inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.home h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.home h2 { margin: 10px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.lede { margin: 0; color: var(--muted); font-size: 16px; max-width: 62ch; }
.home-form { display: flex; gap: 8px; }
.home-form input { flex: 1; min-width: 0; font-size: 16px; padding: 12px 14px; }
.home-form .go { background: var(--accent); color: #062; border: 0; font-weight: 700; padding: 0 20px; font-size: 16px; }
.continue { text-align: left; background: linear-gradient(135deg, #1d3a63, #23305a); border: 1px solid var(--accent2); border-radius: 12px; padding: 14px 16px; font-size: 16px; display: flex; flex-direction: column; gap: 2px; }
.continue small { color: #b9c6ee; font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { text-align: left; background: var(--panel); border: 1px solid #2d3348; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 124px; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile .ic { font-size: 28px; line-height: 1; }
.tile .t { font-weight: 700; font-size: 16px; }
.tile .d { color: var(--muted); font-size: 13px; line-height: 1.35; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.proj { text-align: left; background: var(--panel2); border: 1px solid #2d3348; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.proj .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj .d { color: var(--muted); font-size: 12px; }
.proj .bar { display: flex; gap: 3px; margin-top: 2px; }
.proj .bar i { flex: 1; height: 5px; border-radius: 99px; background: #2a2f40; }
.proj .bar i.done { background: var(--accent); }
.home-foot { margin-top: 6px; }
.linky { background: none; border: 0; color: var(--accent2); padding: 4px 0; }
.linky:hover { text-decoration: underline; border: 0; }

/* ---- phone layout: one thing at a time, with a Chat / See it bar ---- */
.tabs { display: none; }
@media (max-width: 800px) {
  body { height: 100vh; height: 100dvh; }
  header { flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px; }
  .meter { margin-left: auto; }
  .meter-bar { width: 64px; }
  #model { max-width: 150px; font-size: 13px; padding: 5px 8px; min-width: 0; }
  #signout { padding: 5px 8px; font-size: 13px; }
  main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  main .chat, main .preview { display: none; min-width: 0; }
  body:not(.tab-preview) main .chat { display: flex; border-right: 0; }
  body.tab-preview main .preview { display: flex; }
  .tabs:not([hidden]) { display: flex; border-top: 1px solid #262b3a; background: var(--panel); }
  .tabs button { flex: 1; border: 0; border-radius: 0; padding: 12px 8px; font-size: 15px; background: none; color: var(--muted); }
  .tabs button.on { color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }
  .tabs button.dot::after { content: " ●"; color: var(--accent); }
  .chat-top { flex-wrap: wrap; }
  .chat-top select { flex: 1 1 140px; }
  .preview-top { flex-wrap: wrap; gap: 6px; }
  .preview-top button { padding: 6px 9px; font-size: 13px; white-space: nowrap; }
  .home h1 { font-size: 23px; }
  .tiles, .proj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 110px; padding: 12px; }
  .composer textarea { min-width: 0; }
  .sheet { padding: 12px; }
}
