/* live-view.js: PREVIEW ONLY (DEVOPS-1065). Same palette as styles.css. */

#lv-open {
  margin-top: 6px; background: #21262d; color: #f85149; border: 1px solid #30363d; border-radius: 3px;
  padding: 3px 9px; font: 600 11px/1.4 'Courier New', monospace; letter-spacing: .05em; cursor: pointer;
}
#lv-open:hover { border-color: #f85149; }
#lv-open:focus-visible { outline: 2px solid #58a6ff; outline-offset: 2px; }

#live-view { position: fixed; inset: 0; z-index: 1600; display: flex; flex-direction: column; background: #0d1117; color: #c9d1d9; font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body.arcade-preview #live-view { top: 28px; }
#live-view[hidden] { display: none; }
#lv-head { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #161b22; border-bottom: 1px solid #30363d; }
#lv-title { font: 600 11px 'Courier New', monospace; letter-spacing: 2px; text-transform: uppercase; color: #f85149; }
#lv-status { flex: 1; font-size: 12px; }
#lv-status.lv-ok::before { content: "\25CF  "; color: #3fb950; }
#lv-status.lv-wait { color: #d29922; }
#lv-status.lv-bad { color: #f85149; }
#lv-head button { background: none; border: 1px solid #30363d; color: #8b949e; cursor: pointer; font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 3px; }
#lv-head button:hover { color: #c9d1d9; border-color: #58a6ff; }

#lv-body { flex: 1; position: relative; display: flex; min-height: 0; }
#lv-map { flex: 1; min-width: 0; background: #0d1117; }
#lv-list { width: 260px; flex-shrink: 0; overflow: auto; border-left: 1px solid #30363d; background: #0d1117; font-size: 12px; }
#lv-list .lv-meta { padding: 8px 10px; background: #161b22; border-bottom: 1px solid #30363d; color: #8b949e; }
#lv-list ul { list-style: none; margin: 0; padding: 0; }
#lv-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 5px 10px; border-bottom: 1px solid #21262d; cursor: pointer; font-variant-numeric: tabular-nums; }
#lv-list li:hover { background: rgba(88,166,255,.08); }
#lv-list li b { font-family: 'Courier New', monospace; }
#lv-list li span { color: #8b949e; }

#lv-form { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); z-index: 1000;
  background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 16px 18px; display: grid; gap: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.55); }
#lv-form[hidden] { display: none; }
#lv-form h2 { margin: 0; font-size: 15px; }
#lv-form p { margin: 0; color: #8b949e; }
#lv-form code { font-size: 12px; color: #c9d1d9; }
#lv-form label { font-size: 12px; font-weight: 600; }
#lv-form label span { font-weight: 400; color: #8b949e; }
#lv-form textarea, #lv-form input { width: 100%; box-sizing: border-box; background: #0d1117; border: 1px solid #30363d; color: #c9d1d9; border-radius: 4px; padding: 6px 8px; font: 12px ui-monospace, Menlo, monospace; }
#lv-form textarea:focus, #lv-form input:focus { outline: 2px solid #58a6ff; outline-offset: -1px; }
#lv-form-msg { color: #f85149; font-size: 12px; min-height: 1em; }
#lv-form .lv-actions { display: flex; justify-content: flex-end; }
#lv-connect { background: #238636; color: #fff; border: 0; border-radius: 4px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
#lv-form .lv-note { font-size: 11px; }

