* {
  box-sizing: border-box;
}

:root {
  --bg: #070d1a;
  --surface: rgba(15, 28, 48, 0.85);
  --surface-hover: rgba(22, 40, 68, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --gold: #f5c842;
  --green: #00c853;
  --live: #ff4757;
  --text: #f0f4f8;
  --muted: #8b9cb3;
  --header-h: clamp(3.25rem, 8vh, 4.5rem);
  --layout-gap: clamp(0.35rem, 1.2vw, 1rem);
  --layout-pad: clamp(0.35rem, 1.2vw, 1rem);
  --sidebar-w: clamp(240px, 28vw, 380px);
}

html {
  height: 100%;
  overflow: hidden;
}

html.mobile-scroll {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html.mobile-scroll body,
body.mobile-scroll {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

html.mobile-scroll .layout,
body.mobile-scroll .layout {
  flex: none;
  min-height: auto;
  overflow: visible;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
}

html.mobile-scroll .player-panel,
body.mobile-scroll .player-panel {
  min-height: auto;
  overflow: visible;
}

html.mobile-scroll .player-wrap,
body.mobile-scroll .player-wrap {
  flex: none;
  min-height: 0;
  aspect-ratio: 16 / 9;
  height: auto;
}

html.mobile-scroll .sidebar,
body.mobile-scroll .sidebar {
  min-height: auto;
  overflow: visible;
}

html.mobile-scroll .panel,
html.mobile-scroll .panel.active,
body.mobile-scroll .panel,
body.mobile-scroll .panel.active {
  flex: none;
  min-height: auto;
  overflow: visible;
}

html.mobile-scroll .channel-list,
html.mobile-scroll .schedule-list,
body.mobile-scroll .channel-list,
body.mobile-scroll .schedule-list {
  flex: none;
  min-height: auto;
  overflow: visible;
}

html.mobile-scroll .bracket-root,
body.mobile-scroll .bracket-root {
  flex: none;
  min-height: auto;
  overflow: visible;
}

body.mobile-scroll.feedback-open,
html.mobile-scroll:has(body.feedback-open) {
  overflow: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 80% 50% at 20% -10%,
      rgba(0, 200, 83, 0.12),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 90% 10%,
      rgba(245, 200, 66, 0.1),
      transparent
    ),
    radial-gradient(
      ellipse 50% 30% at 50% 100%,
      rgba(0, 100, 200, 0.08),
      transparent
    );
  z-index: 0;
}

.site-header {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  padding: clamp(0.45rem, 1.2vh, 1rem) clamp(0.75rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 13, 26, 0.9);
  backdrop-filter: blur(12px);
  overflow: visible;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.trophy {
  font-size: clamp(1.35rem, 3.5vw, 2.2rem);
  filter: drop-shadow(0 0 12px rgba(245, 200, 66, 0.5));
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.site-header h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.25rem, 3.2vw, 2rem);
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--gold), #fff8e0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 0.1rem 0 0;
  font-size: clamp(0.62rem, 1.4vw, 0.8rem);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.release-version {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

.beta-badge.hidden {
  display: none;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.28rem 0.75rem 0.28rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(255, 145, 0, 0.42),
    rgba(255, 87, 34, 0.32)
  );
  border: 1.5px solid rgba(255, 171, 64, 0.75);
  color: #fff3e0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    0 0 18px rgba(255, 152, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: beta-glow 2.2s ease-in-out infinite;
}

.beta-pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ff9100;
  box-shadow: 0 0 10px #ff9100;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes beta-glow {
  0%,
  100% {
    box-shadow:
      0 0 14px rgba(255, 152, 0, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 171, 64, 0.65);
  }
  50% {
    box-shadow:
      0 0 26px rgba(255, 152, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 193, 77, 0.95);
  }
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.4);
  color: var(--live);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.live-badge.hidden {
  display: none;
}

.tip-wrap {
  position: relative;
}

.tip-btn {
  border: 1px solid rgba(245, 200, 66, 0.35);
  background: rgba(245, 200, 66, 0.1);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.tip-btn:hover,
.tip-btn[aria-expanded="true"] {
  background: rgba(245, 200, 66, 0.18);
  border-color: rgba(245, 200, 66, 0.55);
}

.tip-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 50;
  width: min(20rem, 80vw);
  padding: 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 28, 48, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.tip-popover::before {
  content: "";
  position: absolute;
  top: -0.35rem;
  right: 1.1rem;
  width: 0.7rem;
  height: 0.7rem;
  background: rgba(15, 28, 48, 0.98);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  transform: rotate(45deg);
}

.tip-popover.hidden {
  display: none;
}

.tip-popover-qr {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.feedback-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.feedback-btn:hover {
  color: var(--text);
  border-color: rgba(139, 156, 179, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

body.feedback-open {
  overflow: hidden;
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.feedback-modal.hidden {
  display: none;
}

.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(4px);
}

.feedback-dialog {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 28, 48, 0.98);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}

.feedback-header h2 {
  margin: 0;
  font-size: 1rem;
}

.feedback-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.feedback-close:hover {
  color: var(--text);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.5rem 1rem 1rem;
}

.feedback-types {
  display: flex;
  gap: 0.5rem;
  border: none;
  margin: 0;
  padding: 0;
}

.feedback-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  cursor: pointer;
}

.feedback-type:has(input:checked) {
  border-color: rgba(245, 200, 66, 0.55);
  background: rgba(245, 200, 66, 0.12);
  color: var(--gold);
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.feedback-field input,
.feedback-field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: inherit;
  resize: vertical;
}

.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: rgba(139, 156, 179, 0.55);
}

.feedback-status {
  min-height: 1.1rem;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.feedback-status.success {
  color: #6ee7a8;
}

.feedback-status.error {
  color: #ff8f9d;
}

.feedback-submit {
  border: 1px solid rgba(245, 200, 66, 0.45);
  background: rgba(245, 200, 66, 0.14);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  cursor: pointer;
}

.feedback-submit:hover:not(:disabled) {
  background: rgba(245, 200, 66, 0.22);
}

.feedback-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

.layout {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--layout-gap);
  padding: var(--layout-pad);
  overflow: hidden;
}

.player-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 0.8vh, 0.75rem);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.player-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: transparent;
  border-radius: clamp(10px, 1.5vw, 16px);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.player-wrap:fullscreen,
.player-wrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  aspect-ratio: unset;
  border: none;
  background: #000;
}

