*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --void:        #07071a;
  --ink:         #0d0d26;
  --surface:     #13132e;
  --chalk:       #eaeaf6;
  --chalk-dim:   rgba(234,234,246,0.48);
  --chalk-faint: rgba(234,234,246,0.12);
  --turf:        #29e07c;
  --turf-glow:   rgba(41,224,124,0.22);
  --turf-dim:    rgba(41,224,124,0.14);
  --live:        #ff3c3c;
  --live-glow:   rgba(255,60,60,0.28);
  --live-dim:    rgba(255,60,60,0.14);
  --glass:       rgba(255,255,255,0.055);
  --border:      rgba(255,255,255,0.08);
  --r:           10px;
  --ctrl-h:      42px;
  --font-d:      'Space Grotesk', system-ui, sans-serif;
  --font-b:      'Inter', system-ui, sans-serif;
  --font-m:      'Space Mono', monospace;
}

html {
  height: 100%;
  background: var(--void);
}

body {
  min-height: 100%;
  background: var(--void);
  color: var(--chalk);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 54px;
  background: rgba(7,7,26,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--turf);
  color: var(--void);
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--chalk);
}

.header-live {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--live-dim);
  border: 1px solid rgba(255,60,60,0.3);
  box-shadow: 0 0 14px var(--live-glow);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(255,60,60,0.5); }
  50%       { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(255,60,60,0); }
}

.live-text {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--live);
  line-height: 1;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.player-wrapper {
  width: 100%;
  position: relative;
}

.player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  outline: none;
}

#fwVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.overlay-top,
.overlay-bottom {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.overlay.cshow .overlay-top,
.overlay.cshow .overlay-bottom {
  opacity: 1;
  pointer-events: auto;
}

.overlay-top {
  padding: 14px 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.72) 0%, transparent 100%);
}

.ob-brand {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 15px;
  color: var(--turf);
  opacity: 0.75;
  letter-spacing: -0.2px;
}

.ob-btn {
  background: none;
  border: none;
  color: var(--chalk);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: background 0.18s, opacity 0.18s;
  flex-shrink: 0;
}

.ob-btn:hover {
  background: var(--glass);
  opacity: 1;
}

.overlay-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.center-play {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chalk);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.center-play.visible {
  opacity: 1;
  transform: scale(1);
}

.buffer-ring {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 2.5px solid rgba(255,255,255,0.1);
  border-top-color: var(--turf);
  border-radius: 50%;
  display: none;
  pointer-events: none;
}

.buffer-ring.spin {
  display: block;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.overlay-bottom {
  background: linear-gradient(0deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.48) 55%, transparent 100%);
  padding-top: 28px;
}

.progress-row {
  padding: 0 14px 10px;
}

.progress-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.14);
  border-radius: 3px;
  cursor: pointer;
  transition: height 0.14s ease;
}

.progress-track:hover {
  height: 5px;
}

.progress-buffer {
  position: absolute;
  inset-block: 0;
  left: 0;
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
  width: 0;
  pointer-events: none;
}

.progress-fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  background: var(--turf);
  border-radius: 3px;
  width: 0;
  pointer-events: none;
  transition: width 0.25s linear;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--turf);
  box-shadow: 0 0 8px var(--turf-glow);
  transition: transform 0.14s ease;
  pointer-events: none;
}

.progress-track:hover .progress-fill::after {
  transform: translateY(-50%) scale(1);
}

.live-edge-pip {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5px;
  height: 12px;
  background: var(--live);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--live-glow);
  pointer-events: none;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px 10px;
  gap: 4px;
}

.controls-l,
.controls-r {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: rgba(234,234,246,0.88);
  cursor: pointer;
  width: var(--ctrl-h);
  height: var(--ctrl-h);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, color 0.16s, transform 0.1s;
  flex-shrink: 0;
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.ctrl-btn:hover {
  background: var(--chalk-faint);
  color: var(--chalk);
}

.ctrl-btn:active {
  transform: scale(0.9);
}

.vol-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.vol-track-wrap {
  width: 0;
  overflow: hidden;
  transition: width 0.22s ease;
  display: flex;
  align-items: center;
}

.vol-track-wrap.open {
  width: 78px;
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 0 4px;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--chalk);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.6);
}

.vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--chalk);
  cursor: pointer;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  height: 28px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.7px;
  font-weight: 700;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  white-space: nowrap;
  line-height: 1;
}

