:root {
  --bg: #0b0d11; --panel: #14171c; --panel-2: #1c2129; --line: #2a3038;
  --text: #e9edf2; --muted: #8892a1; --accent: #f4c04e;
  --ok: #4ade80; --warn: #fb923c; --err: #f87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; }
.spacer { flex: 1; }
.badge { font-size: 12px; color: var(--muted); }
.grow { flex: 1; min-width: 260px; }
.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); max-width: 260px; }
.err { color: var(--err); font-size: 13px; min-height: 16px; }

header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
header h1 { font-size: 16px; letter-spacing: .18em; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--err); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card .body { padding: 14px; }

.linkbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px; }
.link-row { display: flex; gap: 8px; }
input.code { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; }
input[type=password] { width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 11px 12px; font-size: 15px; }

button, .btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: #14171c; border-color: var(--accent); font-weight: 700; }
button.ghost, .btn.ghost { background: transparent; }
button.danger, .btn.danger { color: var(--err); border-color: #4a282b; }
button.danger:hover, .btn.danger:hover { border-color: var(--err); }
button:disabled { opacity: .45; cursor: not-allowed; }

.grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.banner { padding: 14px 18px; font-size: 16px; font-weight: 650; background: var(--panel-2);
  border-bottom: 1px solid var(--line); transition: background .15s, color .15s; }
.banner.armed { background: rgba(74,222,128,.16); color: var(--ok); }
.banner.waiting { background: rgba(244,192,78,.16); color: var(--accent); }
.banner.idle { color: var(--muted); }

.preview { position: relative; background: #000; display: flex; align-items: center;
  justify-content: center; min-height: 340px; max-height: 72vh; }
.preview canvas { max-width: 100%; max-height: 72vh; width: auto; height: auto; display: none; }
.preview .placeholder { color: var(--muted); font-size: 14px; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.check.big { font-size: 15px; color: var(--text); }
.num { width: 64px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font-family: inherit; font-size: 14px; }

.grid-covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.cover { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.cover img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.cover:hover { border-color: var(--accent); }

.cover-card { position: relative; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; }
.cover-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cover-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; display: block; }
.cover-card .pick { position: absolute; top: 12px; left: 12px; z-index: 2; }
.cover-card .pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.cover-card .meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.cover-card .meta .x { margin-left: auto; width: 22px; height: 22px; padding: 0; line-height: 1; border-radius: 50%; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; }

.overlay { position: fixed; inset: 0; background: rgba(5,7,10,.85); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.overlay[hidden] { display: none; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px; }

/* phone camera page */
body.cam { background: #000; overflow: hidden; }
.cam-stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.cam-stage video { width: 100%; height: 100%; object-fit: contain; }
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud .top { position: absolute; top: 0; left: 0; right: 0; padding: 12px 16px;
  display: flex; justify-content: space-between; font-size: 13px; }
.hud .top .pill { background: rgba(0,0,0,.4); border-color: rgba(255,255,255,.18); }
.hud .bottom { position: absolute; bottom: 24px; left: 0; right: 0; display: flex;
  justify-content: center; align-items: center; gap: 16px; pointer-events: auto; }
.shutter { width: 84px; height: 84px; border-radius: 50%; background: var(--accent);
  color: #14171c; border: 4px solid rgba(255,255,255,.35); font-size: 26px;
  line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.shutter small { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .09s; }
.flash.go { opacity: .85; transition: none; }
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.72); padding: 8px 14px; border-radius: 999px; font-size: 13px; }
