/* ==========================================================================
   studio — app.css
   Hand-rolled light theme. No frameworks.
   Palette is tuned for WCAG AA (>=4.5:1) body text contrast.
   ========================================================================== */

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #1b2027;          /* ~15:1 on white */
  --muted: #57606c;        /* ~6.4:1 on white */
  --line: #d9dee6;
  --line-strong: #c3ccd9;

  --accent: #1d4ed8;       /* 6.3:1 on white; white on it = 6.7:1 */
  --accent-hover: #1a44bd;
  --accent-soft: #e8eefc;

  --ok: #176a35;
  --ok-soft: #e6f4ea;
  --err: #b42318;
  --err-soft: #fdeceb;
  --warn: #8a5a00;

  --tl-bg: #171b21;
  --tl-block: #2b3342;
  --tl-line: #20252e;
  --tl-ink: #eef1f6;
  --tl-muted: #aab4c4;     /* ~6.8:1 on --tl-bg */
  --playhead: #ff6b5e;

  --radius: 12px;
  --nav-h: 52px;
  --shadow: 0 2px 10px rgba(20, 30, 50, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

h1 { font-size: 22px; letter-spacing: -0.2px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 6px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Top nav
   -------------------------------------------------------------------------- */
.nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--nav-h);
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--ink);
  text-decoration: none;
}

.nav-right { display: flex; align-items: center; gap: 8px; }

.nav-user {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }

.btn-soft { background: var(--surface-2); }
.btn-soft:hover { background: var(--accent-soft); border-color: #c9d6f2; }

.btn-danger { color: var(--err); border-color: #e8c1bd; background: var(--surface); }
.btn-danger:hover { background: var(--err-soft); border-color: #dcaaa5; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   Cards / badges
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); border-color: #bfe0cb; color: var(--ok); }
.badge-warn { background: #fff4e5; border-color: #f0d8ac; color: var(--warn); }

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 44px;
}

.page-project .page { max-width: none; padding: 0; }

/* --------------------------------------------------------------------------
   Auth pages (login / register)
   -------------------------------------------------------------------------- */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 44px 16px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  padding: 26px 26px 20px;
  box-shadow: var(--shadow);
}

.auth-mark { margin-bottom: 12px; }

.auth-sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 18px; }

.auth-alt { font-size: 13px; color: var(--muted); text-align: center; margin: 16px 0 0; }

/* fields (shared) */
.field { display: block; margin-bottom: 14px; font-size: 13px; }
.field > span { display: block; font-weight: 600; margin-bottom: 5px; color: var(--ink); }

input, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

