/* ==========================================================================
   F1 Live Relay — Custom Theme & Custom Video Player Styling
   ========================================================================== */

:root {
  --bg-dark: #0a0c10;
  --bg-card: #12151e;
  --bg-card-hover: #181d2a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(225, 6, 0, 0.5);
  
  --f1-red: #e10600;
  --f1-red-glow: rgba(225, 6, 0, 0.4);
  --f1-cyan: #00f0ff;
  --live-green: #30d158;
  --warn-orange: #ff9f0a;
  
  --text-main: #f5f6fa;
  --text-muted: #8b92a2;
  --text-dim: #545b6d;

  --player-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(14, 18, 26, 0.82);
  --glass-border: rgba(255, 255, 255, 0.1);
  --blur: blur(16px);
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Courier New", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(225, 6, 0, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0, 240, 255, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 12, 16, 0.9);
  backdrop-filter: var(--blur);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.f1-stripe {
  width: 5px;
  height: 28px;
  background: var(--f1-red);
  box-shadow: 0 0 12px var(--f1-red-glow);
  border-radius: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fff;
}

.brand-name .accent {
  color: var(--f1-red);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.header-center {
  display: flex;
  align-items: center;
}

.current-channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 8px var(--live-green);
}

.channel-quality {
  background: rgba(225, 6, 0, 0.2);
  color: #ff5e57;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn-orange);
  box-shadow: 0 0 8px var(--warn-orange);
  transition: background 0.3s, box-shadow 0.3s;
}

.status-indicator.online .status-dot {
  background: var(--live-green);
  box-shadow: 0 0 8px var(--live-green);
}

.status-indicator.online .status-text {
  color: var(--live-green);
}

.status-indicator.offline .status-dot {
  background: var(--f1-red);
  box-shadow: 0 0 8px var(--f1-red);
}

.status-indicator.offline .status-text {
  color: var(--f1-red);
}

/* ==========================================================================
   Buttons & UI Elements
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  color: var(--text-main);
  background: transparent;
  user-select: none;
}

.btn-primary {
  background: var(--f1-red);
  color: #fff;
  box-shadow: 0 4px 14px var(--f1-red-glow);
}

.btn-primary:hover {
  background: #ff1a14;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(225, 6, 0, 0.6);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ==========================================================================
   Main Layout & Custom Video Player
   ========================================================================== */

.main-content {
  flex: 1;
  padding-top: 24px;
  padding-bottom: 40px;
}

.player-section {
  width: 100%;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

/* Theater Mode Container */
.player-section.theater-mode {
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding: 0;
}

.player-section.theater-mode .custom-player-wrapper {
  border-radius: 0;
  max-height: 85vh;
}

/* Custom Player Wrapper */
.custom-player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--player-shadow);
  border: 1px solid var(--border-color);
  user-select: none;
}

.custom-player-wrapper:fullscreen {
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
}

.custom-player-wrapper:-webkit-full-screen {
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
}

/* Hide cursor when controls are inactive in fullscreen */
.custom-player-wrapper.hide-cursor {
  cursor: none;
}

#video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Big Center Play/Pause Ripple Button */
.big-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 80px;
  height: 80px;
  background: rgba(14, 18, 26, 0.7);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.big-center-btn .icon {
  width: 36px;
  height: 36px;
  fill: #fff;
  margin-left: 4px;
  transition: fill 0.2s;
}

.big-center-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--f1-red);
  border-color: var(--f1-red);
  box-shadow: 0 0 25px var(--f1-red-glow);
}

.custom-player-wrapper.playing .big-center-btn {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
}

/* Spinner Overlay */
.spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.spinner-overlay.active {
  opacity: 1;
  pointer-events: none;
}

.f1-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.f1-tire {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--f1-red);
  border-right-color: var(--f1-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  box-shadow: 0 0 20px var(--f1-red-glow);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-main);
}

/* Error Overlay */
.error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
}

.error-overlay.active {
  display: flex;
}

.error-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--player-shadow);
}

.error-icon {
  width: 48px;
  height: 48px;
  fill: var(--f1-red);
}

.error-box h3 {
  font-size: 1.2rem;
  color: #fff;
}

