:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --accent: #38bdf8;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --danger: #f87171;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
body { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--panel);
}
.topbar .muted { color: var(--muted); font-size: 13px; }
.icon-btn { margin-left: auto; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

.stage { position: relative; flex: 1; background: #000; overflow: hidden; }
#video { width: 100%; height: 100%; object-fit: cover; }
.hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; padding: 24px; color: var(--muted);
}
.counter {
  position: absolute; top: 10px; right: 12px;
  background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 999px; font-size: 13px;
}
.counter #count { color: var(--accent); font-weight: 700; }

.controls {
  display: flex; align-items: center; justify-content: space-around;
  padding: 14px; background: var(--panel);
}
.shutter {
  width: 68px; height: 68px; border-radius: 50%;
  background: #fff; border: 5px solid var(--accent); cursor: pointer;
  transition: transform .08s ease;
}
.shutter:active { transform: scale(.92); }
.ghost {
  min-width: 76px; padding: 10px 14px; border-radius: 10px;
  background: transparent; color: var(--text); border: 1px solid #334155;
  font-size: 15px; cursor: pointer;
}
.ghost:disabled { opacity: .4; }

.strip {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 8px; background: var(--bg); min-height: 64px;
}
.strip .thumb { position: relative; flex: 0 0 auto; }
.strip img { height: 56px; width: 56px; object-fit: cover; border-radius: 6px; }
.strip .del {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #000; border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 12px; line-height: 1; cursor: pointer;
}

dialog {
  border: none; border-radius: 14px; background: var(--panel); color: var(--text);
  width: min(420px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.form h3 { margin: 0 0 12px; }
.form label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
.form label.row { display: flex; align-items: center; gap: 8px; color: var(--text); }
.form input[type=text], .form input[type=url] {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  border-radius: 8px; border: 1px solid #334155; background: var(--bg); color: var(--text);
}
.form menu { display: flex; justify-content: flex-end; padding: 0; margin: 14px 0 0; }
.form menu button {
  padding: 10px 18px; border-radius: 8px; border: none;
  background: var(--accent); color: #04293a; font-weight: 700; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid #334155; padding: 10px 16px;
  border-radius: 10px; font-size: 14px; max-width: 90vw; text-align: center;
}
.toast.err { border-color: var(--danger); color: var(--danger); }

/* ---- Photo / Video mode bar ---- */
.modebar { display: flex; gap: 6px; justify-content: center; padding: 8px; background: var(--panel); }
.mode {
  flex: 0 0 auto; padding: 7px 18px; border-radius: 999px;
  background: transparent; color: var(--muted); border: 1px solid #334155;
  font-size: 14px; cursor: pointer;
}
.mode.active { background: var(--accent); color: #04293a; border-color: var(--accent); font-weight: 700; }

/* ---- Recording state ---- */
.rec-timer {
  position: absolute; top: 10px; left: 12px;
  background: rgba(0,0,0,.55); color: #fff; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.rec-timer::first-letter { color: var(--danger); }
.shutter.recording {
  border-radius: 16px; background: var(--danger); border-color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(248,113,113,.35); } }

/* ---- Video thumbnail in the strip ---- */
.strip .thumb.vid {
  width: 56px; height: 56px; border-radius: 6px; background: #0b1220;
  display: grid; place-items: center; color: var(--accent); font-size: 20px;
}
.strip .thumb.vid .dur {
  position: absolute; bottom: 2px; right: 3px; font-size: 10px;
  background: rgba(0,0,0,.65); padding: 0 3px; border-radius: 3px; color: #fff;
}
