:root {
  /* ScoreVision product palette (Brand Guide v4.0, 2026) */
  --bg: #0F3950;         /* Primary-Dark */
  --panel: #123f57;
  --panel-2: #18516E;    /* Primary */
  --line: #2a627f;
  --text: #F6F8FB;       /* Neutral-1 */
  --muted: #B0BEC5;      /* Neutral-4 */
  --brand: #CDDB3E;      /* ScoreVision Green — CTAs */
  --brand-2: #bccb33;
  --brand-text: #0F3950; /* dark text on green buttons */
  --accent: #279ED5;     /* Light Blue — links/secondary accents */
  --danger: #e5484d;
  --ok: #CDDB3E;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand { font-family: "Rubik", "Open Sans", sans-serif; }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.brand span { color: var(--brand); }
.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: #f5a623; border-color: #f5a623; }

main { padding: 16px; max-width: 1000px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 820px) { .grid.two { grid-template-columns: 1.4fr 1fr; } }

.videos { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16/10; }
.videos video { width: 100%; height: 100%; background: #000; }
/* Remote (customer) feed: show the WHOLE frame, never crop — reps need to see all of it. */
.videos .remote { position: absolute; inset: 0; object-fit: contain; }
.videos .local {
  position: absolute; right: 12px; bottom: 12px;
  width: 22%; max-width: 170px; height: auto; aspect-ratio: 4/3;
  border: 2px solid rgba(255,255,255,.35); border-radius: 10px;
  object-fit: cover; z-index: 3;
}
.videos:fullscreen .local, .videos:-webkit-full-screen .local { max-width: 200px; }

/* Multi-party grid */
.videos .tiles { position: absolute; inset: 0; display: grid; gap: 6px; padding: 6px; grid-auto-rows: 1fr; grid-template-columns: 1fr; }
.videos .tile { position: relative; background: #0b1016; border-radius: 8px; overflow: hidden; min-height: 0; min-width: 0; }
.videos .tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.videos .tile.self video { object-fit: cover; }
.videos .tile-name { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; padding: 2px 7px; border-radius: 6px; z-index: 2; }
.videos .tile { cursor: pointer; }
/* Live mic meter — real audio level so both sides can see sound is getting through */
.videos .tile-mic { position: absolute; right: 6px; bottom: 6px; z-index: 3; display: flex; align-items: flex-end; gap: 2px; height: 18px; padding: 3px 5px; background: rgba(0,0,0,.5); border-radius: 6px; }
.videos .tile-mic i { display: block; width: 3px; background: rgba(255,255,255,.3); border-radius: 1px; transition: background .07s linear; }
.videos .tile-mic i:nth-child(1) { height: 25%; }
.videos .tile-mic i:nth-child(2) { height: 45%; }
.videos .tile-mic i:nth-child(3) { height: 70%; }
.videos .tile-mic i:nth-child(4) { height: 100%; }
.videos .tile-mic i.lit { background: var(--brand); }
.videos .tile-mic.muted { opacity: .6; }
.videos .tile-mic.muted::before { content: '🔇'; font-size: 11px; line-height: 1; }
.videos .tile-mic.muted i { display: none; }
.videos .tile.speaking { box-shadow: inset 0 0 0 2px var(--brand); }
/* Pinned mode: one dominant feed, the rest as a bottom filmstrip */
.videos .tiles.pinnedmode { display: flex; align-items: flex-end; gap: 8px; padding: 8px; grid-template-columns: none; }
.videos .tiles.pinnedmode .tile.big { position: absolute; inset: 0; }
.videos .tiles.pinnedmode .tile.thumb { position: relative; z-index: 4; width: 120px; height: 80px; flex: 0 0 auto; }
.videos .tile.big { box-shadow: inset 0 0 0 2px #CBDB29; }
.videos .tile-pin { position: absolute; top: 6px; right: 6px; z-index: 3; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; padding: 3px 8px; border-radius: 6px; opacity: .9; border: 1px solid rgba(255,255,255,.28); }
.videos .tile:hover .tile-pin { opacity: 1; background: rgba(0,0,0,.8); }
.videos .tile.big .tile-pin { background: #023246; border-color: #CBDB29; }
/* Fullscreen the customer feed */
#fsBtn {
  position: absolute; top: 10px; left: 10px; z-index: 6; font-size: 13px; padding: 8px 12px;
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3); color: #fff;
}
#fsBtn:hover { background: rgba(0,0,0,.75); }
.videos:fullscreen, .videos:-webkit-full-screen {
  aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0;
}
.videos:fullscreen .remote, .videos:-webkit-full-screen .remote { object-fit: contain; }
.videos .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; text-align: center; padding: 20px;
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card h2 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }

button {
  font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 11px 15px;
  background: var(--brand); color: var(--brand-text); cursor: pointer; /* green w/ dark text per brand */
}
button:hover { background: var(--brand-2); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--accent); }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }

input, textarea {
  font: inherit; width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px;
}
#camSelect, #bgSelect {
  font: inherit; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 9px 10px; max-width: 220px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23B0BEC5' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
#bgSelect option { background: var(--panel-2); color: var(--text); }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }
.link-box { display: flex; gap: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.banner { background: #12324a; border: 1px solid #1c4e73; color: #cfe6ff; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.recording { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); font-weight: 600; font-size: 13px; }
.recording .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 480px; padding: 20px; }
.modal h2 { margin: 0 0 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.seg button { flex: 1; background: transparent; border-radius: 0; color: var(--muted); }
.seg button.active { background: var(--brand); color: #fff; }
.hidden { display: none !important; }
.result-ok { color: var(--ok); font-weight: 600; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
