/* ==========================================================================
   MatchPulse Live - Theme Stylesheet (Powered by MySportsLive Core)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  --bg: #07090e; 
  --bg2: #0c101a; 
  --card: #111624; 
  --card-h: #182033; 
  --line: rgba(255, 255, 255, 0.08);
  --text: #f8fafc; 
  --muted: #94a3b8; 
  --accent: #ef4444; 
  --accent-glow: rgba(239, 68, 68, 0.35);
  --accent2: #f59e0b; 
  --ok: #10b981;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { 
  margin: 0; 
  background: var(--bg); 
  color: var(--text);
  font: 14.5px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

h1, h2, h3, h4, .brand {
  font-family: 'Outfit', sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
select { 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: 999px; 
  padding: 7px 14px; 
  font-size: 13px; 
  outline: none;
}
select:focus { border-color: var(--accent); }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
body.mvmode .wrap.main { max-width: none; }

/* ---------- Top Match Ticker ---------- */
.ticker-bar {
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 1px solid var(--line);
  padding: 6px 16px;
  overflow: hidden;
  font-size: 12px;
}
.ticker-wrap {
  overflow: hidden;
  white-space: nowrap;
}
.ticker-move {
  display: inline-flex;
  gap: 1.25rem;
  animation: ticker-slide 42s linear infinite;
}
.ticker-wrap:hover .ticker-move {
  animation-play-state: paused;
}
@keyframes ticker-slide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11.5px;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-ring 1.4s infinite;
}
@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* ---------- Header ---------- */
header { 
  position: sticky; 
  top: 0; 
  z-index: 30; 
  background: rgba(12, 16, 26, 0.95);
  backdrop-filter: blur(14px); 
  border-bottom: 1px solid var(--line); 
}
.bar { display: flex; align-items: center; gap: 16px; height: 64px; }
body.mvmode .bar { max-width: none; }

.brand { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  font-weight: 900; 
  font-size: 21px;
  letter-spacing: -0.02em; 
  white-space: nowrap; 
}
.brand i { 
  width: 32px; 
  height: 32px; 
  border-radius: 9px; 
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  display: grid; 
  place-items: center; 
  font-style: normal; 
  font-size: 13px;
  box-shadow: 0 0 15px var(--accent-glow);
}
.brand b { color: var(--accent); }
.brand .live-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--accent);
  border-radius: 4px;
  letter-spacing: 0.5px;
}