.player-wrap:fullscreen #player,
.player-wrap:-webkit-full-screen #player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-wrap:fullscreen .danmaku-layer,
.player-wrap:-webkit-full-screen .danmaku-layer {
  height: 15%;
  min-height: calc(3 * 1.35rem + 0.5rem);
}

.player-overlay-btns {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 5;
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.player-wrap:hover .player-overlay-btns,
.player-wrap:focus-within .player-overlay-btns {
  opacity: 1;
}

.player-airplay-btn,
.player-max-btn,
.player-fs-btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  transition:
    background 0.15s,
    border-color 0.15s,
    opacity 0.18s ease;
}

.player-wrap:hover .player-airplay-btn,
.player-wrap:hover .player-max-btn,
.player-wrap:hover .player-fs-btn,
.player-wrap:focus-within .player-airplay-btn,
.player-wrap:focus-within .player-max-btn,
.player-wrap:focus-within .player-fs-btn {
  pointer-events: auto;
}

.player-airplay-btn:hover,
.player-max-btn:hover,
.player-fs-btn:hover {
  background: rgba(0, 0, 0, 0.82);
  border-color: rgba(255, 255, 255, 0.35);
}

.player-airplay-btn.active,
.player-max-btn.active,
.player-fs-btn.active {
  background: rgba(245, 200, 66, 0.22);
  border-color: rgba(245, 200, 66, 0.55);
  color: var(--gold);
}

.player-airplay-btn.hidden {
  display: none;
}

.player-wrap:fullscreen .player-overlay-btns,
.player-wrap:-webkit-full-screen .player-overlay-btns {
  right: 0.75rem;
  top: 0.75rem;
}

body.player-maximized .site-header,
body.player-maximized .sidebar {
  display: none;
}

body.player-maximized .player-meta-row,
body.player-maximized .live-odds,
body.player-maximized .danmaku-bar {
  display: none;
}

