/* ============================================================
   VELCAM · Remote Overlay
   Design system: landing + moderator editor
   ============================================================ */

:root {
  --bg: #08080a;
  --bg-soft: #0c0c0f;
  --panel: #0f0f12;
  --panel-2: #141418;
  --panel-3: #1a1a1f;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #ededef;
  --muted: #8b8b93;
  --dim: #56565e;
  --accent: #ff6a16;
  --accent-hi: #ff8a3d;
  --accent-lo: #e2550a;
  --danger: #ff4d4d;
  --ok: #3ddc84;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #000; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

.hidden { display: none !important; }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

/* ---------- typography helpers ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow.marked { display: inline-flex; align-items: center; gap: 12px; }
.eyebrow.marked::before {
  content: '/';
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }

/* ---------- brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand b {
  font-weight: 800;
  background: var(--accent);
  color: #0a0a0a;
  padding: 1px 5px 1px 7px;
  margin-left: 2px;
  border-radius: 3px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.16s, border-color 0.16s, transform 0.08s, color 0.16s;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn.accent {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: transparent;
  color: #140800;
  box-shadow: 0 8px 26px rgba(255, 106, 22, 0.28);
}
.btn.accent:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffa05e, var(--accent));
  border-color: transparent;
}

.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); }

.btn.danger { color: #ff8d8d; border-color: rgba(255, 77, 77, 0.3); background: rgba(255, 77, 77, 0.07); }
.btn.danger:hover:not(:disabled) { background: rgba(255, 77, 77, 0.14); border-color: rgba(255, 77, 77, 0.5); }

.btn.dirty { position: relative; }
.btn.dirty::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #140800;
  opacity: 0.6;
}

.btn.small { height: 34px; padding: 0 13px; font-size: 13px; gap: 7px; border-radius: 9px; }
.btn.block { width: 100%; }

.btn svg { flex: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.icon-btn.boxed { border-color: var(--line-2); background: var(--panel-2); width: 42px; height: 42px; border-radius: var(--radius-sm); }
.icon-btn.boxed:hover { background: var(--panel-3); }
.icon-btn.on { color: var(--accent); }
.icon-btn.danger:hover { color: #ff7070; background: rgba(255, 77, 77, 0.12); }

/* ============================================================
   LANDING
   ============================================================ */
.landing {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px;
  overflow: hidden;
}

.landing::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 50% 34%, rgba(255, 106, 22, 0.08), transparent 70%),
    radial-gradient(700px 500px at 88% 88%, rgba(255, 106, 22, 0.05), transparent 70%);
  pointer-events: none;
}

.landing::after {
  content: '';
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(115deg, transparent 49.85%, rgba(255, 255, 255, 0.035) 50%, transparent 50.15%),
    linear-gradient(65deg, transparent 49.9%, rgba(255, 255, 255, 0.022) 50%, transparent 50.1%);
  background-size: 620px 620px, 880px 880px;
  pointer-events: none;
}

.landing-chrome {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.landing-chrome > * { position: absolute; pointer-events: auto; }
.chrome-tl { top: 38px; left: 44px; }
.chrome-tr { top: 42px; right: 44px; pointer-events: none; }
.chrome-plus {
  top: 52px;
  right: 380px;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.chrome-plus::before, .chrome-plus::after {
  content: '';
  position: absolute;
  background: var(--line-2);
}
.chrome-plus::before { left: 0; right: 0; top: 50%; height: 1px; }
.chrome-plus::after { top: 0; bottom: 0; left: 50%; width: 1px; }

.step-mark {
  position: absolute;
  top: -46px;
  right: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--dim);
}
.step-mark b { color: var(--muted); font-weight: 600; }

.hero-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  padding: 44px 46px 46px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0)) ,
    var(--panel);
  box-shadow: var(--shadow);
  transition: max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-card.expanded { max-width: 720px; }

.hero-card h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-card .lede {
  margin: 0;
  max-width: 52ch;
  color: #b6b6bd;
  font-size: 16px;
}

.hero-cta {
  margin-top: 34px;
  width: 100%;
  height: 62px;
  font-size: 16px;
  border-radius: 12px;
}

.stage-2 {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
  animation: riseIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.link-field { margin-bottom: 18px; }
.link-field > .eyebrow { display: block; margin-bottom: 9px; font-size: 10px; }

.copy-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow: hidden;
}
.copy-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 14px;
  height: 50px;
  font-size: 14px;
  color: #cfcfd6;
  text-overflow: ellipsis;
}
.copy-row button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-left: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 17px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s;
}
.copy-row button:hover { background: var(--panel-3); }
.copy-row button.done { color: var(--accent); }

