/* 1ball.rw — watch page (loads after base.css) */

.watch { padding-block: 18px 28px; }

/* One width token keeps title, player and sources perfectly aligned.
   Capped by viewport height so the player never runs past the fold. */
.stream-container {
  --player-w: min(100%, 1040px, calc((100dvh - 330px) * 16 / 9));
  display: flex;
  flex-direction: column;
  align-items: center;
}
@media (max-width: 900px) and (orientation: landscape) {
  .stream-container { --player-w: min(100%, calc((100dvh - 90px) * 16 / 9)); }
}
@media (max-width: 760px) and (orientation: portrait) {
  .stream-container { --player-w: 100%; }
}

/* ── Server buttons bar (above iframe) ──────────── */
.server-bar {
  width: var(--player-w);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.server-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 700 .8125rem var(--font-body);
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.server-btn:hover { border-color: var(--accent); }
.server-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.srv-hd-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 .625rem var(--font-body);
}
.srv-sd-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font: 700 .625rem var(--font-body);
}

/* ── PC / Desktop view only: larger server buttons ── */
@media (min-width: 769px) {
  .server-bar {
    gap: 10px;
    margin: 0 0 12px;
  }
  .server-btn {
    min-height: 38px;
    padding: 7px 16px;
    font-size: .875rem;
    gap: 8px;
  }
  .srv-hd-badge {
    padding: 2px 8px;
    font-size: .6875rem;
  }
}

/* ── Mobile view: 3-column compact grid ── */
@media (max-width: 640px) {
  .server-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
  }
  .server-btn {
    padding: 5px 8px;
    font-size: .75rem;
    justify-content: center;
  }
}

.iframe-container {
  width: var(--player-w);
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #000;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
iframe { display: block; width: 100%; height: 100%; border: none; }

.iframe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  z-index: 40;
}
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .22);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 3s linear infinite !important; } }

/* ── Below-iframe info bar: team names + viewers ── */
.stream-meta {
  width: var(--player-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
}
.stream-title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1.1;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.viewers-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: .8125rem;
  white-space: nowrap;
}
.viewers-text::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent);
}

.stream-issue-notice {
  width: var(--player-w);
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.stream-issue-notice a { color: var(--accent); font-weight: 700; text-decoration: none; }
.stream-issue-notice a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .stream-meta { gap: 8px; margin-top: 8px; }
  .stream-title { font-size: 1rem; letter-spacing: -.02em; }
  .viewers-text { padding: 4px 10px; font-size: .75rem; }
  .stream-issue-notice { margin-top: 8px; padding: 8px 12px; font-size: .8125rem; border-radius: 12px; line-height: 1.45; }
}

/* ── Related Matches ──────────────────────────── */
.related-matches {
  width: var(--player-w);
  margin-top: 26px;
}
.related-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  letter-spacing: -.03em;
}
.related-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--c, var(--accent));
}
.related-matches .match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 10px;
}
.related-matches .match {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, transform .15s;
}
@media (hover: hover) { .related-matches .match:hover { border-color: var(--c, var(--accent)); } }
.related-matches .match:active { transform: scale(.99); border-color: var(--line); }

.related-matches .match-time {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c, var(--accent)) 13%, var(--surface));
  color: var(--ink);
  font: 700 .9375rem var(--font-display);
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.related-matches .teams { display: grid; gap: 5px; min-width: 0; }
.related-matches .team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  font-size: .875rem;
  line-height: 1.25;
}
.related-matches .team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-matches .team-badge, .related-matches .national-flag {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
}
.related-matches .national-flag { border-radius: 3px; }
.related-matches .team-spacer { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; font-size: 14px; }
.related-matches .f1-icon { width: 22px; height: 22px; object-fit: contain; }
@media (prefers-color-scheme: dark) { .related-matches .f1-icon { filter: invert(1); } }
.related-matches .fight-icon { width: 22px; height: 22px; flex: 0 0 22px; object-fit: contain; }
.related-matches .team.team-single { align-items: center; }
.related-matches .team.is-away { color: var(--muted); font-weight: 500; }

@media (max-width: 640px) {
  .related-matches { margin-top: 18px; }
  .related-title { font-size: 1.0625rem; margin-bottom: 10px; }
  .related-matches .match-grid { gap: 8px; }
  .related-matches .match { grid-template-columns: 50px minmax(0, 1fr); gap: 10px; padding: 8px 10px 8px 8px; min-height: 56px; border-radius: 12px; }
  .related-matches .match-time { height: 34px; font-size: .8125rem; border-radius: 8px; }
}