body.player-maximized .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

body.player-maximized .player-panel {
  gap: 0;
}

body.player-maximized .player-wrap {
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

@media (hover: none) {
  body.player-maximized .player-overlay-btns {
    opacity: 1;
  }

  body.player-maximized .player-max-btn,
  body.player-maximized .player-fs-btn {
    pointer-events: auto;
  }
}

#player {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  object-fit: contain;
}

.player-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.2s;
}

.player-status.hidden {
  opacity: 0;
}

.danmaku-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 15%;
  min-height: calc(3 * 1.35rem + 0.5rem);
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  padding-top: 0.2rem;
  box-sizing: border-box;
}

.danmaku-layer.hidden {
  display: none;
}

.danmaku-item {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-size: clamp(0.875rem, 2.6vw, 1.25rem);
  line-height: 1;
  font-weight: 700;
  display: flex;
  align-items: center;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.95),
    -1px -1px 2px rgba(0, 0, 0, 0.7);
  transform: translateX(var(--dm-start, 100%));
  will-change: transform;
}

.danmaku-item.fly {
  animation: danmaku-fly var(--dm-duration, 8s) linear forwards;
}

@keyframes danmaku-fly {
  from {
    transform: translateX(var(--dm-start, 100%));
  }
  to {
    transform: translateX(var(--dm-end, -100%));
  }
}

.danmaku-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 1vw, 0.5rem);
  padding: clamp(0.15rem, 0.5vh, 0.35rem) 0.25rem 0;
}

.danmaku-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.danmaku-toggle input {
  accent-color: var(--gold);
}

#danmaku-input {
  flex: 1;
  min-width: 0;
  padding: clamp(0.35rem, 1vh, 0.55rem) clamp(0.5rem, 1.5vw, 0.75rem);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: clamp(0.78rem, 1.8vw, 0.9rem);
}

#danmaku-input:focus {
  outline: none;
  border-color: rgba(245, 200, 66, 0.45);
}

#danmaku-send {
  padding: clamp(0.35rem, 1vh, 0.55rem) clamp(0.65rem, 2vw, 1rem);
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #e6b800);
  color: #1a1a2e;
  font-weight: 700;
  font-size: clamp(0.72rem, 1.6vw, 0.85rem);
  cursor: pointer;
  white-space: nowrap;
}

#danmaku-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.player-meta-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.5rem, 2vw, 1.25rem);
  padding: clamp(0.15rem, 0.5vh, 0.4rem) 0.25rem 0.05rem;
}

.player-meta-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.player-meta-main.empty {
  color: var(--muted);
  font-size: 0.875rem;
}

.player-meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(0, 200, 83, 0.55);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.player-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.player-meta-main .channel-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.player-meta-viewers {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 200, 83, 0.28);
  background: rgba(0, 200, 83, 0.08);
}

.player-meta-viewers::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.5);
}

.player-meta-viewers.hidden {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(10px, 1.5vw, 16px);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.announcement {
  position: relative;
  flex-shrink: 0;
  display: flex;
  gap: 0.6rem;
  padding: clamp(0.65rem, 1.6vh, 0.9rem) clamp(0.75rem, 1.7vw, 1rem);
  border-bottom: 1px solid rgba(245, 200, 66, 0.22);
  background:
    linear-gradient(
      135deg,
      rgba(245, 200, 66, 0.16),
      rgba(245, 200, 66, 0.05) 55%,
      rgba(15, 28, 48, 0.2)
    );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: announcement-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.announcement-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  color: #1a1205;
  background: linear-gradient(135deg, var(--gold), #ffd76a);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.12);
}

.announcement-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.announcement-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.announcement-text {
  margin: 0;
  color: var(--text);
  font-size: clamp(0.78rem, 1.7vw, 0.88rem);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes announcement-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.announcement.hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .announcement {
    animation: none;
  }
}

.sidebar-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: clamp(0.45rem, 1.2vh, 0.85rem);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--gold);
  background: rgba(245, 200, 66, 0.08);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.panel {
  display: none;
  flex: 1;
  overflow: hidden;
}

.panel.active {
  display: flex;
  flex-direction: column;
}

#panel-schedule {
  position: relative;
}