.note { margin: 4px 0 0; font-size: 13px; color: var(--dim); }

.stage-2 .divider-line {
  height: 1px;
  background: var(--line);
  margin: 26px 0 22px;
}

.error {
  margin-top: 18px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 77, 77, 0.32);
  background: rgba(255, 77, 77, 0.08);
  color: #ff9c9c;
  font-size: 14px;
}

@media (max-width: 720px) {
  .landing { padding: 88px 16px 120px; }
  .hero-card { padding: 30px 22px 32px; }
  .chrome-tl { top: 24px; left: 20px; }
  .chrome-tr, .chrome-plus { display: none; }
  .copy-row { flex-direction: column; }
  .copy-row button { border-left: 0; border-top: 1px solid var(--line-2); height: 44px; justify-content: center; }
}

/* ============================================================
   EDITOR SHELL
   ============================================================ */
body.editor {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(255, 106, 22, 0.05), transparent 70%),
    var(--bg);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- topbar ---------- */
.topbar {
  flex: none;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 40;
}

.vline { width: 1px; height: 24px; background: var(--line-2); flex: none; }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}
.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
  transition: background 0.2s, box-shadow 0.2s;
}
.conn.good .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 106, 22, 0.16); }
.conn.good span { color: #cdcdd4; }
.conn.bad .dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 77, 77, 0.16); }
.conn.bad span { color: #ff9c9c; }

.topbar-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
.t-label { color: var(--dim); font-size: 13.5px; }

.room-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  max-width: 280px;
  transition: background 0.16s, border-color 0.16s;
}
.room-btn:hover, .room-btn[aria-expanded='true'] { background: var(--panel-2); border-color: var(--line-2); }
.room-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-btn svg { flex: none; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; flex: none; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 20px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.live-pill .live-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2a2a30;
  flex: none;
  transition: background 0.18s, box-shadow 0.18s;
}
.live-pill:hover { border-color: rgba(255, 255, 255, 0.24); }
.live-pill.on { color: #fff; border-color: rgba(255, 106, 22, 0.55); background: rgba(255, 106, 22, 0.1); }
.live-pill.on .live-dot {
  background: var(--accent);
  box-shadow: 0 0 16px rgba(255, 106, 22, 0.75);
  animation: livePulse 1.9s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 106, 22, 0.6); }
  50% { box-shadow: 0 0 24px rgba(255, 106, 22, 0.95); }
}

/* ---------- body grid ---------- */
.editor-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 398px;
  gap: 16px;
  padding: 16px 22px;
  position: relative;
}

/* ---------- left rail ---------- */
.rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 0;
  position: relative;
  z-index: 30;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 86px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.rail-btn svg { opacity: 0.85; }
.rail-btn:hover { background: var(--panel); color: var(--text); border-color: var(--line); }
.rail-btn.active {
  background: linear-gradient(180deg, rgba(255, 106, 22, 0.1), rgba(255, 106, 22, 0.03));
  border-color: rgba(255, 106, 22, 0.2);
  color: var(--text);
}
.rail-btn.active svg { color: var(--accent); opacity: 1; }
.rail-btn.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.rail-sep { height: 1px; background: var(--line); margin: 10px 26px; }
.rail-spacer { flex: 1; }

.rail-mini {
  align-self: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.rail-mini:hover, .rail-mini.active { background: var(--panel); color: var(--text); border-color: var(--line); }
.rail-mini.active { color: var(--accent); }

/* ---------- panels ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
}
.panel-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-head .spacer { flex: 1; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.hints {
  font-size: 12.5px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hints b { color: var(--muted); font-weight: 600; }
.hints i { color: var(--accent); font-style: normal; opacity: 0.7; }

/* ---------- stage ---------- */
.stage-frame {
  flex: 1;
  min-height: 0;
  position: relative;
  margin: 0 20px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent),
    #0a0a0c;
  overflow: hidden;
}

.stage-viewport {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: block;
}

.preview-wrap {
  position: relative;
  margin: 0 auto;
}

.preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px) 0 0 / 80px 80px,
    #0b0b0d;
  overflow: hidden;
}

.canvas-axis { position: absolute; inset: 0; pointer-events: none; }
.canvas-axis::before, .canvas-axis::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.055);
}
.canvas-axis::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.canvas-axis::after { top: 50%; left: 0; right: 0; height: 1px; }

.preview-item { position: absolute; cursor: move; }
.preview-item.locked { cursor: default; }
.preview-content.media { object-fit: fill; }
.preview-content.text {
  white-space: pre-wrap;
  overflow: hidden;
  font-family: Arial, sans-serif;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}