nav.tabs { 
  display: flex; 
  gap: 4px; 
  background: var(--bg2); 
  padding: 4px; 
  border-radius: 999px; 
  border: 1px solid var(--line);
}
nav.tabs button { 
  border: 0; 
  background: none; 
  padding: 7px 16px; 
  border-radius: 999px;
  color: var(--muted); 
  font-weight: 700; 
  font-size: 13px;
  white-space: nowrap; 
  transition: all 0.2s ease;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button.on { 
  background: var(--accent); 
  color: #fff; 
  box-shadow: 0 0 15px var(--accent-glow);
}
nav.tabs .n { 
  font-size: 11px; 
  opacity: .85; 
  margin-left: 4px; 
  font-weight: 600;
}

.search { flex: 1; min-width: 0; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.search input { 
  width: 100%; 
  max-width: 340px; 
  background: var(--bg2); 
  border: 1px solid var(--line);
  border-radius: 999px; 
  padding: 9px 16px; 
  outline: none; 
  font-size: 13px;
  transition: border-color 0.2s;
}
.search input:focus { border-color: var(--accent); }

/* ---------- Settings ---------- */
.settings { position: relative; }
.settings .panel { 
  position: absolute; 
  right: 0; 
  top: 48px; 
  width: 310px; 
  background: var(--bg2); 
  border: 1px solid var(--line);
  border-radius: var(--radius); 
  padding: 16px; 
  display: grid; 
  gap: 12px; 
  box-shadow: 0 25px 60px rgba(0,0,0,.7); 
  z-index: 40; 
}
.settings label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.settings label.row { display: flex; align-items: center; gap: 8px; color: var(--text); }
.settings select { width: 100%; border-radius: 8px; }
.settings small { color: var(--muted); font-size: 11px; line-height: 1.35; }

/* ---------- Buttons ---------- */
.btn { 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: 999px; 
  padding: 8px 15px;
  font-size: 13px; 
  font-weight: 700; 
  display: inline-flex; 
  gap: 6px; 
  align-items: center; 
  text-decoration: none; 
  white-space: nowrap; 
  transition: all 0.15s ease;
}
.btn:hover { background: var(--card-h); border-color: rgba(255, 255, 255, 0.2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 15px var(--accent-glow); }
.btn.primary:hover { background: #dc2626; border-color: #dc2626; }
.btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.fav-on { color: var(--accent2); border-color: var(--accent2); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.ico { 
  width: 30px; 
  height: 30px; 
  border-radius: 50%; 
  border: 0; 
  background: rgba(11,14,20,.8); 
  color: #fff;
  display: grid; 
  place-items: center; 
  font-size: 14px; 
  text-decoration: none; 
  flex: none; 
  transition: all 0.15s ease;
}
.ico:hover { background: var(--accent); }
.ico.fav-on { color: var(--accent2); }

/* ---------- Player Section ---------- */
#player { display: none; padding: 18px 0 10px; }
#player.show { display: block; }
.stage { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; }

.screen { 
  position: relative; 
  aspect-ratio: 16/9; 
  background: #000; 
  border-radius: var(--radius);
  overflow: hidden; 
  border: 1px solid var(--line); 
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.8);
}
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.launch { 
  position: absolute; 
  inset: 0; 
  display: none; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center;
  gap: 14px; 
  text-align: center; 
  padding: 20px; 
  background: radial-gradient(ellipse at center, #1c2436 0%, #07090d 80%); 
}
.screen.ch { aspect-ratio: auto; min-height: clamp(340px, 44vw, 640px); }
.screen.ch .launch { display: flex; position: relative; min-height: inherit; }
.screen.ch iframe { display: none; }
.launch .logo { width: min(260px, 50%); aspect-ratio: 16/9; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.launch .logo .ini { font-size: 36px; }
.launch h3 { margin: 0; font-size: clamp(20px, 3vw, 30px); font-weight: 800; }
.launch p { margin: 0; color: var(--muted); font-size: 13px; max-width: 520px; }
.launch .btn.primary { font-size: 15px; padding: 11px 24px; }

.srcbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.srcbar .lbl { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-right: 4px; }
.srcbtn { 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: 8px; 
  padding: 6px 12px; 
  font-size: 12px; 
  font-weight: 700;
  display: inline-flex; 
  gap: 6px; 
  align-items: center; 
  transition: all 0.15s ease;
}
.srcbtn:hover { background: var(--card-h); border-color: rgba(255, 255, 255, 0.2); }
.srcbtn.on { border-color: var(--accent); background: rgba(239, 68, 68, 0.15); color: #fff; }
.prov { font-size: 9px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 2px 5px; border-radius: 4px; background: var(--line); color: var(--muted); }
.prov.damitv { background: #1d3a5c; color: #8cc4ff; }
.prov.cinevid { background: #4a1f2a; color: #ff9aac; }
.prov.ntv { background: #3d3214; color: #ffd36e; }

.np { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; }
.np .logo { width: 72px; height: 46px; border-radius: 6px; }
.np h2 { margin: 0; font-size: 22px; font-weight: 800; }
.np .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.np .grow { flex: 1; min-width: 180px; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Sidebar & Tabs ---------- */
.side { 
  background: var(--bg2); 
  border: 1px solid var(--line); 
  border-radius: var(--radius);
  display: flex; 
  flex-direction: column; 
  min-height: 0; 
  max-height: calc((100vw - 32px - 340px) * 9 / 16 + 130px); 
  overflow: hidden;
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
}
.side-tab-btn {
  flex: 1;
  padding: 11px 8px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.side-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent);
  background: rgba(255, 255, 255, 0.02);
}

.side ul, .pick ul { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.side li button, .pick li button { 
  width: 100%; 
  display: flex; 
  gap: 10px; 
  align-items: center; 
  text-align: left;
  background: none; 
  border: 0; 
  padding: 8px 10px; 
  border-radius: 8px; 
  transition: background 0.12s;
}
.side li button:hover, .side li button.cur, .pick li button:hover { background: var(--card-h); }
.side li .logo, .pick li .logo { width: 44px; height: 28px; flex: none; }
.side li small, .pick li small { display: block; color: var(--muted); font-size: 11px; }

/* Fan Chat Inside Sidebar */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.chat-msg {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  animation: fadeInMsg 0.2s ease-out;
}
.chat-msg.self {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}
.chat-msg .user {
  font-weight: 700;
  color: #cbd5e1;
  margin-right: 6px;
}
.chat-msg.self .user { color: #f87171; }
.chat-msg .time {
  font-size: 10px;
  color: var(--muted);
  float: right;
}
.chat-msg .text {
  margin: 2px 0 0;
  color: #e2e8f0;
  line-height: 1.35;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-form {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.tip { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.tip kbd { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 11px; }

/* ---------- Adsterra Containers (Zero CLS) ---------- */
.ad-slot-container {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
  position: relative;
  transition: border-color 0.2s ease;
  overflow: hidden;
}
.ad-slot-container:hover { border-color: rgba(239, 68, 68, 0.4); }
.ad-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive Adsterra Unit Displays */
.ad-box-468 {
  min-width: 468px;
  min-height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.ad-box-320 {
  min-width: 320px;
  min-height: 50px;
  display: none;
  justify-content: center;
  align-items: center;
}
@media (max-width: 520px) {
  .ad-box-468 { display: none !important; }
  .ad-box-320 { display: flex !important; }
}

/* Floating Bottom Ad Bar */
.social-bar-float {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 100%;
  max-width: 980px;
  background: rgba(12, 16, 26, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 10px 16px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.75);
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.social-bar-float.closed { transform: translate(-50%, 100%); }

/* ---------- Filters & Rails ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 18px 0 10px; }
.chk { 
  display: inline-flex; 
  gap: 6px; 
  align-items: center; 
  cursor: pointer; 
  user-select: none;
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: 999px; 
  padding: 7px 14px; 
  font-size: 13px; 
  font-weight: 600;
}
.chk input { accent-color: var(--accent); margin: 0; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }
.rail { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: thin; }
.pill { 
  flex: none; 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  background: var(--card);
  border: 1px solid var(--line); 
  border-radius: 999px; 
  padding: 7px 14px; 
  font-size: 13px; 
  font-weight: 700; 
  white-space: nowrap; 
  transition: all 0.15s ease;
}
.pill:hover { background: var(--card-h); border-color: rgba(255, 255, 255, 0.2); }
.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill .c { font-size: 11px; opacity: .7; font-weight: 600; }
.flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; flex: none; display: inline-block; }
.globe { font-size: 14px; line-height: 1; }

/* ---------- Channel Grid & Cards ---------- */
h2.sec { font-size: 19px; font-weight: 800; margin: 24px 0 12px; display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; padding-bottom: 30px; }
.card { 
  position: relative; 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: var(--radius);
  padding: 12px; 
  text-align: left; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
  transition: transform .18s, border-color .18s, box-shadow .18s; 
  cursor: pointer; 
}
.card:hover { 
  background: var(--card-h); 
  border-color: rgba(239, 68, 68, 0.45);
  transform: translateY(-3px); 
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.7), 0 0 15px -5px var(--accent-glow);
}
.card.cur { outline: 2px solid var(--accent); }
.card.off { opacity: .5; }

.logo { display: grid; place-items: center; background: linear-gradient(145deg, #1c2436, #121724); border-radius: 8px; overflow: hidden; }
.logo.lt { background: #f1f3f7; }
.card .logo { height: 86px; padding: 10px; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo.lt .ini { color: #1b2232; }
.logo .ini { color: var(--text); font-weight: 800; font-size: 18px; text-align: center; line-height: 1.1; padding: 2px; }
.card .t { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card .s { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card .acts { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .acts, .card:focus-within .acts { opacity: 1; }
.card .favmark { position: absolute; top: 12px; left: 12px; color: var(--accent2); font-size: 14px; text-shadow: 0 0 3px #000; }

.badge { font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; }
.badge.live { background: var(--accent); color: #fff; }
.badge.ns { background: var(--line); color: var(--text); }
.badge.ft { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge.off { background: #3a2a2a; color: #f99; }
.badge.here { background: #143a2a; color: var(--ok); }
.badge.tab { background: var(--line); color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.more { display: block; margin: 0 auto 40px; }

/* ---------- Events / Live Games ---------- */
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 14px; padding-bottom: 10px; }
.ev { 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: var(--radius); 
  padding: 14px;
  text-align: left; 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
  cursor: pointer; 
  transition: all 0.15s ease;
}
.ev:hover { 
  background: var(--card-h); 
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}
.ev.cur { outline: 2px solid var(--accent); }
.ev .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ev .top > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.team { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; min-width: 0; }
.team img, .team .ph { width: 42px; height: 42px; object-fit: contain; }
.team .ph { border-radius: 50%; background: var(--line); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.team span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.score { font-weight: 900; font-size: 22px; white-space: nowrap; font-family: 'Outfit', sans-serif; }
.when { font-size: 13px; color: var(--muted); white-space: pre-line; }
.ev .solo { font-weight: 700; font-size: 15px; }
.ev .foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------- Multiviewer ---------- */
.mvw { display: grid; grid-template-columns: 310px minmax(0,1fr); gap: 14px; padding: 14px 0 20px; height: calc(100vh - 65px); }
.mvw.nopick { grid-template-columns: minmax(0,1fr); }
.pick { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.pick .ph { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.pick .ph input { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; outline: none; width: 100%; }
.pick .seg { display: flex; gap: 4px; }
.pick .seg button { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px; font-size: 12px; font-weight: 700; }
.pick .seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick .hint { font-size: 11px; color: var(--muted); }
.pick li button.used { opacity: .5; }
.pick li .add { margin-left: auto; color: var(--muted); font-size: 18px; }

.mvmain { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.mvbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mvbar .layouts { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.mvbar .layouts button { border: 0; background: none; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 800; color: var(--muted); }
.mvbar .layouts button.on { background: var(--text); color: var(--bg); }

.mvgrid { flex: 1; min-height: 0; display: grid; gap: 8px; }
.mvgrid.l1 { grid-template: 1fr / 1fr; }
.mvgrid.l2 { grid-template: 1fr / 1fr 1fr; }
.mvgrid.l3 { grid-template: 1fr 1fr / 2fr 1fr; }
.mvgrid.l3 > :first-child { grid-row: span 2; }
.mvgrid.l4 { grid-template: 1fr 1fr / 1fr 1fr; }
.mvgrid.l5 { grid-template: 1fr 1fr 1fr / 3fr 1fr; }
.mvgrid.l5 > :first-child { grid-row: span 3; }
.mvgrid.l6 { grid-template: 1fr 1fr / 1fr 1fr 1fr; }
.mvgrid.l9 { grid-template: 1fr 1fr 1fr / 1fr 1fr 1fr; }

.tile { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #000;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile .th { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--bg2); border-bottom: 1px solid var(--line); min-width: 0; }
.tile .th .nm { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tile .th select { padding: 2px 6px; font-size: 11px; border-radius: 6px; max-width: 42%; }
.tile .th .ico { width: 24px; height: 24px; font-size: 12px; background: var(--card); }
.tile .th .ico:hover { background: var(--accent); }
.tile .vp { position: relative; flex: 1; min-height: 0; }
.tile .vp iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tile.vacant .vp { display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 10px;
  background: repeating-linear-gradient(45deg, #090c13, #090c13 10px, #0e131d 10px, #0e131d 20px); cursor: pointer; }
.tile.vacant .vp b { display: block; font-size: 28px; color: var(--text); }
.tile:fullscreen { border-radius: 0; border: 0; }

.note { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  color: var(--muted); font-size: 13px; margin-top: 16px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px); background: var(--text); color: var(--bg);
  padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: 13.5px; transition: transform .2s; z-index: 60; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 0 45px; border-top: 1px solid var(--line); }
body.mvmode footer, body.mvmode .note { display: none; }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #07090e; }
::-webkit-scrollbar-thumb { background: #1a2233; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .side { max-height: 320px; }
  .mvw { grid-template-columns: 1fr; height: auto; }
  .pick { max-height: 300px; }
  .mvgrid { display: flex; flex-direction: column; }
  .tile { flex: none; }
  .tile .vp { aspect-ratio: 16/9; flex: none; }
}

@media (max-width: 680px) {
  .bar { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .search input { max-width: none; }
  nav.tabs { margin-left: auto; }
  nav.tabs button { padding: 6px 12px; font-size: 12.5px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .card .logo { height: 70px; }
  .card .acts { opacity: 1; }
  .brand span { font-size: 18px; }
}