.schedule-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0;
  flex-shrink: 0;
  position: relative;
  z-index: 6;
  background: #0e1728;
}

.schedule-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.schedule-toolbar .schedule-meta {
  flex: 1;
}

#panel-bracket .schedule-meta {
  flex: 0 0 auto;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.schedule-today-btn {
  flex-shrink: 0;
  border: 1px solid rgba(0, 200, 83, 0.32);
  background: rgba(0, 200, 83, 0.08);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.schedule-today-btn:hover {
  background: rgba(0, 200, 83, 0.14);
  border-color: rgba(0, 200, 83, 0.45);
}

.schedule-today-btn.hidden {
  display: none;
}

.schedule-today-float {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 8;
  border: 1px solid rgba(0, 200, 83, 0.35);
  background: rgba(7, 13, 26, 0.92);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}

.schedule-today-float:hover {
  background: rgba(0, 200, 83, 0.12);
  border-color: rgba(0, 200, 83, 0.5);
  transform: translateY(-1px);
}

.schedule-today-float.hidden {
  display: none;
}

.schedule-source {
  color: var(--green);
}

.schedule-count {
  color: var(--muted);
}

.channel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(0.4rem, 1vh, 0.75rem);
}

.schedule-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 clamp(0.4rem, 1vh, 0.75rem) clamp(0.4rem, 1vh, 0.75rem);
  isolation: isolate;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.15s;
}

.channel-item:hover {
  border-color: rgba(245, 200, 66, 0.4);
  background: var(--surface-hover);
  transform: translateX(2px);
}

.channel-item.active {
  border-color: var(--gold);
  background: rgba(245, 200, 66, 0.1);
}

.channel-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.channel-logo.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #666;
}

.channel-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-group {
  font-size: 0.78rem;
  color: var(--muted);
}

.schedule-day {
  margin-bottom: 1.25rem;
}

.schedule-day .day-title {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 -0.75rem 0.65rem;
  padding: 0.45rem 0.75rem 0.5rem;
  background: #0e1728;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(7, 13, 26, 0.85);
}

.day-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.schedule-day-today .day-title {
  color: var(--green);
}

.match-card {
  padding: 0.85rem;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s;
}

.match-card.status-live {
  border-color: rgba(255, 71, 87, 0.5);
  background: rgba(255, 71, 87, 0.06);
}

.match-card.status-finished {
  opacity: 0.85;
}