.live-pill.at-edge {
  background: var(--live);
  color: #fff;
  box-shadow: 0 0 12px rgba(255,60,60,0.45);
}

.live-pill.behind {
  background: rgba(255,255,255,0.12);
  color: rgba(234,234,246,0.7);
}

.live-pill:hover {
  transform: scale(1.04);
}

.live-pill:active {
  transform: scale(0.96);
}

.lpip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.live-pill.at-edge .lpip {
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.live-pill.behind .lpip {
  opacity: 0.5;
}

.qbadge {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--turf);
  background: var(--turf-dim);
  border: 1px solid rgba(41,224,124,0.25);
  border-radius: 6px;
  min-width: 44px;
  padding: 0 6px;
  height: 28px;
  width: auto;
}

.qbadge:hover {
  background: rgba(41,224,124,0.22);
  color: var(--turf);
}

.quality-panel {
  position: absolute;
  bottom: 66px;
  right: 14px;
  min-width: 155px;
  background: rgba(8,8,26,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  z-index: 30;
  box-shadow: 0 10px 40px rgba(0,0,0,0.55);
  animation: pop-in 0.16s ease;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.qp-head {
  padding: 10px 16px 8px;
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--chalk-dim);
  border-bottom: 1px solid var(--border);
}

.qp-item {
  padding: 10px 16px;
  font-family: var(--font-d);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.14s;
  color: var(--chalk);
}

.qp-item:hover {
  background: var(--glass);
}

.qp-item.active {
  color: var(--turf);
}

.qp-item.active::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--turf);
  flex-shrink: 0;
}

.player-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.3s ease;
}

.player-loading.gone {
  opacity: 0;
  pointer-events: none;
}

.loading-ring {
  width: 46px;
  height: 46px;
  border: 2.5px solid rgba(255,255,255,0.08);
  border-top-color: var(--turf);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-label {
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--chalk-dim);
}

.player-error {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(7,7,26,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.err-icon {
  color: var(--live);
  opacity: 0.85;
  display: flex;
}

.err-msg {
  font-family: var(--font-d);
  font-size: 15px;
  color: var(--chalk-dim);
  text-align: center;
  max-width: 240px;
}

.err-retry {
  margin-top: 4px;
  padding: 10px 26px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--chalk);
  border-radius: 8px;
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
}

.err-retry:hover {
  background: rgba(255,255,255,0.1);
}

.err-retry:active {
  transform: scale(0.95);
}

.touch-vol-hud {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.touch-vol-hud.show {
  opacity: 1;
}

.tvh-icon {
  font-size: 17px;
  line-height: 1;
}

.tvh-bar {
  width: 4px;
  height: 72px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.tvh-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--turf);
  border-radius: 3px;
  transition: height 0.08s;
}

.match-card {
  padding: 20px 18px 18px;
}

.mc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--live-dim);
  border: 1px solid rgba(255,60,60,0.25);
  margin-bottom: 11px;
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: 0.9px;
  color: var(--live);
}

.mc-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.mc-title {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--chalk);
  margin-bottom: 6px;
  line-height: 1.2;
}

.mc-meta {
  font-size: 13px;
  color: var(--chalk-dim);
  font-family: var(--font-b);
}

.footer {
  padding: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.footer-brand {
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 600;
  color: var(--chalk-dim);
}

.footer-sep {
  color: var(--chalk-faint);
  font-size: 13px;
}

.footer-copy {
  font-size: 12px;
  color: var(--chalk-dim);
}

.player-container:fullscreen,
.player-container:-webkit-full-screen {
  aspect-ratio: unset;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.player-container:fullscreen #fwVideo,
.player-container:-webkit-full-screen #fwVideo {
  object-fit: contain;
}

@media (min-width: 640px) {
  .main {
    padding: 0 20px;
  }
  .player-container {
    border-radius: var(--r);
  }
  .match-card {
    padding: 22px 4px 20px;
  }
  .mc-title {
    font-size: 26px;
  }
  .footer {
    padding: 20px 4px;
  }
}

@media (min-width: 1024px) {
  .main {
    padding: 0 24px;
  }
  .match-card {
    padding: 24px 0 22px;
  }
}

@media (max-width: 360px) {
  .brand-name {
    font-size: 16px;
  }
  .ctrl-btn {
    width: 36px;
    height: 36px;
  }
  .live-pill {
    padding: 0 8px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot, .mc-dot, .lpip, .loading-ring, .buffer-ring {
    animation: none;
  }
}