/* ============================================================
   Kancha Go -- Watch Live: browse in-progress online matches and watch one
   read-only. A lean first version (see docs/ASSETS.md / the social-features
   plan) -- CSS only, no new art, matches the Solo Challenge screen's look.
   ============================================================ */

#live {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding-bottom: 16px;
  color: #fff;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    linear-gradient(rgba(9, 16, 34, 0.8), rgba(5, 10, 24, 0.95)),
    url("assets/home-bg.jpg") center top / cover no-repeat,
    #071634;
}
.live__top {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
  padding: max(12px, var(--safe-area-inset-top, env(safe-area-inset-top))) 14px 6px;
}
.live__title {
  position: relative;
  flex: 1;
  margin: 0;
  text-align: center;
  padding: 8px 18px;
  font-size: 22px;
  font-weight: 700;
  color: #ffe8e4;
  background: linear-gradient(180deg, #ff5b4d, #d81e1e);
  border: 2px solid #7a0f0f;
  border-radius: 999px;
  -webkit-text-stroke: 1px #6e0a0a;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #6e0a0a;
  box-shadow: inset 0 2px 0 rgba(255, 214, 160, 0.4), inset 0 -3px 6px rgba(0, 0, 0, 0.3), 0 4px 0 #5a0c0c, 0 6px 10px rgba(0, 0, 0, 0.4);
}
.live__refresh {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, #3a3126, #1c1712);
  border: 1px solid rgba(255, 214, 140, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.live__refresh:active { transform: scale(0.94); }

.live-rows {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 432px;
  margin: 10px auto 0;
  padding: 0 14px;
}
.live-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #24304a, #131b2e);
  border: 2px solid #3a4a70;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 4px 8px rgba(0, 0, 0, 0.4);
}
.live-row__info { flex: 1; min-width: 0; }
.live-row__names {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-row__names b { font-weight: 800; }
.live-row__name--blue { color: #7ab8ff; }
.live-row__name--green { color: #7de6a2; }
.live-row__set { font-size: 12px; color: var(--muted, #9ab0cf); font-weight: 600; margin-top: 1px; }
.live-row__marbles { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 700; margin-top: 2px; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.live-dot--blue { background: #3a8bff; box-shadow: 0 0 4px #3a8bff; }
.live-dot--green { background: #3fc26b; box-shadow: 0 0 4px #3fc26b; }
.live-row__watchers { font-size: 12px; color: var(--muted, #9ab0cf); flex: none; }
.live-row__watch {
  flex: none;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #4a2a05;
  background: linear-gradient(180deg, #ffe382, #f2a11c);
  border: 2px solid #fff2c0;
  border-radius: 999px;
  box-shadow: 0 3px 0 #a86a0a;
  cursor: pointer;
}
.live-row__watch:active { transform: translateY(2px); box-shadow: none; }
.live-empty {
  max-width: 380px;
  margin: 40px auto 0;
  padding: 0 20px;
  text-align: center;
  color: var(--muted, #9ab0cf);
  font-size: 15px;
  line-height: 1.5;
}

/* ---- the scoreboard above the watched board is the REAL match screen's
   #matchbar/.pcard/.setbox/.lead (styles.css), just fed "blue"/"green"
   instead of "you"/"opponent" -- so Watch Live reads exactly like the game
   you'd be playing, not a separate, simpler view. Those rules size
   themselves off --cu/--app-w, which styles.css only defines on #app, so
   this section defines the same formula for its own copy of the component. */
.live-matchbar {
  --app-w: min(100vw - 24px, 460px);
  --cu: calc((var(--app-w) - 16px) / 292);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr) minmax(0, 1fr);
  gap: 8px;
  max-width: 460px;
  margin: 8px auto 0;
  padding: 0 10px;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* no accounts behind a spectated match -- a marble icon stands in for the
   usual person avatar, sized to fit inside the same frame rather than
   cropped by it (that frame/border/shadow all come free from .pcard__avatar) */
#live .pcard__avatar { background-size: 68% auto; }
#live .pcard--blue .pcard__avatar { background-image: url("assets/marble-blue.png"); }
#live .pcard--green .pcard__avatar { background-image: url("assets/marble-green.png"); }
.live-status {
  max-width: 432px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 13px;
  color: var(--gold, #ffcf3f);
  font-weight: 700;
}
.live-stage {
  width: min(92vw, 400px);
  aspect-ratio: 0.9 / 1.05;
  margin: 10px auto 0;
}
.live-stage canvas { display: block; width: 100%; height: 100%; }
.live-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}
#live-watchers { font-size: 12px; color: var(--muted, #9ab0cf); }
.live-watch__back {
  padding: 9px 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted, #9ab0cf);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}