/* Offloads (sensor -> EUD -> upload), polled from arcade-api /live/uploads. */
#lv-list { width: 340px; }
#lv-list .lv-meta-up { top: 0; }
#lv-list .lv-meta b { color: #c9d1d9; }
ul.lv-uploads li { grid-template-columns: 1fr auto; cursor: default; }
ul.lv-uploads li em { grid-column: 1 / -1; font-style: normal; color: #8b949e; font-size: 11px; }
ul.lv-uploads li.lv-quiet b { color: #8b949e; }
ul.lv-uploads li.lv-fresh { background: rgba(63,185,80,.16); box-shadow: inset 3px 0 0 #3fb950; }
.lv-dim { color: #6e7681; }
.lv-none { color: #d29922; }

/* Rewind bar (DVR), PREVIEW ONLY (DEVOPS-1065): over the bottom of the live map. */
#lv-bar { position: absolute; left: 12px; right: calc(340px + 12px); bottom: 12px; z-index: 900; display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: rgba(22,27,34,.94); border: 1px solid #30363d; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
#lv-bar button { background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 3px; padding: 3px 8px; font: 12px/1.4 system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
#lv-bar button:hover { border-color: #58a6ff; }
#lv-bar button:focus-visible, #lv-scrub:focus-visible { outline: 2px solid #58a6ff; outline-offset: 1px; }
#lv-play { min-width: 34px; }
#lv-scrub { flex: 1; min-width: 80px; accent-color: #d29922; }
#lv-when { font: 12px ui-monospace, Menlo, monospace; color: #8b949e; white-space: nowrap; font-variant-numeric: tabular-nums; }
#lv-live { color: #f85149 !important; font-weight: 700 !important; letter-spacing: .04em; }
#lv-bar.lv-rewound { border-color: #d29922; }
#lv-bar.lv-rewound #lv-live { color: #8b949e !important; background: #2d2209; border-color: #d29922; }
#lv-bar.lv-rewound #lv-scrub { accent-color: #d29922; }
#lv-bar:not(.lv-rewound) #lv-scrub { accent-color: #f85149; }

/* Labels, PREVIEW ONLY (DEVOPS-1065). */
#lv-label { position: absolute; top: 24px; left: 24px; z-index: 1000; width: min(340px, calc(100% - 48px)); display: grid; gap: 6px;
  background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 14px 16px; box-shadow: 0 10px 34px rgba(0,0,0,.55); }
#lv-label[hidden] { display: none; }
#lv-label h2 { margin: 0; font-size: 14px; }
#lv-label .lv-lab-meta { font: 12px ui-monospace, Menlo, monospace; color: #e3b341; }
#lv-label label { font-size: 12px; font-weight: 600; margin-top: 2px; }
#lv-label select, #lv-label textarea { width: 100%; box-sizing: border-box; background: #0d1117; border: 1px solid #30363d; color: #c9d1d9; border-radius: 4px; padding: 5px 7px; font: 13px system-ui, sans-serif; }
#lv-label select:focus, #lv-label textarea:focus { outline: 2px solid #58a6ff; outline-offset: -1px; }
#lv-label .lv-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
#lv-lab-cancel { background: none; border: 1px solid #30363d; color: #8b949e; border-radius: 4px; padding: 5px 12px; cursor: pointer; font: inherit; }
#lv-lab-save { background: #238636; color: #fff; border: 0; border-radius: 4px; padding: 5px 12px; font: inherit; font-weight: 600; cursor: pointer; }
#lv-label .lv-note { margin: 0; font-size: 11px; color: #8b949e; }

ul.lv-labels li { grid-template-columns: auto 1fr auto; align-items: center; }
ul.lv-labels li em { grid-column: 1 / -1; font-style: normal; color: #8b949e; font-size: 11px; }
.lv-lab-tag { justify-self: start; padding: 0 6px; border-radius: 9px; font-size: 11px; border: 1px solid #58a6ff; color: #58a6ff !important; }
.lv-lab-tag.lv-lab-data_quality { border-color: #d29922; color: #d29922 !important; }
.lv-lab-del { background: none; border: 0; color: #6e7681; cursor: pointer; font-size: 14px; padding: 0 4px; }
.lv-lab-del:hover { color: #f85149; }
#lv-list .lv-meta a { color: #58a6ff; }

.lv-flag { pointer-events: none; }
.lv-flag span { display: inline-block; transform: translate(-50%, 0); white-space: nowrap; padding: 1px 6px; border-radius: 3px; font: 600 11px system-ui, sans-serif;
  background: rgba(31,111,235,.85); color: #fff; border: 1px solid #58a6ff; opacity: .55; }
.lv-flag.lv-flag-dq span { background: rgba(154,103,0,.85); border-color: #d29922; }
.lv-flag.lv-flag-now span { opacity: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }

#lv-scrubwrap { position: relative; flex: 1; min-width: 80px; display: flex; align-items: center; }
#lv-scrubwrap #lv-scrub { width: 100%; }
#lv-ticks { position: absolute; left: 8px; right: 8px; top: 0; bottom: 0; pointer-events: none; }
#lv-ticks i { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: #58a6ff; border-radius: 1px; }
#lv-ticks i.lv-tick-dq { background: #e3b341; }

/* Soldier names on the live map, PREVIEW ONLY (DEVOPS-1065). */
.leaflet-tooltip.lv-name { background: rgba(13,17,23,.82); color: #e6edf3; border: 1px solid #30363d; border-radius: 3px; box-shadow: none;
  padding: 1px 5px; font: 600 11px system-ui, -apple-system, "Segoe UI", sans-serif; white-space: nowrap; }
.leaflet-tooltip.lv-name::before { display: none; }
.lv-name-shots { margin-left: 4px; padding: 0 4px; border-radius: 6px; background: #f85149; color: #fff; font-size: 10px; }
.lv-lab-tag.lv-lab-other { border-color: #8b949e; color: #c9d1d9 !important; }
.lv-flag.lv-flag-other span { background: rgba(48,54,61,.9); border-color: #8b949e; }
#lv-ticks i.lv-tick-other { background: #c9d1d9; }

/* Calibration, PREVIEW ONLY (DEVOPS-1065): declination toggle, reference points, cone readouts. */
.lv-tools { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.lv-tools button { background: rgba(22,27,34,.94); color: #c9d1d9; border: 1px solid #30363d; border-radius: 4px; padding: 4px 9px;
  font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.lv-tools button:hover { border-color: #58a6ff; }
.lv-tools button:focus-visible { outline: 2px solid #58a6ff; outline-offset: 1px; }
.lv-tools #lv-decl[aria-pressed="false"] { border-color: #d29922; color: #e3b341; }
.lv-tools #lv-ref[aria-pressed="true"] { border-color: #e3b341; background: #2d2209; color: #e3b341; }
#lv-map.lv-dropping, #lv-map.lv-dropping .leaflet-interactive { cursor: crosshair !important; }

.lv-ref { background: none; border: 0; }
.lv-ref i { position: absolute; inset: 3px; border-radius: 50%; background: #0d1117; border: 2px solid #e3b341; }
.lv-ref i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #e3b341; }
.lv-ref span { position: absolute; left: 20px; top: 0; padding: 0 4px; border-radius: 3px; background: rgba(13,17,23,.85); color: #e3b341;
  font: 700 11px ui-monospace, Menlo, monospace; white-space: nowrap; }
.lv-ref:not(.lv-ref-on) { opacity: .55; }
.lv-ref.lv-ref-on i { box-shadow: 0 0 0 3px rgba(227,179,65,.35); }

.lv-read { pointer-events: none; }
.lv-read span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; padding: 1px 5px; border-radius: 3px;
  background: rgba(13,17,23,.82); border: 1px solid #30363d; color: #e6edf3; font: 600 11px/1.35 ui-monospace, Menlo, monospace; text-align: center;
  font-variant-numeric: tabular-nums; }
.lv-read em { font-style: normal; font-weight: 400; color: #8b949e; }
.lv-read.lv-read-shot span { border-color: #ff2020; }
.lv-good { color: #3fb950 !important; }
.lv-fair { color: #e3b341 !important; }
.lv-poor { color: #f85149 !important; }

ul.lv-cal li { grid-template-columns: 1fr auto auto; }
ul.lv-cal li em { grid-column: 1 / -1; font-style: normal; color: #8b949e; font-size: 11px; }
ul.lv-cal li.lv-quiet b { color: #8b949e; }
#lv-list .lv-meta a.lv-ref-sel { color: #e3b341; font-weight: 700; }

/* Asset status, PREVIEW ONLY (DEVOPS-1065): green tracked, grey quiet 10 s, red fired in 10 s. */
.lv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: #6e7681; }
.lv-st-tracked .lv-dot { background: #3fb950; }
.lv-st-fired .lv-dot { background: #f85149; box-shadow: 0 0 0 2px rgba(248,81,73,.35); }
ul.lv-live li.lv-st-untracked b { color: #8b949e; }
ul.lv-live li.lv-st-fired { background: rgba(248,81,73,.10); }
ul.lv-live li.lv-nopos { cursor: default; }

/* Precision mode, PREVIEW ONLY (DEVOPS-1065): shot strings by shooter and rifle. */
.lv-tools #lv-prec[aria-pressed="true"] { border-color: #58a6ff; background: #0c2d6b; color: #e6edf3; }
#lv-pr-ctl { border-bottom: 1px solid #30363d; }
#lv-pr-ctl .lv-meta { padding: 8px 10px; background: #161b22; border-bottom: 1px solid #30363d; color: #8b949e; }
#lv-pr-ctl .lv-meta b { color: #c9d1d9; }
#lv-pr-start { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; padding: 8px 10px; }
#lv-pr-start label { font-size: 11px; font-weight: 600; color: #8b949e; }
#lv-pr-start select, #lv-pr-start input { min-width: 0; box-sizing: border-box; width: 100%; background: #0d1117; border: 1px solid #30363d; color: #c9d1d9; border-radius: 4px; padding: 4px 6px; font: 12px system-ui, sans-serif; }
#lv-pr-start select:focus, #lv-pr-start input:focus { outline: 2px solid #58a6ff; outline-offset: -1px; }
#lv-pr-go { grid-column: 1 / -1; background: #238636; color: #fff; border: 0; border-radius: 4px; padding: 5px 10px; font: 600 12px system-ui, sans-serif; cursor: pointer; }
#lv-pr-go:focus-visible { outline: 2px solid #58a6ff; outline-offset: 1px; }
.lv-pr-dist { display: flex; align-items: center; gap: 4px; color: #8b949e; font-size: 12px; }
.lv-pr-plot { display: block; width: 100%; height: auto; border-bottom: 1px solid #21262d; }
.lv-pr-sum { padding: 6px 10px; border-bottom: 1px solid #21262d; font-size: 11px; color: #8b949e; display: grid; gap: 2px; }
.lv-pr-sum b { color: #c9d1d9; }
ul.lv-pr li { grid-template-columns: 1fr auto auto; }
ul.lv-pr li em { grid-column: 1 / -1; font-style: normal; color: #8b949e; font-size: 11px; line-height: 1.5; }
ul.lv-pr li.lv-pr-on { background: rgba(88,166,255,.07); }
ul.lv-pr li:not(.lv-pr-on) .lv-sw { opacity: .35; }
.lv-sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.lv-lab-tag.lv-lab-precision { border-color: #a371f7; color: #d2a8ff !important; }
.lv-flag.lv-flag-pr span { background: rgba(110,64,201,.88); border-color: #a371f7; }
#lv-ticks i.lv-tick-pr { background: #a371f7; }

/* Choosing soldiers for a reference point, PREVIEW ONLY (DEVOPS-1065). */
#lv-map.lv-picking, #lv-map.lv-picking .leaflet-interactive { cursor: copy !important; }
.lv-ref.lv-ref-picking i { animation: lv-pick 1s ease-in-out infinite; }
.lv-ref.lv-ref-picking span { background: #2d2209; border: 1px solid #e3b341; }
@keyframes lv-pick { 50% { box-shadow: 0 0 0 7px rgba(227,179,65,.25); } }
@media (prefers-reduced-motion: reduce) { .lv-ref.lv-ref-picking i { animation: none; box-shadow: 0 0 0 4px rgba(227,179,65,.4); } }

/* Reference point right-click menu, PREVIEW ONLY (DEVOPS-1065). */
.lv-refpop .leaflet-popup-content-wrapper { background: #161b22; color: #c9d1d9; border: 1px solid #30363d; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 0; }
.lv-refpop .leaflet-popup-tip { background: #161b22; border: 1px solid #30363d; }
.lv-refpop .leaflet-popup-content { margin: 6px; }
.lv-refmenu { display: grid; gap: 4px; min-width: 150px; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
.lv-refmenu b { color: #e3b341; font: 700 11px ui-monospace, Menlo, monospace; padding: 2px 4px; }
.lv-refmenu button { text-align: left; background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 4px; padding: 5px 8px; font: inherit; cursor: pointer; }
.lv-refmenu button:hover, .lv-refmenu button:focus-visible { border-color: #58a6ff; outline: none; }
.lv-refmenu button.lv-danger { color: #ff7b72; }
.lv-refmenu button.lv-danger:hover, .lv-refmenu button.lv-danger:focus-visible { border-color: #f85149; }