.error-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* "Stats for Nerds" Overlay */
.stats-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(10, 14, 20, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: 10px;
  z-index: 25;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  width: 340px;
  display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.stats-overlay.active {
  display: block;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  color: var(--f1-cyan);
  letter-spacing: 1px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.stats-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.stats-close:hover {
  color: #fff;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
}

.stat-name {
  color: var(--text-muted);
}

.stat-val {
  color: #fff;
  font-weight: 600;
}

.stat-hash {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Custom Player Controls Bar
   ========================================================================== */

.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
  padding: 30px 16px 14px 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-player-wrapper:hover .player-controls,
.custom-player-wrapper.controls-visible .player-controls {
  opacity: 1;
  pointer-events: auto;
}

/* Scrub / Timeline Bar */
.timeline-container {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: height 0.15s ease;
}

.timeline-container:hover {
  height: 9px;
}

.timeline-buffered {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  pointer-events: none;
}

.timeline-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background: var(--f1-red);
  box-shadow: 0 0 8px var(--f1-red-glow);
  border-radius: 4px;
  pointer-events: none;
}

.timeline-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--f1-red);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,0,0,0.8);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.timeline-container:hover .timeline-handle {
  transform: translate(-50%, -50%) scale(1);
}

.timeline-tooltip {
  position: absolute;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(14, 18, 26, 0.9);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: #fff;
  border: 1px solid var(--border-color);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.timeline-container:hover .timeline-tooltip {
  opacity: 1;
}

/* Controls Row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Control Buttons */
.ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  outline: none;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: scale(1.08);
}

.ctrl-btn .icon {
  width: 22px;
  height: 22px;
}

.btn-label-desktop {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Play / Pause Toggle */
#btn-play-pause .icon-pause {
  display: none;
}

.custom-player-wrapper.playing #btn-play-pause .icon-play {
  display: none;
}

.custom-player-wrapper.playing #btn-play-pause .icon-pause {
  display: block;
}

/* Live Badge Button */
.live-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(225, 6, 0, 0.15);
  border: 1px solid rgba(225, 6, 0, 0.4);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.live-badge-btn:hover {
  background: rgba(225, 6, 0, 0.3);
  transform: scale(1.05);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--f1-red);
  box-shadow: 0 0 8px var(--f1-red);
}

.live-badge-btn.synced .live-dot {
  background: var(--f1-red);
  animation: pulse 1.5s infinite;
}

.live-badge-btn.behind {
  background: rgba(255, 159, 10, 0.2);
  border-color: rgba(255, 159, 10, 0.5);
}

.live-badge-btn.behind .live-dot {
  background: var(--warn-orange);
  box-shadow: 0 0 8px var(--warn-orange);
  animation: none;
}

.live-text {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Volume Container */
.volume-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-slider-wrapper {
  width: 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
}

.volume-container:hover .volume-slider-wrapper {
  width: 80px;
  margin-left: 4px;
  margin-right: 4px;
}

.volume-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}

.volume-text {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  display: none;
}

.volume-container:hover .volume-text {
  display: inline-block;
}

/* Volume Icons State */
#btn-mute .icon-vol-low,
#btn-mute .icon-vol-mute {
  display: none;
}

.volume-state-low #btn-mute .icon-vol-high { display: none; }
.volume-state-low #btn-mute .icon-vol-low { display: block; }
.volume-state-low #btn-mute .icon-vol-mute { display: none; }

.volume-state-muted #btn-mute .icon-vol-high { display: none; }
.volume-state-muted #btn-mute .icon-vol-low { display: none; }
.volume-state-muted #btn-mute .icon-vol-mute { display: block; }

/* Audio Booster Button */
.booster-btn {
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.boost-badge {
  font-size: 0.7rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--f1-cyan);
}

.booster-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.4);
}

/* Fullscreen Button Toggle */
#btn-fullscreen .icon-fs-exit {
  display: none;
}

.custom-player-wrapper:fullscreen #btn-fullscreen .icon-fs-enter {
  display: none;
}
.custom-player-wrapper:fullscreen #btn-fullscreen .icon-fs-exit {
  display: block;
}

/* Audio Track Switcher */
.audio-track-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.audio-track-btn {
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.audio-track-label {
  font-size: 0.7rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--f1-cyan);
}