.match-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.match-time {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.match-group {
  font-size: 0.72rem;
  color: var(--muted);
}

.match-status {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.badge-finished {
  background: rgba(139, 156, 179, 0.2);
  color: var(--muted);
}

.badge-live {
  background: rgba(255, 71, 87, 0.2);
  color: var(--live);
}

.badge-scheduled {
  background: rgba(0, 200, 83, 0.15);
  color: var(--green);
}

.match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.team:last-child {
  flex-direction: row-reverse;
  text-align: right;
}

.team-flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.team-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-align: center;
  min-width: 4rem;
}

.score.vs {
  font-size: 1rem;
  color: var(--muted);
}

.score.live-score {
  color: var(--live);
}

.match-venue {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.empty,
.error {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  text-align: center;
}

.error {
  color: #ff8a80;
}

@media (max-height: 720px) {
  .release-version {
    display: none;
  }

  .live-odds-head,
  .live-odds-toggle {
    margin-bottom: 0.35rem;
  }

  .live-odds.is-collapsed .live-odds-toggle {
    margin-bottom: 0;
  }

  .live-odds-matchup {
    margin-bottom: 0.35rem;
  }
}

@media (max-height: 560px) {
  .header-brand .subtitle {
    display: none;
  }

  .danmaku-toggle span {
    display: none;
  }
}

@media (max-width: 960px) {
  :root {
    --sidebar-w: 100%;
  }

  html {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .layout {
    flex: none;
    min-height: auto;
    height: auto;
    overflow: visible;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .player-panel {
    min-height: auto;
    overflow: visible;
  }

  .player-wrap {
    flex: none;
    min-height: 0;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .sidebar {
    min-height: auto;
    overflow: visible;
  }

  .panel,
  .panel.active {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .channel-list,
  .schedule-list {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .bracket-root {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  body.feedback-open,
  html:has(body.feedback-open) {
    overflow: hidden;
  }

  .header-brand .subtitle {
    display: none;
  }

  .danmaku-layer {
    height: 18%;
    min-height: calc(3 * 1.25rem + 0.75rem);
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  .layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
    grid-template-rows: auto;
    height: auto;
    min-height: auto;
  }

  :root {
    --sidebar-w: clamp(220px, 34vw, 320px);
  }
}

/* Bracket full map */
.layout.bracket-mode {
  display: flex;
  flex-direction: column;
  padding: var(--layout-pad);
}

.layout.bracket-mode .player-panel {
  display: none;
}

.layout.bracket-mode .sidebar {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.bracket-root {
  flex: 1;
  overflow: auto;
  padding: 0.25rem 0.5rem 0.75rem;
}

.tournament-map {
  display: flex;
  gap: 0.75rem;
  min-width: max-content;
  align-items: stretch;
}

.groups-wing {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wing-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.06em;
}

.group-panel {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.group-header {
  padding: 0.35rem 0.5rem;
  font-weight: 700;
  font-size: 0.75rem;
  background: rgba(245, 200, 66, 0.15);
  color: var(--gold);
  text-align: center;
}

.group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.58rem;
}

.group-table th,
.group-table td {
  padding: 0.2rem 0.25rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.group-table th {
  color: var(--muted);
  font-weight: 600;
}

.gt-team {
  text-align: left !important;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.gt-team img {
  width: 14px;
  height: 10px;
  flex-shrink: 0;
}

.gt-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-fixtures {
  padding: 0.25rem 0.35rem 0.35rem;
  border-top: 1px solid var(--border);
}

.gf-item {
  font-size: 0.55rem;
  color: var(--muted);
  padding: 0.2rem 0;
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
}

.gf-datetime {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 3.2rem;
}

.gf-date {
  color: #aeb4be;
  font-size: 0.52rem;
}

.gf-time {
  color: var(--gold);
  font-weight: 600;
}

.gf-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.gf-item.status-live {
  color: var(--live);
}

.gf-item.status-live .gf-time {
  color: var(--live);
}

.gf-item.status-finished .gf-text {
  color: #c7cbd1;
}

.knockout-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 720px;
}

.arena-row {
  display: grid;
  grid-template-columns: 1fr 168px 1fr;
  gap: 0.5rem;
  align-items: stretch;
}

.arena-center-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-sf .bracket-match {
  border: 2px solid #b8860b;
}

.arena-finals {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
}

.finals-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.third-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.arena-finals .bracket-match {
  width: 168px;
}

.quadrant {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-color: color-mix(in srgb, var(--q-accent) 40%, transparent);
  border-radius: 10px;
  padding: 0.45rem 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  background: color-mix(in srgb, var(--q-accent) 8%, transparent);
  overflow: visible;
  box-sizing: border-box;
}

.q-title {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--q-accent);
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}

.q-round-headers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.q-round-headers span {
  text-align: center;
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 600;
}

.q-bracket-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(4.25rem, 1fr));
  gap: 0 0.5rem;
  min-height: 17rem;
}

.q-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.q-slot .bracket-match {
  width: 100%;
  max-width: 148px;
}

.q-slot.from-left.round-r32::after,
.q-slot.from-left.round-r16::after {
  content: "";
  position: absolute;
  right: -0.35rem;
  top: 50%;
  width: 0.35rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
  background: color-mix(in srgb, var(--q-accent) 60%, #fff);
}

.q-slot.from-right.round-r32::before,
.q-slot.from-right.round-r16::before {
  content: "";
  position: absolute;
  left: -0.35rem;
  top: 50%;
  width: 0.35rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
  background: color-mix(in srgb, var(--q-accent) 60%, #fff);
}

.bracket-match {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-size: 0.65rem;
  position: relative;
  flex: 0 0 auto;
  height: auto;
}

.bracket-match.status-live {
  box-shadow: 0 0 0 2px var(--live);
}

.bm-header {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0.4rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.58rem;
}

.bm-body {
  padding: 0.2rem 0.3rem 0.3rem;
  flex: 0 0 auto;
}

.bm-team {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0;
}

.bm-team.placeholder .bm-name {
  color: #666;
  font-size: 0.55rem;
}

.bm-team.winner .bm-name {
  font-weight: 700;
  color: #111;
}

.bm-team.loser {
  opacity: 0.4;
}

.bm-flag {
  width: 15px;
  height: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.bm-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.bm-pts {
  font-family: "Bebas Neue", sans-serif;
  font-size: 0.85rem;
}

.bm-time {
  margin-top: 0.12rem;
  font-size: 0.55rem;
  color: #888;
  text-align: center;
  border-top: 1px solid #eee;
  padding-top: 0.15rem;
}

.bm-live {
  position: absolute;
  top: 1.35rem;
  right: 0.2rem;
  font-size: 0.5rem;
  font-weight: 800;
  color: var(--live);
}

.arena-row.top .quadrant,
.arena-row.bottom .quadrant {
  min-height: 22rem;
}

@media (max-width: 1200px) {
  .tournament-map {
    flex-direction: column;
  }

  .groups-wing {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .groups-wing .group-panel {
    width: calc(50% - 0.25rem);
  }

  .knockout-arena {
    min-width: 0;
    overflow-x: auto;
  }
}

@media (max-width: 960px) {
  .groups-wing .group-panel {
    width: 100%;
  }
}

/* Live odds (Polymarket, in-progress matches only) — sidebar bottom */
.live-odds {
  flex-shrink: 0;
  margin-top: auto;
  padding: clamp(0.5rem, 1.2vh, 0.75rem) clamp(0.65rem, 1.5vw, 0.85rem);
  border-top: 1px solid rgba(255, 71, 87, 0.35);
  background: rgba(255, 71, 87, 0.06);
}

.live-odds.hidden {
  display: none;
}

.live-odds-head,
.live-odds-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.65rem;
}

.live-odds-toggle {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.live-odds-toggle:hover .live-odds-title {
  color: #ffe08a;
}

.live-odds-chevron {
  margin-left: auto;
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.live-odds.is-collapsed .live-odds-chevron {
  transform: rotate(-135deg);
}

.live-odds.is-collapsed .live-odds-body {
  display: none;
}

.live-odds.is-collapsed .live-odds-toggle {
  margin-bottom: 0;
}

.live-odds-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ff4757;
}

.live-odds-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
}

.live-odds-card-head {
  margin-bottom: 0.45rem;
}

.live-odds-phase {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.live-odds-phase.live {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.15);
}

.live-odds-phase.prematch {
  color: var(--gold);
  background: rgba(245, 200, 66, 0.12);
}

.live-odds-source {
  font-size: 0.72rem;
  color: var(--muted);
}

.live-odds-card + .live-odds-card {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.live-odds-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 0.35rem 0.45rem;
  margin-bottom: 0.55rem;
}

.live-odds-team {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.live-odds-team.home {
  align-items: flex-start;
}

.live-odds-team.away {
  align-items: flex-end;
}

.live-odds-team-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.live-odds-team.away .live-odds-team-line {
  flex-direction: row-reverse;
}

.live-odds-team-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-odds-pct {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.live-odds-team.home .live-odds-pct {
  color: #60a5fa;
}

.live-odds-team.away .live-odds-pct {
  color: #fbbf24;
}

.live-odds-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding-top: 0.1rem;
  flex-shrink: 0;
}

.live-odds-team .team-flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.live-odds-draw {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.live-odds-center .live-odds-pct {
  font-size: 0.82rem;
  color: var(--muted);
}

.odds-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 0.35rem;
}

.odds-seg.home {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.odds-seg.draw {
  background: linear-gradient(90deg, #8b9cb3, #a8b8cc);
}

.odds-seg.away {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.odds-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.65rem;
  margin-bottom: 0.35rem;
}

.odds-label.home {
  color: #60a5fa;
}

.odds-label.draw {
  color: var(--muted);
}

.odds-label.away {
  color: #fbbf24;
}

.live-odds-link {
  font-size: 0.72rem;
  color: var(--green);
  text-decoration: none;
}

.live-odds-link:hover {
  text-decoration: underline;
}
