:root {
  --dark: #1d1d1d;
  --dark-2: #101820;
  --dark-3: #0b1116;
  --red: #ff2a2a;
  --red-soft: #d91f1f;
  --text: #f1f1f1;
  --muted: #98a4ad;
  --pill: #202a31;
  --glass: rgba(12, 18, 24, 0.72);
  --panel: rgba(20, 22, 35, 0.88);
  --panel-soft: rgba(26, 28, 44, 0.85);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", sans-serif;
  color: var(--text);
  background: var(--dark);
  min-height: 100vh;
}

.page-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 42, 42, 0.2), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(0, 200, 255, 0.1), transparent 45%),
    linear-gradient(135deg, #0b1218 0%, #0f171d 40%, #0b1116 100%);
  z-index: -2;
}

.site-header {
  padding: 22px 0 12px;
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.9), rgba(10, 12, 20, 0));
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--red), #a40000);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.brand-title {
  font-size: 18px;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 3px;
}

.top-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-link {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.85;
}

.top-link:hover {
  opacity: 1;
}

.top-link-pill {
  background: var(--red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
}

.top-link-ghost {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 999px;
}

.main-content {
  padding-bottom: 60px;
}

.category-bar {
  margin-top: 6px;
  padding: 12px 0 8px;
  position: relative;
}

.category-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--red) transparent;
}

.category-scroll::-webkit-scrollbar {
  height: 6px;
}

.category-scroll::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 999px;
}

.category-pill {
  background: linear-gradient(180deg, #1a1f2f 0%, #121624 100%);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.category-pill span {
  font-weight: 600;
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 1px;
}

.category-pill.active {
  background: linear-gradient(180deg, #ff3b3b 0%, #c41515 100%);
  border-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.35);
}

.category-pill:hover {
  transform: translateY(-2px);
}

.category-underline {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  width: 100%;
  margin-top: 4px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 30px;
  align-items: start;
}

.sidebar-panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.sidebar-search {
  margin-bottom: 18px;
}

.search-input {
  background: rgba(14, 16, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 12px;
  height: 42px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title {
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  color: var(--red);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.panel-body {
  position: relative;
}

.panel-scroll {
  max-height: 620px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--red) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 999px;
}

.channel-card {
  background: rgba(18, 20, 32, 0.92);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: rise 0.5s ease forwards;
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 42, 42, 0.8);
  position: relative;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 42, 42, 0.7);
  animation: ping 1.4s ease infinite;
}

.event-time {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.event-time.live {
  color: #fff;
  text-transform: uppercase;
}

.channel-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #11181f;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--red);
}

.channel-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.channel-name {
  font-size: 14px;
  font-weight: 600;
}

.channel-country {
  font-size: 12px;
  color: var(--muted);
}

.watch-btn {
  background: var(--red);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
}

.watch-btn:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  cursor: not-allowed;
}

.player-panel {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  min-height: 620px;
  position: relative;
}

.player-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 560px;
  border-radius: 16px;
  background: rgba(16, 18, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.player-placeholder {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 20px;
}

.player-loading {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 16, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}

.player-loading.active {
  display: flex;
}

#playerFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}

#playerFrame.active {
  display: block;
}

.site-footer {
  padding: 30px 0 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 16px;
  align-items: center;
}

.footer-copy {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--red);
  font-size: 12px;
  text-decoration: none;
}

.footer-brand {
  text-align: right;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 14, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}

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

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-empty,
.panel-error {
  display: none;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.panel-empty.active,
.panel-error.active {
  display: block;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.login-card {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.login-title {
  font-family: "Rajdhani", sans-serif;
  font-size: 28px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-input {
  background: rgba(14, 16, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.login-button {
  width: 100%;
  background: var(--red);
  border: none;
  color: #fff;
  font-weight: 600;
}

.login-actions {
  margin-top: 20px;
}

.login-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

.account-panel {
  display: none;
  margin-top: 20px;
}

.account-panel.active {
  display: block;
}

.account-page {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 80px;
}

.account-card {
  background: rgba(16, 18, 30, 0.95);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.account-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.account-title {
  font-family: "Rajdhani", sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
}

.account-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.account-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.account-field {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.account-button {
  background: var(--red);
  border: none;
  color: #fff;
  font-weight: 600;
}

.account-button.is-secondary {
  background: rgba(255, 255, 255, 0.12);
}

.account-setup {
  display: none;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.account-setup.active {
  display: block;
}

.account-setup-title {
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  margin-bottom: 12px;
}

.account-setup-body {
  display: grid;
  gap: 12px;
}

.account-qr {
  width: 160px;
  height: 160px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}

.account-secret {
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 2px;
  font-size: 14px;
}

.account-hint {
  font-size: 12px;
  color: var(--muted);
}

.account-input {
  background: rgba(14, 16, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.account-message {
  font-size: 12px;
  color: var(--muted);
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

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

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

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

@keyframes ping {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.4);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 1024px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .player-panel {
    min-height: 360px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-brand {
    text-align: center;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-links {
    flex-wrap: wrap;
    gap: 10px;
  }

  .category-underline {
    width: 160px;
  }

  .panel-scroll {
    max-height: 420px;
  }
}

@media (max-width: 520px) {
  .brand-title {
    font-size: 16px;
  }

  .category-pill {
    padding: 8px 14px;
    font-size: 12px;
  }

  .channel-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .watch-btn {
    align-self: flex-end;
  }
}
