:root {
  --bg: #000;
  --panel: rgba(12, 14, 20, 0.97);
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #3fa9f5;
  --focus-bg: rgba(63, 169, 245, 0.22);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}

#player {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.hidden { display: none !important; }

/* Channel banner (top) */
#banner {
  position: fixed;
  top: 48px;
  inset-inline-start: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 36px;
  background: var(--panel);
  border-radius: 16px;
  font-size: 40px;
  font-weight: 600;
}
#banner-num { color: var(--accent); font-variant-numeric: tabular-nums; }
#banner-logo { height: 64px; max-width: 160px; object-fit: contain; }
#banner-logo[src=""] { display: none; }

/* Status / errors (center) */
#status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 40px;
  background: var(--panel);
  border-radius: 16px;
  font-size: 34px;
  text-align: center;
}

/* Channel guide (side panel) */
#guide {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 620px;
  padding: 48px 32px 32px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}
#guide h1 { font-size: 44px; margin-bottom: 24px; padding-inline: 16px; }
#channel-list {
  list-style: none;
  flex: 1;
  overflow: hidden;
}
#channel-list li {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 88px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 34px;
  border: 3px solid transparent;
}
#channel-list li .num {
  width: 64px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#channel-list li img { height: 52px; width: 92px; object-fit: contain; }
#channel-list li.playing .name::after { content: "  ●"; color: #e5484d; font-size: 24px; }
#channel-list li.focused {
  background: var(--focus-bg);
  border-color: var(--accent);
}
#channel-list li .name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#channel-list li .pick {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--muted);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
#channel-list li .pick.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#channel-list li.split-row { border-bottom: 2px solid rgba(255,255,255,0.12); border-radius: 12px 12px 0 0; }
#channel-list li.split-row .num { color: var(--accent); }

/* Split screen */
#grid {
  position: fixed;
  inset: 0;
  display: grid;
  justify-content: center;
  align-content: center;
  background: #000;
}
.tile {
  position: relative;
  background: #0b0d12;
  border: 4px solid transparent;
  overflow: hidden;
}
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile.focused { border-color: var(--accent); }
.tile-label {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  padding: 6px 16px;
  border-radius: 10px;
  background: var(--panel);
  font-size: var(--label-size, 26px);
  font-weight: 600;
  white-space: nowrap;
  max-width: calc(100% - 28px);
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.tile-label.show { opacity: 1; }
.tile.focused .tile-label::after { content: "  🔊"; }
.tile.tile-error::after {
  content: "הערוץ לא זמין, מנסה שוב…";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  color: var(--muted);
}

.hint { margin-top: 16px; padding-inline: 16px; color: var(--muted); font-size: 26px; }

/* Start screen (only if autoplay with sound is blocked) */
#start {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}
#start-btn {
  font-size: 48px;
  padding: 28px 64px;
  border-radius: 16px;
  border: 4px solid var(--accent);
  background: var(--focus-bg);
  color: var(--text);
}
#start-btn:focus { outline: none; background: var(--accent); }
