:root {
  --bg-from: #ff7ea3;
  --bg-via: #ff3d77;
  --bg-to: #c81d5a;
  --card: rgba(0, 0, 0, 0.55);
  --card-hover: rgba(0, 0, 0, 0.75);
  --card-active: #ffffff;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.78);
  --text-on-light: #1a1a1a;
  --accent: #00d27a;
  --offline: #ff4d4d;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-via) 45%, var(--bg-to) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px 28px 48px;
}

.page-header {
  text-align: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.page-subtitle {
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 400;
  margin: 0;
  color: var(--text-muted);
}

.now-playing {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
  margin: 0 0 16px;
  text-align: center;
}

.player-grid {
  display: grid;
  /* events column first → renders on the right side under dir="rtl" */
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.player-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-frame {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow);
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.video-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.overlay-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.overlay-card p {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.video-banner {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  background: linear-gradient(90deg, rgba(0, 30, 90, 0.85), rgba(0, 70, 160, 0.85));
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: clamp(12px, 1.3vw, 16px);
  pointer-events: none;
  display: none;
}

.video-banner.visible {
  display: block;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 4px 0;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.live-pill.offline {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 210, 122, 0.7);
  animation: pulse 1.6s infinite;
}

.live-pill.offline .live-dot {
  background: var(--offline);
  animation: none;
  box-shadow: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 122, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(0, 210, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 210, 122, 0); }
}

.player-description {
  margin: 0;
  flex: 1;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.refresh-btn:hover { background: rgba(0, 0, 0, 0.55); }
.refresh-btn svg { transition: transform 0.6s ease; }
.refresh-btn.spinning svg { transform: rotate(360deg); }

.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
  padding-left: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.event-list::-webkit-scrollbar {
  width: 6px;
}
.event-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
}

.event-card {
  background: var(--card);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: right;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: transform 0.12s ease, background 0.12s ease;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.event-card:hover {
  background: var(--card-hover);
  transform: translateY(-1px);
}

.event-card.active {
  background: var(--card-active);
  color: var(--text-on-light);
}

.event-card .event-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.event-card .event-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-card .event-status {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

.event-card .status-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--offline);
}

.event-card.live .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 210, 122, 0.6);
  animation: pulse 1.8s infinite;
}

.page-footer {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.admin-link {
  text-decoration: none;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.admin-link:hover {
  background: rgba(0, 0, 0, 0.45);
}

/* iPad / tablet / phone — single column, events as button grid under the player */
@media (max-width: 1024px) {
  .player-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .event-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-height: none;
    overflow: visible;
    padding-left: 0;
  }
  .event-card {
    flex: unset;
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: 64px;
    border-radius: 12px;
  }
  .event-card .event-info {
    width: 100%;
    flex-direction: column;
    gap: 2px;
  }
  .event-card .event-name {
    font-size: 13px;
    font-weight: 700;
    width: 100%;
  }
  .event-card .event-status {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
  }
  .event-card .status-dot {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
  }
  .event-card { position: relative; }
}

@media (max-width: 720px) {
  .event-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .page { padding: 18px 14px 28px; }
  .page-footer { flex-direction: column; gap: 10px; }
  .event-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-meta { gap: 10px; }
}

/* Embed mode - minimal chrome */
body.embed {
  background: #000;
}
body.embed .page {
  padding: 0;
  max-width: none;
}
body.embed .page-header,
body.embed .page-footer,
body.embed .now-playing,
body.embed .player-meta {
  display: none;
}
body.embed .player-grid {
  grid-template-columns: 1fr;
  gap: 0;
}
body.embed .event-list {
  display: none;
}
body.embed .video-frame {
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
  height: 100vh;
}
