/* PadelCounter live channel: padelcounter.com/live/<name> */
*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #0c0e13;
  --surface: #14171e;
  --surface-2: #1b1f28;
  --surface-3: #242935;
  --surface-4: #2e3442;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #eef1f6;
  --muted: #a1a9b8;
  --dim: #6c7486;
  --lime: #c2f43a;
  --lime-2: #a3e01b;
  --lime-ink: #0d1a33;
  --lime-soft: rgba(194, 244, 58, 0.12);
  --live: #ff2e4c;
  --live-soft: rgba(255, 46, 76, 0.16);
  --gold: #b99255;
  --gold-ink: #17130e;
  --youtube: #ff0033;
  --twitch: #a970ff;
  --radius: 10px;
  --topbar: 54px;
  --chat-w: 352px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-num: "Barlow Condensed", "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
a { color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 20;
  height: var(--topbar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(16, 19, 25, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.brand-live {
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em;
  color: var(--lime-ink); background: var(--lime);
  padding: 2px 6px; border-radius: 4px;
}
.topbar-spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 0; border-radius: 8px;
  background: var(--surface-3); color: var(--text);
  font-weight: 650; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .12s var(--ease), color .15s;
}
.btn:hover { background: var(--surface-4); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .chat-tab:focus-visible, .sound:focus-visible, .reaction:focus-visible, .tabs button:focus-visible {
  outline: 2px solid var(--lime); outline-offset: 2px;
}
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-lime { background: var(--lime); color: var(--lime-ink); }
.btn-lime:hover { background: #d0ff52; }
.btn-icon { width: 36px; padding: 0; }
.btn-bell { background: var(--lime); color: var(--lime-ink); }
.btn-bell:hover { background: #d0ff52; }
.btn-bell[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.btn-bell[aria-pressed="true"] .i-bell { color: var(--lime); fill: var(--lime); stroke: var(--lime); }
.btn-bell.ring .i-bell { animation: ring .9s var(--ease); transform-origin: 50% 10%; }
@keyframes ring { 0%,100% { transform: rotate(0) } 15% { transform: rotate(18deg) } 30% { transform: rotate(-16deg) } 45% { transform: rotate(12deg) } 60% { transform: rotate(-8deg) } 75% { transform: rotate(4deg) } }
.link-btn { background: none; border: 0; padding: 0; color: var(--lime); font-weight: 650; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-w);
  height: calc(100dvh - var(--topbar));
}
.stage { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }

/* ---------- Player ---------- */
.player-shell { position: relative; background: #000; }
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - var(--topbar) - 118px);
  margin: 0 auto;
  background: #000;
  overflow: hidden;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-skeleton { position: absolute; inset: 0; background: linear-gradient(110deg, #0f1217 30%, #171b23 50%, #0f1217 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Demo still (design previews only) */
.demo-video { position: absolute; inset: 0; background: #0b1020 url('/resources/site/img/film-court.webp') center 60% / cover no-repeat; }
.demo-video::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), transparent 30%, transparent 70%, rgba(0,0,0,.35)); }
.demo-overlay { direction: ltr; position: absolute; left: 3%; top: 5%; width: min(440px, 42%); z-index: 1; font-family: var(--font-num); }
.demo-overlay .sb { background: #0a0a0a; }
.demo-overlay .sb td { height: 38px; font-size: 22px; }
.demo-overlay .sb .sb-name { font-size: 17px; }
.demo-overlay .sb .sb-pts { width: 50px; font-size: 22px; }
.demo-overlay .sb .sb-set { width: 30px; }

/* Offline card */
.offline {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(194,244,58,.10), transparent 60%),
    linear-gradient(180deg, rgba(12,14,19,.55), rgba(12,14,19,.92)),
    var(--offline-bg, #10131a) center / cover no-repeat;
}
.offline-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; max-width: 520px; }
.offline .avatar { width: clamp(72px, 11vw, 112px); height: clamp(72px, 11vw, 112px); font-size: clamp(28px, 4vw, 42px); box-shadow: 0 0 0 4px rgba(255,255,255,.08), 0 20px 60px rgba(0,0,0,.5); }
.offline-chip { font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--muted); background: rgba(255,255,255,.08); padding: 3px 8px; border-radius: 4px; margin-top: 6px; }
.offline h2 { margin: 2px 0 0; font-size: clamp(18px, 2.4vw, 26px); letter-spacing: -0.02em; }
.offline p { margin: 0; color: var(--muted); font-size: clamp(13px, 1.4vw, 15px); }
.offline .btn { margin-top: 8px; height: 42px; padding: 0 20px; font-size: 14.5px; }
.offline-last { font-size: 12.5px; color: var(--dim); margin-top: 4px; }

.not-found { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.not-found h2 { color: var(--text); margin: 0 0 6px; }

/* Floating reactions */
.float-layer { position: absolute; right: 18px; bottom: 0; width: 80px; height: 70%; pointer-events: none; overflow: visible; z-index: 3; }
.floater {
  position: absolute; bottom: 10px; left: 50%;
  font-size: 30px; line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
  animation: floatUp 2.6s cubic-bezier(.25,.6,.3,1) forwards;
}
@keyframes floatUp {
  0% { transform: translate(-50%, 0) scale(.4); opacity: 0; }
  12% { transform: translate(calc(-50% + var(--dx1)), -30px) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx2)), calc(-1 * var(--rise))) scale(.9); opacity: 0; }
}

/* Sound toast over the player */
.sound-toast {
  position: absolute; left: 50%; top: 16px; z-index: 4;
  transform: translate(-50%, -12px); opacity: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border-radius: 999px;
  background: rgba(12,14,19,.82); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 30px rgba(0,0,0,.4);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 650; font-size: 13px; pointer-events: none;
  transition: opacity .2s, transform .3s var(--ease);
}
.sound-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sound-toast .em { font-size: 18px; }
.sound-toast small { color: var(--muted); font-weight: 500; }

/* ---------- Channel bar ---------- */
.channel-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px 16px; align-items: center;
  padding: 16px 20px 14px;
}
.avatar-wrap { position: relative; padding: 3px; border-radius: 50%; }
.avatar-wrap.is-live { background: var(--live); }
.avatar-wrap.is-live .avatar { box-shadow: 0 0 0 3px var(--bg); }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--lime), var(--lime-2));
  color: var(--lime-ink); font-weight: 800; font-size: 24px; letter-spacing: -0.02em;
  background-size: cover; background-position: center;
  overflow: hidden;
}
.avatar-live {
  display: none;
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  background: var(--live); color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  padding: 1px 6px; border-radius: 4px; box-shadow: 0 0 0 3px var(--bg);
}
.avatar-wrap.is-live .avatar-live { display: block; }
.channel-meta { min-width: 0; }
.channel-name-row { display: flex; align-items: center; gap: 8px; }
.channel-name { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-pro { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--gold-ink); background: linear-gradient(135deg, #e5c37e, var(--gold)); padding: 2px 6px; border-radius: 4px; }
.channel-title { margin-top: 2px; font-weight: 600; font-size: 14.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.tag svg { width: 13px; height: 13px; }
.tag-yt { color: #fff; background: rgba(255,0,51,.18); }
.tag-tw { color: #fff; background: rgba(169,112,255,.2); }
.tag-handle { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

.channel-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.channel-buttons { display: flex; gap: 8px; }
.channel-stats { display: flex; gap: 14px; font-variant-numeric: tabular-nums; }
.stat { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; color: var(--muted); }
.stat b { font-weight: 700; color: var(--text); }
.stat-viewers { color: var(--live); }
.stat-viewers b { color: #ff7a8e; }
.stat svg { width: 16px; height: 16px; }

/* ---------- Tabs (phones) ---------- */
.tabs { display: none; }

/* ---------- Panels ---------- */
.panels {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  padding: 4px 20px 28px;
}
.panel {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 16px;
  min-width: 0;
}
.panel-score { grid-column: 1; }
.panel-sounds { grid-column: 2; grid-row: span 2; }
.panel-about { grid-column: 1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.panel-head h2 svg { color: var(--lime); }
.panel-aside { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; font-size: 13px; }
.panel-sub { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255,46,76,.6); animation: pulse 1.8s infinite; }
body:not(.is-live) .dot-live { background: var(--dim); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,46,76,.55) } 70% { box-shadow: 0 0 0 8px rgba(255,46,76,0) } 100% { box-shadow: 0 0 0 0 rgba(255,46,76,0) } }

/* Scorebug: the stream overlay's look */
.scorebug { font-family: var(--font-num); direction: ltr; }
.scorebug-empty { font-family: var(--font); color: var(--dim); font-size: 13px; padding: 18px 4px; text-align: center; }
.sb { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border-radius: 10px; background: #0a0a0a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.sb td { height: 50px; padding: 0 10px; font-weight: 700; font-size: 28px; color: #fff; text-align: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.sb tr:last-child td { border-bottom: 0; }
.sb .sb-name { text-align: left; font-size: 22px; font-weight: 700; letter-spacing: .01em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 100%; color: #d9dde5; }
.sb .sb-name .serving { color: var(--lime); }
.sb .sb-name .sep { color: #59606e; margin: 0 6px; }
.sb .sb-name .ball { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lime); margin-left: 9px; vertical-align: 3px; box-shadow: 0 0 10px rgba(194,244,58,.7); }
.sb .sb-set { width: 40px; color: #8c93a1; font-variant-numeric: tabular-nums; }
.sb .sb-set.won { color: var(--lime); }
.sb .sb-set.current { color: #fff; }
.sb .sb-set sup { font-size: 13px; margin-left: 1px; }
.sb .sb-pts { width: 66px; background: var(--gold); color: var(--gold-ink); font-size: 30px; font-weight: 800; }
.sb .sb-pts.flash { animation: ptsFlash .6s var(--ease); }
@keyframes ptsFlash { 0% { background: #fadb94; } 100% { background: var(--gold); } }
.sb .sb-pts small { font-size: 13px; vertical-align: 10px; }
.sb .winner .sb-name { color: #fff; }
.scorebug-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-family: var(--font); color: var(--muted); font-size: 12.5px; }
.scorebug-foot b { color: var(--text); font-weight: 650; }

/* Court sounds */
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sound {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 76px; padding: 6px 4px;
  border: 0; border-radius: 12px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .15s, transform .12s var(--ease), box-shadow .15s;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.sound:hover { background: var(--surface-3); }
.sound:active { transform: scale(.94); }
.sound .em { font-size: 26px; line-height: 1; }
.sound .lb { font-size: 11.5px; font-weight: 650; color: var(--muted); text-align: center; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound.sound-call { background: linear-gradient(160deg, rgba(194,244,58,.18), rgba(194,244,58,.05)); box-shadow: inset 0 0 0 1px rgba(194,244,58,.28); }
.sound.sound-call .lb { color: var(--lime); }
.sound.sent { box-shadow: inset 0 0 0 2px var(--lime); }
.sound .cool {
  position: absolute; inset: 0; background: rgba(12,14,19,.72);
  transform-origin: left; transform: scaleX(0);
}
.sound-grid.cooling .sound { cursor: default; }
.sound-grid.cooling .sound .cool { animation: cool var(--cool, 8s) linear forwards; }
.sound-grid.cooling .sound.sent .cool { background: rgba(194,244,58,.12); }
@keyframes cool { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.sound-grid.disabled { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.sound-off { display: flex; gap: 10px; align-items: center; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.sound-off svg { color: var(--dim); }

/* About */
.about-bio { margin: 0 0 12px; font-size: 14.5px; color: var(--text); }
.about-bio:empty { display: none; }
.about-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.about-facts:empty { display: none; }
.fact { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); min-width: 92px; }
.fact b { font-size: 18px; font-weight: 800; font-family: var(--font-num); letter-spacing: .01em; }
.fact span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.about-app { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: linear-gradient(120deg, rgba(194,244,58,.10), rgba(194,244,58,.02)); box-shadow: inset 0 0 0 1px rgba(194,244,58,.16); }
.about-app img { border-radius: 10px; }
.about-app strong { display: block; font-size: 14px; }
.about-app span { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Chat ---------- */
.chat {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.chat-head {
  height: 50px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px 0 8px;
  border-bottom: 1px solid var(--line);
}
.chat-tabs { display: flex; gap: 2px; }
.chat-tab {
  height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent;
  font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--dim);
}
.chat-tab:hover { color: var(--text); }
.chat-tab.is-on { color: var(--text); background: var(--surface-3); }
.chat-viewers { font-size: 12.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chat-body { position: relative; flex: 1; min-height: 0; }
.chat-list {
  list-style: none; margin: 0; padding: 10px 6px 10px 10px;
  display: flex; flex-direction: column;
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent;
}
.chat-list > :first-child { margin-top: auto; }
.chat-list > li { flex: none; }
.chat-platform { position: absolute; inset: 0; }
.chat-platform iframe { width: 100%; height: 100%; border: 0; display: block; }
.msg {
  padding: 5px 8px; border-radius: 6px;
  font-size: 13.5px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere;
  animation: msgIn .25s var(--ease);
}
.msg:hover { background: rgba(255,255,255,.035); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .src { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-inline-end: 5px; }
.msg .src svg { width: 11px; height: 11px; stroke-width: 2.4; }
.msg .src-app { background: var(--lime); }
.msg .src-app img { width: 16px; height: 16px; border-radius: 4px; display: block; }
.msg .src-web { background: var(--surface-4); color: var(--muted); }
.msg .src-youtube { background: var(--youtube); color: #fff; }
.msg .src-twitch { background: #9146ff; color: #fff; }
.msg .src-host { background: var(--live); color: #fff; }
.msg .who { font-weight: 750; }
.msg .txt { color: #dfe3ea; }
.msg-cheer { color: var(--muted); font-size: 12.5px; }
.msg-cheer .em { font-size: 16px; vertical-align: -2px; }
.msg-sound { display: flex; align-items: center; gap: 8px; margin: 3px 0; padding: 6px 10px; border-radius: 8px; background: var(--lime-soft); color: var(--text); font-size: 12.5px; }
.msg-sound .em { font-size: 18px; }
.msg-sound b { color: var(--lime); }
.msg-system { color: var(--dim); font-size: 12.5px; text-align: center; padding: 10px 8px; }
.msg-welcome { margin: 4px 2px 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; }
.msg-welcome b { color: var(--text); }
.chat-more {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--lime); color: var(--lime-ink); font-weight: 700; font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.chat-foot { flex: none; padding: 8px 10px 12px; border-top: 1px solid var(--line); }
.reactions { display: flex; gap: 4px; margin-bottom: 8px; }
.reaction {
  flex: 1; height: 36px; border: 0; border-radius: 8px;
  background: var(--surface-2); font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: background .15s, transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.reaction:hover { background: var(--surface-3); }
.reaction:active { transform: scale(.9); }
.reaction small { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.reaction small:empty { display: none; }
.reaction.pop { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.18); } }
.chat-input-wrap { position: relative; }
.chat-form input {
  width: 100%; height: 40px; padding-block: 0; padding-inline: 12px 44px;
  border: 0; border-radius: 8px; outline: none;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 14px;
  transition: box-shadow .15s, background .15s;
}
.chat-form input:focus { background: #0f1218; box-shadow: inset 0 0 0 2px var(--lime); }
.chat-form input:disabled { opacity: .5; }
.chat-send {
  position: absolute; inset-inline-end: 4px; top: 4px; width: 32px; height: 32px;
  border: 0; border-radius: 7px; background: var(--lime); color: var(--lime-ink);
  display: grid; place-items: center;
}
.chat-send:disabled { background: var(--surface-3); color: var(--dim); }
.chat-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; }
.chat-nick { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 700; color: var(--muted); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-rule { font-size: 11.5px; color: var(--dim); text-align: right; }

/* ---------- Sheets / toast ---------- */
.sheet { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(420px, calc(100vw - 32px)); width: 100%; }
.sheet::backdrop { background: rgba(4,6,10,.66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet-card { background: var(--surface-2); border-radius: 16px; padding: 20px; box-shadow: inset 0 0 0 1px var(--line-2), 0 30px 80px rgba(0,0,0,.6); }
.sheet h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.01em; }
.sheet p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.sheet input { width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 15px; outline: none; }
.sheet input:focus { box-shadow: inset 0 0 0 2px var(--lime); }
.sheet-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.sheet-note { font-size: 12.5px !important; margin-top: 12px !important; }
.ios-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.ios-steps svg { width: 16px; height: 16px; vertical-align: -3px; color: #3d9bff; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px;
  background: #f4f6fa; color: #10131a; font-weight: 650; font-size: 13.5px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  transition: opacity .2s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Remote view: buttons only (?view=remote) ---------- */
body.remote .player-shell { display: none; }
body.remote .panel-about { display: none; }
body.remote .panels { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
body.remote .panel-score, body.remote .panel-sounds { grid-column: 1; grid-row: auto; }
body.remote .sound-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
body.remote .sound { height: 96px; }
body.remote .sound .em { font-size: 34px; }
body.remote .sound .lb { font-size: 12.5px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1180px) {
  :root { --chat-w: 320px; }
  .panels { grid-template-columns: 1fr; }
  .panel-score, .panel-sounds, .panel-about { grid-column: 1; grid-row: auto; }
}

@media (max-width: 900px) {
  body { overflow: hidden; }
  .topbar { height: 48px; --topbar: 48px; padding: 0 12px; }
  .brand-name { font-size: 15px; }
  .topbar-get { height: 32px; font-size: 13px; }
  .layout {
    display: flex; flex-direction: column;
    height: calc(100dvh - 48px);
  }
  .stage { flex: none; overflow: visible; display: contents; }
  .player-shell { flex: none; }
  .player { max-height: 42dvh; }
  .channel-bar { flex: none; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .avatar { width: 42px; height: 42px; font-size: 17px; }
  .avatar-live { font-size: 9px; padding: 0 4px; bottom: -5px; }
  .channel-name { font-size: 15.5px; }
  .channel-title { font-size: 12.5px; color: var(--muted); }
  .channel-tags { display: none; }
  .channel-actions { flex-direction: row-reverse; align-items: center; gap: 8px; }
  .channel-stats { flex-direction: column; gap: 0; align-items: flex-end; }
  .stat { font-size: 12px; }
  .stat svg { width: 13px; height: 13px; }
  .btn-bell span { display: none; }
  .btn-bell { width: 36px; padding: 0; }
  .channel-buttons { gap: 6px; }

  .tabs {
    flex: none;
    display: flex; gap: 2px; padding: 0 8px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
  }
  .tabs button {
    position: relative; flex: 1;
    height: 42px; border: 0; background: none;
    font-size: 13.5px; font-weight: 700; color: var(--dim);
  }
  .tabs button[aria-selected="true"] { color: var(--text); }
  .tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--lime); }
  .tab-dot { position: absolute; top: 10px; margin-left: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--live); display: none; }
  .tab-dot.on { display: inline-block; }

  .panels { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: block; }
  .panel { display: none; }
  .chat { display: none; border-left: 0; }
  body[data-tab="score"] .panel-score,
  body[data-tab="sounds"] .panel-sounds,
  body[data-tab="about"] .panel-about { display: block; }
  body[data-tab="chat"] .panels { display: none; }
  body[data-tab="chat"] .chat { display: flex; flex: 1; min-height: 0; }
  .panel { background: transparent; box-shadow: none; padding: 4px 2px; }
  .sound-grid { grid-template-columns: repeat(4, 1fr); }
  .sound { height: 80px; }
  .float-layer { right: 8px; width: 56px; }
  .demo-overlay { width: 64%; }
  .demo-overlay .sb td { height: 30px; font-size: 18px; }
  .demo-overlay .sb .sb-name { font-size: 14px; }
  .demo-overlay .sb .sb-pts { width: 40px; font-size: 18px; }
  .floater { font-size: 24px; }
  .about-app { grid-template-columns: auto 1fr; }
  .about-app .btn { grid-column: 1 / -1; }

  body.remote .tabs { display: none; }
  body.remote .panels { display: block !important; }
  body.remote .panel-sounds, body.remote .panel-score { display: block; }
  body.remote .chat { display: none !important; }
  body.remote .sound-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) {
  .sound-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* One chat (no tabs) and the host's sound timing */
.chat-title { margin: 0 0 0 4px; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.panel-sounds .panel-head { flex-wrap: wrap; }
.sounds-mode {
  margin-inline-start: auto; margin-inline-end: 4px;
  height: 22px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 750; letter-spacing: .02em;
  color: var(--lime); background: var(--lime-soft);
}
.sounds-mode.is-point { color: var(--gold-ink); background: linear-gradient(135deg, #e5c37e, var(--gold)); }

/* The chat's name line and rule on two lines (German "Du chattest als …" was cut off) */
.chat-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
.chat-nick { max-width: 100%; text-align: start; }
.chat-rule { text-align: start; }
/* The top bar's link to Live now */
.topbar-nav { display: flex; gap: 4px; margin-inline-start: 18px; }
.topbar-link { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; }
.topbar-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
@media (max-width: 900px) { .topbar-nav { margin-inline-start: 4px; } .topbar-link { padding: 0 8px; font-size: 13.5px; } }

/* ---------- Account (signed in like on PadelCup: chat and court sounds need it) ---------- */
.topbar-account { position: relative; display: flex; align-items: center; margin-inline-start: 8px; }
.topbar-account:empty { display: none; }
.topbar-signin { height: 34px; padding: 0 14px; font-size: 14px; }
.acct-button { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px 2px 2px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.acct-button:hover, .acct-button[aria-expanded="true"] { background: rgba(255,255,255,.06); color: var(--text); }
.acct-chevron { font-size: 11px; }
.acct-face { display: inline-block; border-radius: 50%; object-fit: cover; flex: none; }
.acct-initials { display: inline-grid; place-items: center; background: var(--c, var(--surface-4)); color: #0c0e13; font-weight: 800; font-size: 12px; letter-spacing: -0.02em; }
.acct-head .acct-initials { font-size: 15px; }
.acct-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60; min-width: 230px; padding: 6px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2), 0 18px 50px rgba(0,0,0,.55); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-head span { display: grid; min-width: 0; }
.acct-head strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head small { color: var(--muted); font-size: 12.5px; }
.acct-item { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: start; text-decoration: none; cursor: pointer; }
.acct-item:hover, .acct-item:focus-visible { background: rgba(255,255,255,.06); outline: none; }

/* The way in, where the chat box or the sound pad would be. */
.gate { display: grid; gap: 8px; justify-items: start; padding: 12px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.gate[hidden] { display: none; }
.gate p { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.gate small { font-size: 12px; color: var(--muted); }
.gate small[hidden], .gate .btn[hidden] { display: none; }
.gate .btn { height: 34px; padding: 0 16px; font-size: 14px; }
.chat-gate { margin-top: 2px; }
.sound-gate { margin-bottom: 12px; }
.chat-nick:empty { display: none; }
.chat-form[hidden] { display: none; }

@media (max-width: 560px) {
  .topbar-get { display: none; }
  .topbar-signin { height: 32px; padding: 0 12px; font-size: 13px; }
}
/* With the sign-in button the phone's top bar is full: the menu link stays on one line, the brand's LIVE tag goes. */
.topbar-link { white-space: nowrap; }
@media (max-width: 430px) {
  .brand-live { display: none; }
  .topbar-nav { margin-inline-start: 2px; }
}

/* ---------- Before the first point: the scorer's pre-match poster in the score panel ---------- */
.pm { display: grid; gap: 12px; padding: 14px 16px; border-radius: 12px; background: #000; box-shadow: inset 0 0 0 1px var(--line-2); }
.pm-top { text-align: center; color: var(--muted); font-weight: 650; font-size: 13px; }
.pm-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.pm-team { display: grid; gap: 2px; min-width: 0; font-family: var(--font-num); font-weight: 800; font-size: clamp(20px, 2.6vw, 28px); line-height: 1.1; text-transform: uppercase; letter-spacing: -0.01em; }
.pm-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-team.left { text-align: end; }
.pm-team.right { text-align: start; }
.pm-vs { color: #ffd60a; font-weight: 900; font-size: clamp(18px, 2.2vw, 24px); }
.pm-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 650; }
.pm-serve { display: inline-flex; align-items: center; gap: 7px; color: var(--lime); }
.pm-serve .ball { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px rgba(194,244,58,.7); }
.pm-clock { color: #ffd60a; font-weight: 800; font-variant-numeric: tabular-nums; }
.pm-clock.overrun { color: #ff453a; }
