/* RR Tournament Live View: the grid, the player and the vMix panel. Uses the tool's theme variables (app.css, or base.css
   on the hub's own page). Everything is under .lv so it can sit inside the tool's window. */

.lv { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lv .lv-offscreen, .lv-offscreen { position: fixed; left: -9999px; top: 0; }

.lv-login { max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.lv-login h2 { margin-bottom: 0; }
.lv-msg { color: var(--err); font-size: 14px; min-height: 0; }
.lv-msg:empty { display: none; }

.lv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.lv-bar-left, .lv-bar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lv-count { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lv-user { color: var(--text-3); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* ---- the grid: one tile per streamer, like the Wii menu ---- */
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lv-empty { grid-column: 1 / -1; padding: 24px 0; }
.lv-tile { position: relative; min-width: 0; }
.lv-open {
  display: flex; flex-direction: column; width: 100%; padding: 0; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; color: var(--text);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.lv-tile.is-live .lv-open:hover, .lv-tile.has-rec .lv-open:hover { border-color: var(--accent-2-line); transform: translateY(-2px); box-shadow: 0 12px 28px -18px rgba(76, 201, 240, 0.8); }
.lv-open:disabled { cursor: default; }
.lv-screen { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--inset); }
.lv-snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; }
.lv-snap.is-shown { opacity: 1; }
.lv-offline { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; font-weight: 600; }
.lv-tile.is-live .lv-offline { display: none; }
.lv-tile-foot { display: flex; align-items: center; gap: 8px; padding: 9px 12px; min-width: 0; }
.lv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.lv-tile.is-live .lv-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.lv-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lv-cam { color: var(--accent-2); display: inline-flex; }
.lv-rate { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.lv-pick {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border-radius: 10px; border: 1px solid var(--border-strong); background: rgba(10, 15, 28, 0.78); color: var(--text);
}
.lv-pick:hover { border-color: var(--accent-2-line); }
.lv-pick[aria-pressed="true"] { background: var(--accent-2); border-color: var(--accent-2); color: #04212b; }

/* ---- the player ---- */
.lv-viewer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; }
.lv-viewer-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.lv-viewer-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.lv-sync { margin-left: auto; font-size: 13px; }
.lv-wall { display: grid; gap: 10px; grid-template-columns: repeat(var(--lv-cols, 1), minmax(0, 1fr)); }
.lv-viewer:not(.lv-n1):not(.lv-n2):not(.lv-n3):not(.lv-n4) .lv-feed figcaption { padding-top: 6px; font-size: 13px; }
.lv-hint { font-size: 13px; color: var(--warn); margin-top: -6px; }
.lv-feed { margin: 0; min-width: 0; }
.lv-stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.lv-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.lv-camvideo {
  position: absolute; right: 2.5%; bottom: 4%; width: 26%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.85); background: #000; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}
.lv-feed figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 2px 0; }
.lv-feed-err { color: var(--warn); font-size: 13px; }
.lv-feed-err:empty { display: none; }
.lv-feed-actions { margin-left: auto; display: flex; gap: 8px; }
.lv-sound.is-on { border-color: var(--accent-2); color: var(--accent-2); }
.lv-stage-note {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center;
  color: var(--text-2); font-size: 14px; font-weight: 600; background: rgba(4, 8, 18, 0.72);
}
.lv-stage-note[hidden] { display: none; }
.lv-camvideo[hidden] { display: none; }

/* ---- the timeline, like a live stream on YouTube: play / pause, 10 s back and forward, the bar, the time, LIVE ---- */
.lv-viewer:focus { outline: none; }
.lv-ctl { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.lv-ctl-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lv-ctl .btn { flex: none; }
.lv-back, .lv-fwd { gap: 2px; padding-left: 8px; padding-right: 8px; font-variant-numeric: tabular-nums; }
.lv-tl { position: relative; flex: 1 1 auto; min-width: 120px; height: 28px; cursor: pointer; touch-action: none; margin: 0 6px; }
.lv-tl:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.lv-tl-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--inset); overflow: hidden; }
.lv-tl:hover .lv-tl-track { height: 8px; margin-top: -4px; border-radius: 4px; }
.lv-tl-spans { position: absolute; inset: 0; }
.lv-tl-span { position: absolute; top: 0; bottom: 0; background: var(--border-strong); }
.lv-tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--err); opacity: 0.9; }
.lv-tl-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--err); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35); pointer-events: none;
}
.lv-tl-tip {
  position: absolute; bottom: calc(100% + 4px); transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--surface-2, #111a2e); border: 1px solid var(--border-strong); color: var(--text); font-size: 12px; pointer-events: none;
}
.lv-tl-tip[hidden] { display: none; }
.lv-time { flex: none; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.lv-live { gap: 7px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-2); }
.lv-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.lv-live.is-on { color: var(--text); cursor: default; }
.lv-live.is-on .lv-live-dot { background: var(--err); box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.25); }
.lv-tl-labels { display: flex; justify-content: space-between; font-size: 12px; padding: 0 0 0 calc(3 * 40px); }
.lv-ctl.is-live .lv-tl-labels span:last-child { color: var(--err); font-weight: 600; }
.lv-copied { border-color: var(--ok) !important; color: var(--ok) !important; }

