/* 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, .lv-mic { color: var(--accent-2); display: inline-flex; }
.lv-cam[hidden], .lv-mic[hidden] { display: none; }
/* an ended stream: its last picture, dimmed, under "Not live · watch earlier" */
.lv-tile.has-rec .lv-offline { background: rgba(4, 8, 18, 0.62); color: var(--text-2); }
.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 { position: relative; display: grid; gap: 10px; grid-template-columns: repeat(var(--lv-cols, 1), minmax(0, 1fr)); }
/* V3.4: dragging a picture to another place (the others slide; it snaps in when let go) */
.lv-viewer:not(.lv-n1) .lv-feed { cursor: grab; touch-action: none; }
.lv-feed.is-dragging { position: relative; z-index: 5; cursor: grabbing; opacity: 0.92; }
.lv-feed.is-dragging .lv-stage { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--accent-2); }
.lv-wall.is-sorting { user-select: none; }
.lv-wall.is-sorting .lv-feed:not(.is-dragging) .lv-stage { outline: 1px dashed var(--border-strong); outline-offset: 2px; }
.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; }
/* V3.3: the game's sound and the microphone, two small buttons on the picture's corner */
.lv-snds { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
.lv-snd {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 50%; cursor: pointer;
  background: rgba(10, 15, 28, 0.72); border: 1px solid rgba(255, 255, 255, 0.28); color: rgba(255, 255, 255, 0.78);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.lv-snd .icon { width: 17px; height: 17px; }
.lv-snd:hover:not(:disabled) { background: rgba(10, 15, 28, 0.92); color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.lv-snd:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.lv-snd.is-on { background: var(--accent-2); border-color: var(--accent-2); color: #04121c; }
.lv-snd:disabled { opacity: 0.4; cursor: default; }
.lv-snd[hidden] { display: none; }
/* V3.4: a small vertical volume slider beneath each sound button, while the pointer is on it */
.lv-snd-wrap { position: relative; display: flex; }
.lv-snd-wrap:has(> .lv-snd[hidden]) { display: none; }
.lv-vol { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 6px; display: none; z-index: 3; }
.lv-snd-wrap:hover .lv-vol, .lv-snd-wrap:has(:focus-visible) .lv-vol { display: block; } /* (a click leaves the focus on the button: only the keyboard keeps it open) */
.lv-vol-box {
  position: relative; width: 30px; height: 104px; border-radius: 15px;
  background: rgba(10, 15, 28, 0.9); border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
/* A normal (horizontal) slider turned upright: the same in every browser, and its own look (the tool's window styles every
   slider of its own pages; these selectors are more specific than that). */
.lv-snd-wrap input.lv-vol-range[type="range"] {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 22px; margin: 0; padding: 0;
  transform: translate(-50%, -50%) rotate(-90deg); writing-mode: horizontal-tb; direction: ltr;
  -webkit-appearance: none; appearance: none; background: transparent; border: 0; cursor: pointer;
}
.lv-snd-wrap input.lv-vol-range[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; border: 0;
  background: linear-gradient(to right, var(--accent-2) var(--v, 100%), rgba(255, 255, 255, 0.25) var(--v, 100%));
}
.lv-snd-wrap input.lv-vol-range[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -4px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent-2); box-shadow: none;
}
.lv-snd-wrap input.lv-vol-range[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.lv-snd-wrap input.lv-vol-range[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent-2); }
.lv-snd-wrap input.lv-vol-range[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent-2); }
.lv-snd-wrap input.lv-vol-range[type="range"]:focus { outline: none; }
.lv-snd-wrap input.lv-vol-range[type="range"]:focus-visible { outline: none; }
.lv-snd-wrap:has(.lv-vol-range:focus-visible) .lv-vol-box { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.lv-viewer:not(.lv-n1):not(.lv-n2):not(.lv-n3):not(.lv-n4) .lv-vol-box { height: 64px; width: 26px; }
.lv-viewer:not(.lv-n1):not(.lv-n2):not(.lv-n3):not(.lv-n4) .lv-snd-wrap input.lv-vol-range[type="range"] { width: 48px; }
.lv-viewer:not(.lv-n1):not(.lv-n2):not(.lv-n3):not(.lv-n4) .lv-snd { width: 28px; height: 28px; }
.lv-allsnds { display: inline-flex; gap: 2px; }
.lv-allsnds .btn.is-on { color: var(--accent-2); background: var(--accent-2-tint, rgba(56, 189, 248, 0.14)); }
.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 player sends only the microphone: a badge where the cam would be */
.lv-mic-badge {
  position: absolute; right: 2.5%; bottom: 4%; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: rgba(10, 15, 28, 0.8); border: 1px solid rgba(255, 255, 255, 0.5); color: #fff; font-size: 13px; font-weight: 600;
}
.lv-mic-badge[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; align-items: center; gap: 8px; font-size: 12px; padding: 0 0 0 calc(3 * 40px); }
/* V3.4 (admins): how much of the timeline is shown */
.lv-tl-zoom { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; }
.lv-zoom-btn { font: inherit; font-size: 12px; line-height: 1; padding: 4px 9px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); cursor: pointer; }
.lv-zoom-btn:hover { color: var(--text); }
.lv-zoom-btn.is-on { background: var(--accent-2); color: #04121c; font-weight: 600; }
.lv-zoom-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
/* V3.4: the programme in the vMix panel */
.lv-prog { margin: 14px 0 6px; padding: 12px 0 4px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.lv-prog h3 { font-size: 16px; font-weight: 700; margin: 0; }
.lv-prog p { font-size: 14px; max-width: 90ch; margin: 0; }
.lv-prog .lv-addr { overflow-wrap: anywhere; white-space: normal; }
.lv-prog-in { font-weight: 600; }
.lv-prog-outs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.lv-prog-out { display: flex; gap: 10px; align-items: baseline; }
.lv-prog-out .label { min-width: 140px; color: var(--text-3); }
.lv-prog-ok span:last-child { color: var(--ok); }
.lv-prog-bad span:last-child { color: var(--warn); }
.lv-prog-off span:last-child { color: var(--text-3); }
/* V3.4: Watch a room */
.lv-rooms { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; }
.lv-rooms[hidden] { display: none; }
.lv-rooms-label { font-size: 13px; color: var(--text-3); font-weight: 600; }
.lv-sortplace.is-on { color: var(--accent-2); background: var(--accent-2-tint, rgba(56, 189, 248, 0.14)); }
.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-vsync { font-weight: 600; }
.lv-vsync-ok { color: var(--ok); }
.lv-vsync-off { color: var(--warn); }
.lv-vsync-wait { color: var(--text-3); }
.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; }
.lv-results-sub { font-size: 14px; font-weight: 700; margin: 6px 0 0; }
.lv-why { width: 260px; max-width: 100%; min-height: 32px; font-size: 13px; }
.lv-standings { max-width: 640px; }
.lv-standings td, .lv-standings th { padding: 5px 10px; }
.lv-corrections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.lv-cor { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lv-cor-undone span { text-decoration: line-through; color: var(--text-3); }
.lv-results-msg:empty { display: none; }

/* ---- 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; }
}