.form-err {
  background: var(--err-soft);
  border: 1px solid #f0c3bf;
  color: var(--err);
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-sub { color: var(--muted); font-size: 13.5px; margin: 5px 0 0; }

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.grid-note {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
  font-size: 14px;
}

.proj-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.proj-card:hover {
  border-color: #b9c6dd;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.proj-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.proj-actions {
  display: flex;
  gap: 8px;
  flex: none;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.proj-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }

.proj-meta { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 29, 38, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }

.modal { width: min(460px, 100%); padding: 20px 22px; box-shadow: 0 12px 40px rgba(10, 15, 25, 0.3); }
.modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------------------
   Project page — 2-pane shell
   -------------------------------------------------------------------------- */
.panes {
  display: flex;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

.pane { min-height: 0; }

.pane-chat {
  width: 40%;
  min-width: 320px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.pane-viewer {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* mobile tab switcher (visible < 860px only) */
.pane-tabs { display: none; }

/* --------------------------------------------------------------------------
   Chat pane
   -------------------------------------------------------------------------- */
.chat-layout { display: flex; height: 100%; min-height: 0; }

.chat-sidebar {
  flex: none;
  width: 182px;
  border-right: 1px solid var(--line);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  min-height: 0;
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 6px 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.chat-item:hover { background: var(--surface-2); }
.chat-item.active {
  background: var(--accent-soft);
  border-color: #c9d6f2;
}

.chat-item-main { flex: 1; min-width: 0; }

.chat-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item.active .chat-item-title { color: var(--accent); }

.chat-item-count {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.chat-item-del {
  flex: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.chat-item:hover .chat-item-del, .chat-item.active .chat-item-del { opacity: 1; }
.chat-item-del:hover { background: var(--err-soft); color: var(--err); }

.chat-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thread-note { color: var(--muted); font-size: 13.5px; text-align: center; margin: 24px auto; }

/* messages */
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-assistant { justify-content: flex-start; }

.bubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 14px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.msg-user .bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg-assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 5px;
}

.msg-text { white-space: pre-wrap; }
.msg-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 4px;
}

/* agent "steps" (tool calls) */
.steps { margin: 0 0 8px; }
.steps summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.steps summary::-webkit-details-marker { display: none; }
.steps summary::before {
  content: "▸";
  font-size: 10px;
  transition: transform 0.15s;
}
.steps[open] summary::before { transform: rotate(90deg); }
.steps[open] summary { color: var(--accent); }

.step-chips { display: flex; flex-direction: column; gap: 6px; margin-top: 7px; }

.step-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
}
.step-chip.step-live {
  border-color: #b9c6dd;
  background: #eef3fe;
  animation: chip-in 0.18s ease-out;
}

.step-chip-top { display: flex; align-items: baseline; gap: 7px; min-width: 0; }

.step-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  flex: none;
}

.step-args {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.step-result {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* thinking indicator */
.thinking {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  padding: 2px 0;
}
.thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1s infinite ease-in-out;
}
.thinking i:nth-child(2) { animation-delay: 0.18s; }
.thinking i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* composer */
.chat-composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 12px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.chat-composer textarea {
  flex: 1;
  resize: none;
  max-height: 160px;
  min-height: 38px;
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   Viewer pane
   -------------------------------------------------------------------------- */
.viewer-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.viewer-head-main { min-width: 0; }

#proj-name {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.viewer-actions { display: flex; gap: 7px; flex-wrap: wrap; flex: none; }

.viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* render preview */
.preview-wrap { flex: none; }

.preview-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

#preview-video {
  display: block;
  margin: 0 auto;
  max-height: 46vh;
  max-width: 100%;
  width: auto;
  background: #10131a;
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */
.timeline-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 12px 14px;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.zoom-group { display: flex; gap: 6px; }

.time-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 11px;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  background: var(--tl-bg);
  touch-action: pan-y;
}

.tl-canvas {
  position: relative;
  cursor: crosshair;
  user-select: none;
}

.tl-ruler { position: relative; height: 22px; }

.tl-tick {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  padding-left: 5px;
  font-size: 10px;
  line-height: 22px;
  color: var(--tl-muted);
  white-space: nowrap;
  pointer-events: none;
}

.tl-track {
  display: flex;
  height: 92px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tl-block {
  position: relative;
  height: 100%;
  flex: none;
  background: var(--tl-block);
  border-right: 1px solid var(--tl-bg);
  overflow: hidden;
}
.tl-block:last-child { border-right: none; }
.tl-block:hover { filter: brightness(1.15); }
.tl-block.active {
  outline: 2px solid #7aa2ff;
  outline-offset: -2px;
  z-index: 2;
}

.tl-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.94;
  pointer-events: none;
}

.tl-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  padding: 4px 6px;
  background: linear-gradient(to top, rgba(8, 11, 16, 0.82) 30%, rgba(8, 11, 16, 0.35) 65%, transparent);
  color: var(--tl-ink);
  font-size: 10.5px;
  line-height: 1.3;
  pointer-events: none;
}
.tl-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label .tl-dur { color: #cfd7e3; font-size: 10px; }

.tl-block.tl-compact .tl-label { display: none; }

/* playhead */
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--playhead);
  pointer-events: none;
  z-index: 3;
}
.tl-handle {
  position: absolute;
  top: 0;
  left: -7px;
  width: 12px;
  height: 16px;
  background: var(--playhead);
  border-radius: 6px 6px 0 0;
}

.timeline-empty {
  margin-top: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
}
.timeline-empty[hidden] { display: none; }

/* active-segment readout */
.segment-readout {
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  min-height: 46px;
}
.segment-readout[hidden] { display: none; }

.seg-empty { color: var(--muted); }
.seg-title { font-weight: 700; font-size: 13.5px; }
.seg-meta { color: var(--muted); font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.seg-note { margin-top: 7px; color: var(--warn); }
.seg-text { margin-top: 7px; font-style: italic; color: var(--ink); }
.seg-fx { margin-top: 5px; color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  background: #20262e;
  color: #f2f5f8;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  max-width: min(92vw, 480px);
  text-align: center;
  animation: toast-in 0.18s ease-out;
  transition: opacity 0.25s, transform 0.25s;
}
.toast-ok { background: var(--ok); }
.toast-error { background: var(--err); }
.toast-out { opacity: 0; transform: translateY(6px); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Scrollbars (webkit)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #c2cad5;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb {
  background: #4a5361;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* --------------------------------------------------------------------------
   Responsive — < 860px: 2-pane becomes tab switcher
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .chat-sidebar { width: 158px; }
  .bubble { max-width: 92%; }
}

@media (max-width: 860px) {
  .page { padding: 18px 14px 36px; }

  .pane-tabs {
    display: flex;
    gap: 7px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .pane-tab {
    flex: 1;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 9px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
  }
  .pane-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .panes { height: calc(100vh - var(--nav-h) - 47px); }

  .panes[data-active-pane="chat"] .pane-viewer { display: none; }
  .panes[data-active-pane="viewer"] .pane-chat { display: none; }

  .pane-chat { width: 100%; min-width: 0; border-right: none; }
  .pane-viewer { width: 100%; }

  /* sidebar becomes a horizontal strip */
  .chat-layout { flex-direction: column; }
  .chat-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .chat-list {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
    padding-bottom: 2px;
  }
  .chat-item { flex: none; max-width: 180px; }
  .chat-item-del { opacity: 1; }

  .viewer-head { padding: 12px 14px; }
  .viewer-body { padding: 12px 12px 22px; }
  .viewer-actions .btn { flex: 1; }

  #preview-video { max-height: 38vh; }

  .bubble { max-width: 94%; }
  .chat-thread { padding: 12px 12px 8px; }
}

@media (max-width: 480px) {
  .nav { padding: 0 12px; }
  .nav-user { max-width: 90px; }
  .proj-grid { grid-template-columns: 1fr; }
  .viewer-actions { width: 100%; }
}