/* ---- vMix ---- */
.lv-vmix-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.lv-vmix-head p { margin-top: 4px; max-width: 80ch; font-size: 14px; }
.lv-hostline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.lv-hostline code { font-size: 14px; }
.lv-hostline .label:not(:first-child) { margin-left: 10px; }
.lv-table-wrap { overflow-x: auto; }
.lv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lv-table th, .lv-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.lv-table thead th { color: var(--text-3); font-size: 12px; font-weight: 600; }
.lv-addr { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.lv-lat { font-weight: 700; }
.lv-note { margin-top: 10px; font-size: 13px; }

.lv-results { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.lv-results h3 { font-size: 16px; font-weight: 700; margin: 0; }
.lv-results p { font-size: 14px; max-width: 90ch; }
.lv-results-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.lv-room { width: auto; min-width: 260px; max-width: 100%; min-height: 32px; font-size: 13px; }
.lv-from { width: 90px; min-height: 32px; font-size: 13px; }
.lv-urls { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; }
.lv-url { display: contents; }
.lv-url-label { font-size: 13px; color: var(--text-2); }
.lv-url .lv-addr { overflow-wrap: anywhere; white-space: normal; }

/* ---- the hub's own page before logging in, and Manage (admins) ---- */
.lv-landing { max-width: 560px; display: flex; flex-direction: column; gap: 12px; }
.lv-landing h2 { margin: 0; }
.lv-manage-body { display: flex; flex-direction: column; gap: 22px; }
.lv-manage-sec { display: flex; flex-direction: column; gap: 10px; }
.lv-manage-sec + .lv-manage-sec { padding-top: 18px; border-top: 1px solid var(--border); }
.lv-manage-sec h3 { font-size: 16px; font-weight: 700; margin: 0; }
.lv-manage-sec > p { font-size: 14px; max-width: 90ch; }
.lv-code { font-size: 15px; font-weight: 700; color: var(--text); }
.lv-closed { color: var(--warn); font-weight: 600; }
.lv-live-text { color: var(--ok); font-weight: 600; }
.lv-row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.lv-players td, .lv-players th { white-space: normal; }
.lv-logins { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lv-logins li { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.lv-login-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.modal .lv-hostline { margin-bottom: 0; }

@media (max-width: 700px) {
  .lv-urls { grid-template-columns: minmax(0, 1fr) auto; }
  .lv-url-label { grid-column: 1 / -1; margin-top: 6px; }
  .lv-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lv-n1 .lv-wall { grid-template-columns: 1fr; }
  .lv-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .lv-feed-actions { margin-left: 0; }
  .lv-ctl-row { flex-wrap: wrap; }
  .lv-tl { order: -1; flex-basis: 100%; margin: 0 0 4px; }
  .lv-tl-labels { padding-left: 0; }
}