.preview-content.browser-host {
  overflow: hidden;
  background: #0e0e11;
}
/* The iframe must not swallow pointer events, or the layer cannot be dragged. */
.preview-content.browser-host iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
  background: transparent;
}
.browser-off {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  background: repeating-linear-gradient(45deg, #15151a, #15151a 20px, #111115 20px, #111115 40px);
  border: 2px dashed rgba(255, 255, 255, 0.14);
  font-family: var(--font);
  text-align: center;
  padding: 10px;
}
.browser-off b { font-size: 26px; color: var(--text); word-break: break-all; }
.browser-off span { font-size: 18px; color: var(--dim); }

.preview-content.screen-placeholder {
  background: repeating-linear-gradient(45deg, #17171c, #17171c 22px, #121216 22px, #121216 44px);
  border: 2px dashed rgba(255, 255, 255, 0.16);
}

/* overlay layer is NOT scaled -> handles keep a constant size */
.stage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}
.stage-overlay > * { pointer-events: auto; }

.guide {
  position: absolute;
  background: var(--accent);
  opacity: 0.85;
  pointer-events: none;
  display: none;
}
.guide.v { width: 1px; top: -1000px; bottom: -1000px; }
.guide.h { height: 1px; left: -1000px; right: -1000px; }
.guide.on { display: block; }

.selection-box {
  position: absolute;
  border: 1.5px solid var(--accent);
  pointer-events: none;
}
.selection-box.crop-mode { border-color: #ffb03a; border-style: dashed; }
.selection-box.locked { border-color: var(--muted); border-style: dashed; }

.handle {
  position: absolute;
  pointer-events: auto;
  z-index: 2;
}
.selection-box.locked .handle { display: none; }

.handle.corner {
  width: 11px;
  height: 11px;
  background: var(--accent);
  border: 1.5px solid #120600;
  border-radius: 2px;
}
.selection-box.crop-mode .handle.corner { background: #ffb03a; }

.handle.edge { background: transparent; }
.handle.edge.h-n, .handle.edge.h-s { left: 9px; right: 9px; height: 9px; }
.handle.edge.h-e, .handle.edge.h-w { top: 9px; bottom: 9px; width: 9px; }

.h-n { top: -5.5px; }
.h-s { bottom: -5.5px; }
.h-w { left: -5.5px; }
.h-e { right: -5.5px; }
.h-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.h-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.h-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.h-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle.edge.h-n, .handle.edge.h-s { cursor: ns-resize; }
.handle.edge.h-e, .handle.edge.h-w { cursor: ew-resize; }

.selection-label {
  position: absolute;
  top: -27px;
  left: -1px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--accent);
  color: #120600;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.selection-box.crop-mode .selection-label { background: #ffb03a; }
.selection-box.locked .selection-label { background: var(--muted); color: #0c0c0e; }

.float-bar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(20, 20, 24, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
  z-index: 5;
}
.float-bar .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }

.float-pop {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  /* Centred with a margin, not a transform: the entry animation ends on
     `transform: none` and would otherwise cancel a translateX(-50%). */
  margin-left: -119px;
  width: 238px;
  padding: 13px 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(20, 20, 24, 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: popIn 0.14s ease-out both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.float-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.float-pop-head b { font-size: 13px; letter-spacing: 0; color: var(--text); }
.float-pop input[type='range'] {
  display: block;
  width: 100%;
  height: 20px;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.float-pop .btn { margin-top: 11px; }

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px dashed var(--accent);
  background: rgba(255, 106, 22, 0.08);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 8;
}

.zoom-bar {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(17, 17, 20, 0.92);
  backdrop-filter: blur(12px);
  z-index: 9;
}
.zoom-value {
  min-width: 78px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.zoom-value:hover { background: rgba(255, 255, 255, 0.07); }
.zoom-value svg { color: var(--muted); }

/* ---------- right panel: elements ---------- */
.side .panel-head { padding-bottom: 12px; }

.elements {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.element-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.element-row:hover { background: var(--panel-3); }
.element-row.selected { border-color: rgba(255, 106, 22, 0.65); background: rgba(255, 106, 22, 0.05); }
.element-row.dragging { opacity: 0.4; }
.element-row.drop-target { border-color: var(--accent); border-style: dashed; }
.element-row.off .el-name, .element-row.off .el-type { opacity: 0.45; }

.el-grip { color: var(--dim); cursor: grab; flex: none; display: flex; }
.el-grip:active { cursor: grabbing; }

.el-thumb {
  width: 54px;
  height: 46px;
  flex: none;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #0b0b0d;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.el-thumb img, .el-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.el-thumb .glyph { font-size: 22px; font-weight: 700; color: #b9b9c0; }

.el-meta { flex: 1; min-width: 0; }
.el-type {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}
.el-name {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.el-tags { display: flex; gap: 6px; margin-top: 3px; }
.el-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 106, 22, 0.14);
  color: var(--accent-hi);
}
.el-tag.grey { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.el-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.empty-state {
  padding: 34px 18px;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
  border: 1px dashed var(--line-2);
  border-radius: 13px;
}

/* ---------- element property bits (used by drawers) ---------- */
.insp-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--dim);
  margin-bottom: 9px;
  text-transform: uppercase;
}

.field-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.field-grid.two { grid-template-columns: repeat(2, 1fr); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 10.5px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }
.field input, .field textarea, .field select {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
  padding: 0 9px;
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.16s, background 0.16s;
}
.field textarea { height: auto; padding: 9px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(255, 106, 22, 0.6); background: #0d0d10; }
.field input[type='color'] { padding: 3px; cursor: pointer; }
.field input[type='range'] { height: 36px; padding: 0; accent-color: var(--accent); }

/* ---------- drawer (rail tools) ---------- */
.drawer {
  position: absolute;
  left: 112px;
  top: 16px;
  width: 340px;
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: rgba(17, 17, 21, 0.97);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 35;
  animation: drawerIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes drawerIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}
.drawer-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
}
.drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.drawer-head .spacer { flex: 1; }
.drawer-body { overflow-y: auto; padding: 0 16px 16px; }
.drawer-body > * + * { margin-top: 12px; }

.drop-zone {
  border: 1.5px dashed var(--line-2);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: rgba(255, 106, 22, 0.06); color: var(--text); }
.drop-zone b { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 4px; }

.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.media-tile {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #0b0b0d;
  overflow: hidden;
  padding: 0;
  transition: border-color 0.16s, transform 0.1s;
}
.media-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .kind {
  position: absolute;
  left: 5px;
  bottom: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #d6d6dc;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}
.check-row input {
  width: 17px;
  height: 17px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.status-line {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}
.status-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.status-line.on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.15); }
.status-line.warn .dot { background: #ffb03a; }
.status-line.err .dot { background: var(--danger); }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--dim); }
.kv b { font-weight: 600; color: var(--text); text-align: right; word-break: break-all; }

/* ---------- popover menus ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  padding: 7px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: rgba(20, 20, 24, 0.97);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 60;
  animation: menuIn 0.14s ease-out both;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}
.menu.right { left: auto; right: 0; }
.menu.up { top: auto; bottom: calc(100% + 8px); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  text-decoration: none;
  transition: background 0.14s;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.07); }
.menu-item.on { color: var(--accent); }
.menu-item svg { color: var(--muted); flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label {
  padding: 8px 11px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.menu-input {
  width: calc(100% - 8px);
  margin: 0 4px 4px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
  padding: 0 10px;
  outline: none;
  font-size: 13.5px;
}
.menu-input:focus { border-color: rgba(255, 106, 22, 0.6); }
.menu-meta { padding: 7px 11px; font-size: 11.5px; color: var(--dim); word-break: break-all; }
.menu-meta code { color: var(--muted); font-size: 11.5px; }

/* ---------- footer ---------- */
.editor-foot {
  flex: none;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: rgba(22, 22, 26, 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  font-size: 13.5px;
  animation: toastIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-width: 360px;
}
.toast.out { animation: toastOut 0.2s ease-in both; }
.toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.err { border-color: rgba(255, 77, 77, 0.4); }
.toast.err .dot { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* ---------- responsive editor ---------- */
@media (max-width: 1480px) {
  .editor-body { grid-template-columns: 90px minmax(0, 1fr) 348px; }
  .hints { display: none; }
}

@media (max-width: 1180px) {
  body.editor { height: auto; overflow: auto; }
  .app { height: auto; }
  .editor-body { grid-template-columns: 1fr; padding: 14px; }
  .rail { flex-direction: row; overflow-x: auto; }
  .rail-btn { flex: 1; min-width: 88px; height: 70px; }
  .rail-sep, .rail-spacer { display: none; }
  .rail-mini { width: 70px; height: 70px; }
  .stage-frame { height: 58vh; }
  .side { height: 70vh; }
  .drawer { left: 14px; right: 14px; width: auto; top: 96px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 14px; gap: 10px; }
  .topbar-mid { order: 3; width: 100%; justify-content: flex-start; }
}
