/* Live (js/live.js): the Game Owner's messages to everyone as a banner, the Live box in Settings > Admin
   (js/ui/settings.js) and the goal event tickets in Rewards (js/ui/rewards.js). Class prefixes: lv- the
   banner, st-live- and st-goal- the Live box, rw-ev- the tickets. */

/* ---------------------------------------------------------------- the banner */

/* Above the HUD and the menus (#panels is 20), under the toasts (30), and never in the way of a tap. On a
   computer or tablet it hangs under the score box, clear of the health bar, ammo and crosshair. */
.lv-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 108px);
  left: 50%;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 22px 12px 12px;
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  font-family: var(--ui);
  box-shadow: 0 0 0 4px var(--ink), 0 7px 0 4px var(--ink), 0 16px 34px rgba(8, 20, 48, 0.35);
  opacity: 0;
  transform: translate(-50%, -14px) scale(0.92);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
  pointer-events: none;
}
.lv-banner.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.lv-banner.is-out { opacity: 0; transform: translate(-50%, -10px) scale(0.96); }
.lv-ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  background: linear-gradient(160deg, #ffd23f, #ff9d1f);
  color: var(--ink);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}
.lv-banner.is-on .lv-ico { animation: lv-shout 0.9s ease-in-out 0.25s 3; }
.lv-ico svg { width: 32px; height: 32px; }
.lv-body { display: grid; gap: 2px; min-width: 0; }
.lv-who { color: #7c3aed; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
/* Three lines at most, so a long message can't grow over the crosshair. */
.lv-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
@keyframes lv-shout {
  30% { transform: rotate(-12deg) scale(1.12); }
  60% { transform: rotate(6deg); }
}

/* Phones on their side: between the crosshair and the weapon slots (the picked one stands 66 px up),
   clear of the stick and of the thumb buttons (from 160 px in on the right). A long message (is-long,
   over 60 characters) gets smaller letters and a third line. */
@media (max-height: 520px) {
  .lv-banner {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom) + 74px);
    max-width: min(440px, calc(100vw - 330px));
    gap: 8px;
    padding: 7px 12px 7px 7px;
    border-radius: 18px;
  }
  .lv-ico { width: 36px; height: 36px; border-radius: 12px; }
  .lv-ico svg { width: 23px; height: 23px; }
  .lv-who { font-size: 11px; }
  .lv-text { font-size: 16px; -webkit-line-clamp: 2; }
  .lv-banner.is-long .lv-text { font-size: 14px; -webkit-line-clamp: 3; }
}
/* Upright phones: below the health bar and the ammo, above the crosshair. */
@media (max-width: 520px) and (min-height: 521px) {
  .lv-banner { top: max(214px, 33%); max-width: calc(100vw - 24px); gap: 10px; padding: 8px 12px 8px 8px; }
  .lv-ico { width: 38px; height: 38px; border-radius: 13px; }
  .lv-ico svg { width: 24px; height: 24px; }
  .lv-who { font-size: 11px; }
  .lv-text { font-size: 16px; }
  .lv-banner.is-long .lv-text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .lv-banner { transition: opacity 0.2s ease; }
  .lv-banner.is-on .lv-ico { animation: none; }
}

/* ---------------------------------------------------------------- the Live box (Settings > Admin) */

.st-live { display: grid; gap: 10px; margin-top: 6px; }
.st-live > .st-note { grid-column: auto; margin: -8px 0 0; }
.st-live .st-goal { margin-top: 0; }
.st-live-card { padding: 14px; border-radius: 16px; background: var(--paper-2); box-shadow: inset 0 0 0 2px #e1e8f2; }
.st-live-card .st-note { grid-column: auto; margin: 0 0 10px; }
.st-live-h { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 19px; }
.st-live-h .m-ico { color: var(--orange); }
.st-live-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.st-live-row .st-input { flex: 1 1 220px; background: #fff; }
.st-live-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 8px; }
.st-live-count { flex: none; color: var(--muted); font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.st-live-status { flex: 1; min-width: 150px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 900; }
.st-live-status.is-good { color: var(--green-dark); }
.st-live-status.is-bad { color: var(--red-dark); }
.st-live-offline { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff3c4; color: #8a6400; font-size: 13.5px; font-weight: 800; box-shadow: inset 0 0 0 2px #ffd95e; }
/* The goal events on now, one row each, with the source, the time left and End it. */
.st-live .st-goal-now { display: grid; gap: 8px; padding: 0; background: none; box-shadow: none; }
.st-goal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; border-radius: 14px; background: #fff3c4; box-shadow: inset 0 0 0 2px #ffd95e; font-weight: 800; }
.st-goal-row .st-goal-now-text { flex: 1; min-width: 120px; font-variant-numeric: tabular-nums; }
.st-goal-row small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 800; }
.st-goal-endall { justify-self: end; }
@media (max-width: 760px) {
  .st-live-card { padding: 12px 10px; }
  .st-live-row > .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- goal event tickets (Rewards) */

.rw-ev-goals { display: flex; align-items: center; gap: 10px; }
.rw-ev-goals .pbar { flex: 1; height: 14px; }
.rw-ev-count { flex: none; color: var(--ink); font-size: 14px; font-weight: 900; }
.rw-ev-goal .rw-ev-when { font-variant-numeric: tabular-nums; }