.audio-track-menu {
  position: absolute;
  bottom: 40px;
  left: 0;
  background: rgba(18, 22, 32, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 240px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  display: none;
  flex-direction: column;
  z-index: 50;
}

.audio-track-menu.active {
  display: flex;
}

.audio-menu-header {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding: 6px 14px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

.audio-menu-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.audio-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.audio-menu-item.active {
  color: var(--f1-cyan);
}

.item-radio {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
}

.audio-menu-item.active .item-radio {
  border-color: var(--f1-cyan);
  background: var(--f1-cyan);
  box-shadow: 0 0 6px var(--f1-cyan);
}

/* ==========================================================================
   Meta & Info Sections Below Player
   ========================================================================== */

.meta-section {
  margin-bottom: 24px;
}

.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.stream-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.tag-f1 {
  background: rgba(225, 6, 0, 0.15);
  border-color: rgba(225, 6, 0, 0.4);
  color: #ff5247;
}

.tag-live {
  background: rgba(48, 209, 88, 0.15);
  border-color: rgba(48, 209, 88, 0.4);
  color: var(--live-green);
}

.actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.stream-id-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.id-label {
  color: var(--text-muted);
  font-weight: 600;
}

.id-code {
  font-family: var(--font-mono);
  color: var(--f1-cyan);
  word-break: break-all;
}

/* Telemetry Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.info-grid.single-card {
  grid-template-columns: 1fr;
  max-width: 640px;
  margin: 0 auto;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  gap: 16px;
}

.card-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.card-content h3 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 6px;
}

.card-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.card-meta {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.card-meta strong {
  color: var(--text-main);
}

.hotkeys-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  color: #fff;
  font-size: 0.7rem;
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--player-shadow);
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.15rem;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--f1-red);
  box-shadow: 0 0 0 2px var(--f1-red-glow);
}

.presets-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.presets-section label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-feedback {
  font-size: 0.8rem;
  min-height: 20px;
}

.modal-feedback.error {
  color: #ff453a;
}

.modal-feedback.success {
  color: var(--live-green);
}

.modal-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  background: rgba(18, 22, 32, 0.95);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--f1-red);
  padding: 12px 18px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
  .header-center {
    display: none;
  }
  
  .btn-label-desktop {
    display: none;
  }
  
  .meta-card {
    padding: 16px;
  }

  .meta-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions-group {
    width: 100%;
  }

  .actions-group .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 8px 10px;
  }
}

/* ==========================================================================
   Channels Section
   ========================================================================== */
.channels-section {
  margin-bottom: 20px;
}

.channels-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.channels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.channels-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: #fff;
}

.channels-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.channel-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #fff;
  position: relative;
}

.channel-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.channel-btn.active {
  background: rgba(225, 6, 0, 0.12);
  border-color: var(--f1-red);
  box-shadow: 0 0 15px rgba(225, 6, 0, 0.25);
}

.channel-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.channel-name {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.channel-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.channel-btn.active .channel-badge {
  background: var(--f1-red);
  color: #fff;
}

.channel-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ==========================================================================
   F1 Access Gate & Token Auth
   ========================================================================== */

.btn-auth-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(225, 6, 0, 0.15);
  border: 1px solid rgba(225, 6, 0, 0.4);
  color: #ff6b66;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-auth-lock .icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn-auth-lock:hover {
  background: rgba(225, 6, 0, 0.3);
  border-color: var(--f1-red);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(225, 6, 0, 0.3);
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #090b10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: authFadeIn 0.3s ease;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-gate-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #11141d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 30px 28px 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  text-align: center;
  animation: authSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authSlideUp {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.auth-photo-wrap {
  width: 100%;
  max-width: 220px;
  height: 180px;
  margin: 0 auto 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  background: #000;
}

.auth-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

@keyframes authSlideUp {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.auth-card-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e10600, #ff4136, #e10600);
  background-size: 200% 100%;
  animation: stripeShimmer 3s infinite linear;
}

@keyframes stripeShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 18px;
}

.badge-f1 {
  font-weight: 900;
  color: var(--f1-red);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  height: 48px;
  background: #090b10;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0 48px 0 16px;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.auth-input:focus {
  border-color: var(--f1-red);
  box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.25);
  background: #0d1017;
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.btn-toggle-eye:hover {
  color: #fff;
}

.btn-toggle-eye .icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.auth-remember-label input[type="checkbox"] {
  accent-color: var(--f1-red);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.auth-error-msg {
  background: rgba(225, 6, 0, 0.15);
  border: 1px solid rgba(225, 6, 0, 0.35);
  color: #ff736e;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 6px;
  text-align: center;
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.btn-auth-submit {
  height: 48px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  background: var(--f1-red);
  box-shadow: 0 4px 15px rgba(225, 6, 0, 0.35);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-auth-submit:hover {
  background: #f00700;
  box-shadow: 0 6px 22px rgba(225, 6, 0, 0.5);
  transform: translateY(-1px);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.btn-auth-submit .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}


