/* ===== 3Freet Live — Theme ===== */
:root {
  --bg: #07080c;
  --bg-2: #0b0d13;
  --surface: #10131b;
  --surface-2: #161a25;
  --surface-3: #1d2230;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #f1f2f6;
  --muted: #9097ab;
  --faint: #5d6378;
  --accent: #ff3b5c;
  --accent-2: #ff7a59;
  --amber: #ffb547;
  --ok: #2fd39a;
  --r-lg: 22px;
  --r: 16px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .85);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 85% -12%, rgba(255, 59, 92, .16), transparent 60%),
    radial-gradient(900px 480px at -5% 0%, rgba(92, 104, 255, .12), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--page-max, 1440px); margin-inline: auto; padding-inline: clamp(16px, 3vw, 32px); }

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7, 8, 12, .72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -8px rgba(255, 59, 92, .75);
}
.brand-mark svg { width: 18px; height: 18px; fill: #fff; }
.brand-name { direction: ltr; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand-name b { color: var(--accent); margin-inline-start: 3px; }
.top-meta { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding-inline: 12px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill svg { width: 15px; height: 15px; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.live { color: #fff; background: rgba(255, 59, 92, .14); border-color: rgba(255, 59, 92, .35); }
.pill.live .dot { background: var(--accent); animation: pulse 1.8s infinite; }
.pill.ok { color: var(--ok); background: rgba(47, 211, 154, .1); border-color: rgba(47, 211, 154, .3); }
.pill.closed { color: var(--amber); background: rgba(255, 181, 71, .1); border-color: rgba(255, 181, 71, .3); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 92, .6); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0); }
}

/* ===== Layout (مناطق قابلة للتعديل) ===== */
.layout {
  display: grid;
  grid-template-columns: var(--cols-wide, minmax(0, 1fr) var(--side-w, 370px));
  grid-template-areas: var(--areas-wide, "main side");
  gap: 24px 28px;
  padding-block: 24px 40px;
  align-items: start;
}
.slot { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.slot.empty, .slot:empty { display: none; }
.editing .slot:empty { display: flex; }
.slot[data-slot="top"] { grid-area: top; }
.slot[data-slot="main"] { grid-area: main; }
.slot[data-slot="side"] { grid-area: side; position: sticky; top: 92px; }
.slot[data-slot="bottom"] { grid-area: bottom; }
.blk { min-width: 0; position: relative; }
.blk[data-block="player"] { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: var(--areas-narrow, "main" "side"); }
  .slot[data-slot="side"] { position: static; }
}

/* ===== Ads / announcements ===== */
.ad .ad-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: var(--ad-justify, flex-start); gap: 14px;
  padding: var(--ad-pad, 14px) calc(var(--ad-pad, 14px) + 4px);
  border-radius: var(--r);
  background: var(--ad-bg, linear-gradient(270deg, rgba(255, 181, 71, .14), rgba(255, 181, 71, .04)));
  border: 1px solid rgba(255, 181, 71, .25);
  color: var(--ad-color, #ffe1ad); font-size: var(--ad-fs, 15px); line-height: 1.6;
  text-align: var(--ad-align, start); text-decoration: none; overflow: hidden;
}
.ad.no-border .ad-inner { border-color: transparent; }
.ad.bold p { font-weight: 700; }
.ad .ad-inner p { margin: 0; white-space: pre-line; flex: 1 1 200px; min-width: 0; }
.ad .ad-inner img { display: block; max-width: 100%; max-height: var(--ad-imgh, 220px); border-radius: calc(var(--r) - 4px); object-fit: contain; }
.ad.img-only .ad-inner { padding: 0; background: none; border: 0; }
.ad a.ad-inner:hover { filter: brightness(1.08); }
.ad .ad-empty { opacity: .7; font-size: 14px; }
.ad.marquee .ad-track { flex: 1 1 100%; overflow: hidden; min-width: 0; }
.ad.marquee .ad-track p { display: inline-block; white-space: nowrap; padding-inline-start: 100%; animation: marquee var(--ad-speed, 18s) linear infinite; }
@keyframes marquee { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.ad.float {
  position: fixed; z-index: 30; width: var(--fw, 340px); max-width: calc(100vw - 24px);
  left: max(12px, min(var(--fx), calc(100vw - min(var(--fw, 340px), calc(100vw - 24px)) - 12px)));
  top: max(12px, min(var(--fy), calc(100vh - 80px)));
}
.ad-close {
  position: absolute; z-index: 2; top: -10px; inset-inline-end: -10px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface-3); color: var(--text); box-shadow: var(--shadow);
}
.ad-close svg { width: 14px; height: 14px; }
.ad.float.dismissed { display: none !important; }
.ad.float .ad-inner { box-shadow: var(--shadow); }
.is-off[hidden] { display: none !important; }

h2 { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 600; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { display: block; font-size: 12px; font-weight: 600; color: var(--accent); }

/* ===== Announcement ===== */
.announce {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r);
  background: linear-gradient(270deg, rgba(255, 181, 71, .14), rgba(255, 181, 71, .04));
  border: 1px solid rgba(255, 181, 71, .25); color: #ffe1ad; font-size: 14px;
}
.announce svg { width: 20px; height: 20px; flex: none; color: var(--amber); }
.announce p { margin: 0; }

/* ===== Player ===== */
.player-card { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player:fullscreen { aspect-ratio: auto; }

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 24px; text-align: center; overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(20, 24, 36, .9), rgba(0, 0, 0, .96));
}
.overlay h3 { position: relative; margin: 14px 0 0; font-family: var(--display); font-weight: 600; font-size: clamp(18px, 2.4vw, 26px); }
.overlay p { position: relative; margin: 0; color: var(--muted); font-size: 14px; }
.ov-icon { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); border: 2px solid var(--line-2); }
.ov-icon svg { width: 28px; height: 28px; color: var(--muted); }
.overlay[data-state="loading"] .ov-icon { border-color: rgba(255, 255, 255, .08); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.overlay[data-state="loading"] .ov-icon svg { display: none; }
.overlay[data-state="demo"] {
  background:
    radial-gradient(55% 75% at 25% 20%, rgba(255, 59, 92, .38), transparent 60%),
    radial-gradient(55% 75% at 80% 90%, rgba(92, 104, 255, .38), transparent 60%),
    #05060a;
  background-size: 180% 180%;
  animation: drift 14s ease-in-out infinite alternate;
}
.overlay[data-state="demo"]::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 3px);
}
.overlay[data-state="demo"] .ov-icon { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); }
.overlay[data-state="demo"] .ov-icon svg { color: #fff; }
.overlay[data-state="demo"] h3 { font-size: clamp(24px, 4vw, 44px); font-weight: 700; }
.overlay[data-state="demo"] p { color: rgba(255, 255, 255, .7); }
@keyframes drift { to { background-position: 100% 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }

.unmute {
  position: absolute; bottom: 16px; inset-inline-start: 16px;
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 16px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 14px; font-weight: 600;
}
.unmute svg { width: 18px; height: 18px; }

.now { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.now-info { flex: 1; min-width: 0; }
.now h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(18px, 2vw, 22px); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-meta { display: block; color: var(--muted); font-size: 13px; }
.now-actions { display: flex; gap: 8px; }

.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ===== Channel badge ===== */
.badge {
  flex: none; position: relative; display: grid; place-items: center; overflow: hidden;
  color: #fff; font-family: var(--display); font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.badge img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }
.badge.sm { width: 40px; height: 40px; border-radius: 11px; font-size: 15px; }
.badge.md { width: 52px; height: 52px; border-radius: 14px; font-size: 19px; }
.badge.lg { width: 60px; height: 60px; border-radius: 16px; font-size: 22px; }

/* ===== Queue panel ===== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.queue { list-style: none; margin: 0; padding: 8px; max-height: calc(100vh - 210px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
@media (max-width: 1080px) { .queue { max-height: 360px; } }
.q-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; transition: background .2s; }
.q-item:hover { background: var(--surface-2); }
.q-item.next { background: linear-gradient(270deg, rgba(255, 59, 92, .13), transparent 85%); }
.q-rank { width: 20px; flex: none; text-align: center; font-weight: 700; font-size: 14px; color: var(--faint); font-variant-numeric: tabular-nums; }
.q-item.next .q-rank { color: var(--accent); }
.q-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-info strong { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-meta .next-tag { color: var(--accent); font-weight: 600; }

.vote {
  flex: none; min-width: 48px; height: 48px; padding-inline: 6px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 700; font-size: 13px; line-height: 1.1; font-variant-numeric: tabular-nums;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.vote svg { width: 14px; height: 14px; }
.vote:hover:not(:disabled) { border-color: rgba(255, 59, 92, .5); background: rgba(255, 59, 92, .12); }
.vote:active:not(:disabled) { transform: scale(.94); }
.vote.voted { color: var(--accent); border-color: rgba(255, 59, 92, .4); background: rgba(255, 59, 92, .1); cursor: default; }
.vote:disabled:not(.voted) { opacity: .5; cursor: not-allowed; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { color: var(--text); font-size: 15px; }

/* ===== Channels ===== */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 8px 0 14px; }
.section-head h2 { font-size: 22px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 44px; padding-inline: 14px; min-width: min(320px, 100%);
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: border-color .2s;
}
.search:focus-within { border-color: rgba(255, 59, 92, .5); }
.search svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; }
.search input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding-inline: 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; font-weight: 500; transition: color .2s, border-color .2s, background .2s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #0a0b10; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 30px 12px 16px; text-align: center; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .2s, border-color .2s, background .2s;
}
.card:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--line-2); }
.card-name { font-weight: 600; font-size: 15px; line-height: 1.35; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-tag {
  position: absolute; top: 9px; inset-inline-start: 9px;
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: rgba(255, 181, 71, .13); color: var(--amber);
}
.card-tag.live { background: var(--accent); color: #fff; }
.card.is-live { border-color: rgba(255, 59, 92, .55); background: linear-gradient(180deg, rgba(255, 59, 92, .12), var(--surface)); }
.grid-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); }

/* ===== Sheet ===== */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 4, 8, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s;
}
.sheet {
  width: min(440px, 100%); padding: 22px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: rise .25s ease;
}
@media (max-width: 560px) {
  .sheet-backdrop { place-items: end center; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-title { flex: 1; min-width: 0; }
.sheet h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 1.35; }
.sheet-note { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea {
  height: 46px; padding-inline: 14px; border-radius: 12px; outline: none;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 15px;
  transition: border-color .2s;
}
.field textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255, 59, 92, .6); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding-inline: 20px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2);
  font-weight: 600; transition: filter .2s, background .2s, border-color .2s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn.primary { width: 100%; border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 30px -12px rgba(255, 59, 92, .8); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.danger { color: #ff8a9c; border-color: rgba(255, 59, 92, .35); background: rgba(255, 59, 92, .08); }
.btn.sm { height: 36px; padding-inline: 12px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ===== Toasts ===== */
.toasts { position: fixed; z-index: 60; inset-inline: 0; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-inline: 16px; pointer-events: none; }
.toast {
  max-width: 440px; padding: 12px 18px; border-radius: 14px; pointer-events: auto;
  background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 500; animation: rise .25s;
}
.toast.ok { border-color: rgba(47, 211, 154, .45); }
.toast.err { border-color: rgba(255, 59, 92, .55); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-block: 24px 32px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 560px) {
  .topbar-in { height: 60px; }
  .brand-name { font-size: 18px; }
  .now { padding: 14px 16px; gap: 12px; }
  .search { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ===== Admin ===== */
.admin-main { padding-block: 24px 48px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.admin-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.box-note { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 180px; }
.current-box { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 16px; border-radius: 14px; background: var(--surface-2); }
.current-box strong { font-family: var(--display); font-size: 18px; font-weight: 600; }
.admin-q { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow: auto; }
.admin-q li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.admin-q .votes { min-width: 46px; text-align: center; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.admin-q .votes small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: 14px; background: var(--surface-2); font-weight: 500; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; width: 46px; height: 26px; flex: none; margin: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; }
.switch input:checked { background: var(--ok); border-color: var(--ok); }
.switch input:checked::after { inset-inline-start: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .wide { grid-column: span 2; }
@media (max-width: 700px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .wide { grid-column: auto; } }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td .row { flex-wrap: nowrap; }
.muted { color: var(--muted); }
.login-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { margin-bottom: 20px; }
select.field-like {
  height: 46px; padding-inline: 14px; border-radius: 12px; outline: none;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
}
select.field-like:focus { border-color: rgba(255, 59, 92, .6); }
a.btn { color: var(--text); text-decoration: none; }

/* ===== Visual editor (admin only) ===== */
.toasts { z-index: 80; }
.ed-fab {
  position: fixed; z-index: 55;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 20px;
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding-inline: 18px;
  border-radius: 999px; border: 0; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}
.ed-fab svg { width: 18px; height: 18px; }

body.editing { padding-inline-end: 380px; }
.editing .slot {
  min-height: 96px; padding: 44px 12px 12px; border-radius: var(--r);
  border: 1.5px dashed var(--line-2); position: relative;
}
.editing .slot::before {
  content: attr(data-label); position: absolute; top: 10px; inset-inline-start: 14px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.editing .slot.drop-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.editing .slot[data-slot="side"] { position: static; }
.editing #layout .blk { overflow: visible; outline: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 4px; border-radius: var(--r); margin-top: 38px; }
.editing #layout .blk.is-hidden, .editing .is-off { opacity: .4; }
.editing .blk.dragging { opacity: .35; }
.drop-marker { height: 4px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }

.blk-bar {
  position: absolute; z-index: 5; top: -40px; inset-inline-start: -2px;
  display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 4px;
  border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .6); font-size: 12px; white-space: nowrap;
}
.bb-name { padding-inline: 6px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bb-grip, .bb-btn {
  width: 28px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
}
.bb-grip { cursor: grab; color: var(--text); }
.bb-grip:active { cursor: grabbing; }
.bb-btn:hover, .bb-grip:hover { background: var(--surface-2); color: var(--text); }
.bb-grip svg, .bb-btn svg { width: 15px; height: 15px; }
.bb-del:hover, .bb-del.armed { color: #fff; background: var(--accent); }

.editing .ad.float { z-index: 65; resize: horizontal; overflow: hidden; outline-offset: 0; margin-top: 0; border-radius: var(--r); min-width: 120px; }
.editing .ad.float .blk-bar { position: relative; top: 0; inset-inline-start: 0; margin-bottom: 6px; width: max-content; max-width: 100%; }

.editing [contenteditable] { outline: 1px dashed transparent; outline-offset: 3px; border-radius: 4px; cursor: text; }
.editing [contenteditable]:hover { outline-color: var(--muted); }
.editing [contenteditable]:focus { outline: 2px solid var(--accent); }

.ed-panel {
  position: fixed; z-index: 60; top: 0; bottom: 0; inset-inline-end: 0; width: 380px;
  display: flex; flex-direction: column;
  background: var(--surface); border-inline-start: 1px solid var(--line-2);
  box-shadow: -20px 0 50px -30px rgba(0, 0, 0, .8);
  padding-top: env(safe-area-inset-top, 0px);
}
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ed-head strong { font-family: var(--display); font-size: 17px; }
.ed-dirty { display: block; font-size: 12px; color: var(--amber); }
.ed-tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ed-tabs button { flex: none; height: 34px; padding-inline: 12px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 14px; }
.ed-tabs button:hover { color: var(--text); background: var(--surface-2); }
.ed-tabs button[aria-selected="true"] { color: var(--text); background: var(--surface-3); }
.ed-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.ed-foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.ed-foot .btn { height: 42px; padding-inline: 10px; font-size: 14px; }
.ed-foot .btn.primary { width: auto; }
.ed-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.ed-group { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.ed-group h4 { margin: 0; font-size: 14px; font-weight: 600; }
.ed-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ed-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.ed-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.ed-cap { display: flex; justify-content: space-between; gap: 8px; }
.ed-cap output { color: var(--text); font-variant-numeric: tabular-nums; }
.ed-field input:not([type="checkbox"]):not([type="range"]):not([type="color"]), .ed-field select, .ed-field textarea, .ed-group > textarea, .ed-body > textarea {
  width: 100%; min-width: 0; height: 40px; padding-inline: 12px; border-radius: 10px; outline: none;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 14px;
}
.ed-field textarea, .ed-group > textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.ed-field textarea[dir="ltr"], .ed-group > textarea[dir="ltr"] { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.ed-field input:focus, .ed-field select:focus, .ed-field textarea:focus { border-color: var(--accent); }
.ed-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.ed-field input[type="color"] { width: 100%; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.ed-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.ed-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.ed-color { display: flex; gap: 6px; }
.ed-color input { flex: 1; min-width: 0; height: 36px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); }
.ed-add { width: 100%; }
.ed-ad { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.ed-ad[open] { display: flex; }
.ed-ad > * + * { margin-top: 10px; }
.ed-ad summary { cursor: pointer; font-weight: 600; color: var(--text); }
.ed-blocks { display: flex; flex-direction: column; gap: 10px; }
.ed-slot { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; border: 1px dashed var(--line-2); }
.ed-slot strong { font-size: 13px; }
.ed-muted { font-size: 12px; color: var(--faint); }
.ed-block-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.ed-block-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-block-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.ed-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ed-preset { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--text); }
.ed-preset:hover { border-color: var(--accent); }
.ed-swatch { width: 36px; height: 36px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.btn.armed { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 900px) {
  body.editing { padding-inline-end: 0; padding-bottom: 58vh; }
  .ed-panel { top: auto; height: 58vh; width: 100%; inset-inline: 0; border-inline-start: 0; border-top: 1px solid var(--line-2); border-radius: 18px 18px 0 0; }
  .ed-fab { inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
.ad.float .ad-inner { background: var(--ad-bg, color-mix(in srgb, var(--surface) 88%, #ffb547)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ed-body > * { flex-shrink: 0; }

/* ===== Site navigation ===== */
.topbar-in { gap: 20px; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-inline-end: auto; margin-inline-start: 18px; }
.site-nav a {
  height: 38px; display: inline-flex; align-items: center; padding-inline: 14px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; transition: color .2s, background .2s;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
@media (max-width: 720px) {
  .topbar-in { height: auto; min-height: 60px; flex-wrap: wrap; padding-block: 10px; row-gap: 8px; }
  .site-nav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .site-nav a { flex: 1; justify-content: center; padding-inline: 8px; }
}

/* ===== Tags ===== */
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding-inline: 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.tag svg { width: 14px; height: 14px; }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.tag.live { background: var(--accent); color: #fff; }
.tag.live .dot { animation: pulse 1.8s infinite; }
.tag.off { background: rgba(0, 0, 0, .55); color: #cfd3dc; }
.tag.st { background: var(--surface-3); color: var(--text); font-weight: 600; }

/* ===== Pages ===== */
.page { padding-block: 28px 48px; display: flex; flex-direction: column; gap: 26px; min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.25; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; align-self: flex-start; }
.back-link::before { content: "→ "; }
.back-link:hover { color: var(--text); }

/* ===== Stream cards ===== */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.stream-card {
  display: flex; flex-direction: column; text-align: start; padding: 0; overflow: hidden; color: var(--text); text-decoration: none;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transition: transform .2s, border-color .2s;
}
.stream-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.stream-card.is-live { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.stream-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.sc-thumb { position: relative; aspect-ratio: 16 / 9; max-width: 100%; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, var(--surface-3), #05060a); }
.sc-thumb .tag { position: absolute; top: 10px; inset-inline-start: 10px; }
.stream-card:not(.is-live) .sc-thumb .badge { filter: grayscale(.7); opacity: .7; }
.sc-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; min-width: 0; }
.sc-body strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Multiview ===== */
.mv-tools { display: flex; gap: 8px; align-items: center; }
.mv-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.mv-grid[data-count="2"], .mv-grid[data-count="3"], .mv-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .mv-grid[data-count] { grid-template-columns: minmax(0, 1fr); } }
.mv-grid[data-count="0"] { grid-template-columns: minmax(0, 1fr); }
.mv-empty { border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 60px 16px; }
.mv-tile { display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.mv-tile.has-audio { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.mv-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; }
.mv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-info strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-actions { display: flex; gap: 6px; }
.mv-actions .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.mv-snd { color: var(--muted); }
.mv-tile.has-audio .mv-snd { color: #fff; background: var(--accent); border-color: var(--accent); }
.mv-video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #000; }
.mv-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mv-video:fullscreen { aspect-ratio: auto; }
.mv-video .overlay h3 { font-size: 17px; }
.mv-pick { display: flex; flex-direction: column; gap: 4px; }

/* ===== Tournament cards ===== */
.tour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tour-section { display: flex; flex-direction: column; gap: 14px; }
.tour-section h2 { font-size: 20px; }
.tour-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); transition: transform .2s, border-color .2s;
}
.tour-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tour-card.st-live { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface)); }
.tour-card.st-finished { opacity: .78; }
.tc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); flex: none; }
.tc-icon svg { width: 22px; height: 22px; }
.tc-name { font-family: var(--display); font-size: 19px; font-weight: 600; line-height: 1.35; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.tc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tc-meta svg { width: 15px; height: 15px; flex: none; }
.tc-prize { margin: 0; font-size: 13px; font-weight: 600; color: var(--amber); }

/* ===== Tournament page ===== */
.tour-hero { display: flex; flex-direction: column; gap: 12px; padding: clamp(18px, 3vw, 28px); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.tour-hero h1 { margin: 0; font-family: var(--display); font-size: clamp(26px, 3.6vw, 40px); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.th-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.th-desc { margin: 0; color: var(--muted); max-width: 70ch; white-space: pre-line; }
.champion { display: flex; align-items: center; gap: 14px; margin-top: 6px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); align-self: flex-start; }
.champion .eyebrow { color: var(--amber); }
.champion strong { font-family: var(--display); font-size: 22px; }
.tabs { margin: 0; }
.live-strip { display: flex; flex-direction: column; gap: 12px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.live-match { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.lm-vs { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.lm-vs span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-vs span:last-child { text-align: end; }
.lm-score { padding: 2px 10px; border-radius: 8px; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.watch-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 12px; border-radius: 9px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text); background: var(--surface-3); white-space: nowrap; }
.watch-btn svg { width: 13px; height: 13px; }
.watch-btn.live { background: var(--accent); color: #fff; }

/* Bracket */
.bracket-scroll { overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.bracket { display: flex; gap: 28px; min-width: max-content; align-items: stretch; }
.b-round { display: flex; flex-direction: column; width: 230px; flex: none; }
.b-round h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
.b-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.b-match { position: relative; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.b-match.st-live { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.b-match.bye { opacity: .6; }
.b-row { display: flex; align-items: center; gap: 8px; height: 40px; padding-inline: 12px; font-size: 14px; }
.b-row + .b-row { border-top: 1px solid var(--line); }
.b-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-row .b-name:empty::before { content: "—"; }
.b-score { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.b-row.win { font-weight: 700; }
.b-row.win .b-score { color: var(--text); }
.b-row.lose { color: var(--faint); }
.b-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--bg-2); }
.b-foot .watch-btn { height: 28px; padding-inline: 10px; font-size: 12px; }

/* Standings */
.card-table { border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.standings th, .standings td { padding: 12px 10px; }
.standings .num { text-align: center; font-variant-numeric: tabular-nums; }
.standings .pts { font-weight: 700; color: var(--text); }
.standings tr.lead td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.st-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.standings tbody tr:last-child td { border-bottom: 0; }

/* Match list */
.match-rounds { display: flex; flex-direction: column; gap: 22px; }
.mr { display: flex; flex-direction: column; gap: 8px; }
.mr h3 { margin: 0 0 4px; font-size: 15px; color: var(--muted); font-weight: 600; }
.m-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.m-row.st-live { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.m-vs { flex: 1 1 320px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.m-p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.m-p:last-child { text-align: end; }
.m-p.win { font-weight: 700; }
.m-mid { min-width: 64px; text-align: center; padding: 4px 10px; border-radius: 8px; background: var(--surface-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.m-side { display: flex; align-items: center; gap: 10px; }

/* Players */
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pl-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.pl-card > div { display: flex; flex-direction: column; min-width: 0; }
.pl-card strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Admin: tabs, streams, tournaments ===== */
.admin-tabs { margin-bottom: 20px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid.two { grid-template-columns: minmax(0, 1fr); } }
.mtx { margin-top: 16px; }
.mtx summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
textarea.code { width: 100%; box-sizing: border-box; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font: 12.5px/1.6 ui-monospace, Menlo, Consolas, monospace; margin-bottom: 10px; resize: vertical; }
.hub-row { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.hub-row + .hub-row { margin-top: 10px; }
.hub-top { display: flex; align-items: center; gap: 12px; }
.hub-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hub-acts { gap: 6px; }
.obs-box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.obs-box .box-note { margin: 0; }
.kv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv > span { width: 110px; font-size: 13px; color: var(--muted); }
.kv input { flex: 1; min-width: 200px; height: 38px; padding-inline: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); font-size: 13px; }

.tour-admin { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .tour-admin { grid-template-columns: minmax(0, 1fr); } }
.tour-side { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 92px; }
@media (max-width: 900px) { .tour-side { position: static; } }
.tour-side .box-head { margin-bottom: 8px; }
.tour-pick { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 12px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); }
.tour-pick > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tour-pick strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-pick.on { border-color: var(--accent); }
.tour-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.tour-main textarea:not(.code) { width: 100%; box-sizing: border-box; min-height: 120px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 15px; line-height: 1.7; resize: vertical; margin-bottom: 12px; }
.am-round { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.am-round h3 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.am-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.am-row.st-live { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.am-row.st-done { opacity: .85; }
.am-row.bye { opacity: .55; }
.am-vs { flex: 1 1 360px; display: grid; grid-template-columns: minmax(0, 1fr) 64px auto 64px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; }
.am-p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.am-p.end { text-align: end; }
.am-p.win { font-weight: 700; color: var(--ok); }
.am-dash { color: var(--muted); }
.am-score { width: 100%; height: 38px; text-align: center; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-weight: 700; font-size: 16px; }
.am-ctr { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.am-ctr select, .am-ctr input { height: 36px; padding-inline: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; max-width: 190px; }
#paneStreams .btn.primary, #paneTours .btn.primary { width: auto; }
.tour-side .box-head .btn { flex: none; }
.live-match { display: grid; grid-template-columns: auto 1fr; align-items: center; }
.live-match .lm-vs { grid-column: 1 / -1; grid-row: 2; }
.live-match .watch-btn { justify-self: end; }

.score-box { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.score-box i { font-style: normal; color: var(--muted); font-weight: 500; }

/* ===== استوديو اللاعب وربط ديسكورد ===== */
:root { --discord: #5865f2; }
.badge.avatar img { object-fit: cover; padding: 0; background: none; }
.studio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.studio-wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .studio-grid { grid-template-columns: minmax(0, 1fr); } }
.studio-login { display: flex; flex-direction: column; gap: 18px; }
.studio-hero { display: flex; gap: 16px; align-items: center; }
.studio-hero h2 { margin: 0 0 4px; font-family: var(--display); }
.studio-hero .box-note { margin: 0; max-width: 62ch; }
.dc-mark { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--discord); color: #fff; }
.dc-mark svg { width: 30px; height: 30px; }
.btn.dc-btn { background: var(--discord); border-color: transparent; color: #fff; text-decoration: none; }
.btn.dc-btn:hover { filter: brightness(1.08); background: var(--discord); }
.studio-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: st; }
@media (max-width: 860px) { .studio-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .studio-steps { grid-template-columns: minmax(0, 1fr); } }
.studio-steps li { counter-increment: st; display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.studio-steps li::before { content: counter(st); width: 26px; height: 26px; margin-bottom: 6px; border-radius: 50%; display: grid; place-items: center; background: var(--discord); color: #fff; font-weight: 700; }
.studio-steps b { color: var(--text); font-size: 14px; }
.studio-me { display: flex; gap: 12px; align-items: center; min-width: 0; }
.studio-me strong { display: block; font-size: 16px; }
.studio-me .sub { direction: ltr; text-align: right; display: block; overflow-wrap: anywhere; }
.studio-tips { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
.studio-tips b { color: var(--text); }
.studio .kv input { min-width: 0; }
.dc-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--discord) 22%, transparent); color: #c9cdfb; }
.tag.reg { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); font-weight: 600; }
.reg-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--discord) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--discord) 40%, var(--line)); }
.reg-box.joined { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.reg-text { display: flex; flex-direction: column; min-width: 0; }
.reg-text strong { font-family: var(--display); font-size: 18px; }

/* ===== منصة القنوات: قائمة "مباشر الآن" وبطاقة "أضف قناتك" ===== */
.live-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 360px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.live-list .empty { padding: 26px 12px; }
.live-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: inherit; text-align: start; cursor: pointer; transition: background .2s; }
.live-row:hover { background: var(--surface-2); }
.live-row.is-on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.live-row .badge.sm { flex: none; }
.lr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-info strong { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-viewers { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lr-viewers svg { width: 15px; height: 15px; }
.live-row.is-on .lr-viewers { color: var(--accent); }
.add-channel { margin: 8px; padding: 16px; border-radius: 16px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--surface-2)), var(--surface-2) 70%); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.add-channel strong { font-family: var(--display); font-size: 17px; }
.add-channel span { font-size: 13px; color: var(--muted); line-height: 1.6; }
.add-channel .btn { margin-top: 6px; text-decoration: none; }
#liveCount span { font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .stream-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stream-grid .sc-thumb .badge.lg { width: 46px; height: 46px; border-radius: 13px; font-size: 18px; }
  .stream-grid .sc-thumb .tag { top: 6px; inset-inline-start: 6px; font-size: 11px; padding: 2px 7px; }
  .stream-grid .sc-body { padding: 9px 10px 11px; }
  .stream-grid .sc-body strong { font-size: 13.5px; }
  .stream-grid .sc-meta { font-size: 11.5px; }
  .now { flex-wrap: wrap; }
  .now-info { flex: 1 1 calc(100% - 72px); min-width: 0; }
  .now-info h1 { white-space: normal; }
  .now-meta { white-space: normal; }
  .now-actions { width: 100%; justify-content: flex-start; }
}

/* ===== حالة طلب القناة (موافقة الإدارة) ===== */
.review-box { grid-column: 1 / -1; }
.review-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; counter-reset: rs; }
@media (max-width: 640px) { .review-steps { grid-template-columns: minmax(0, 1fr); } }
.review-steps li { counter-increment: rs; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.review-steps li::before { content: counter(rs); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.review-steps li.done { color: var(--text); }
.review-steps li.done::before { content: "✓"; background: var(--ok); color: #04120c; }
.review-steps li.now { color: var(--text); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.review-steps li.now::before { background: var(--amber); color: #1a1205; }
.review-steps li.no { color: #ff8a9c; border-color: rgba(255, 59, 92, .4); }
.review-steps li.no::before { content: "✕"; background: var(--accent); color: #fff; }
.pill.off { color: #ff8a9c; background: rgba(255, 59, 92, .1); border-color: rgba(255, 59, 92, .35); }
.tag.pending { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); font-weight: 600; }
.tag.rejected { background: rgba(255, 59, 92, .14); color: #ff8a9c; font-weight: 600; }
.req-row { border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line)); background: color-mix(in srgb, var(--amber) 6%, var(--surface)); }

/* ===== صور حية للقنوات + وضع التشغيل الفوري ===== */
.sc-thumb { overflow: hidden; }
.sc-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.sc-thumb.has-shot .sc-shot { opacity: 1; }
.sc-thumb.has-shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent 55%); pointer-events: none; }
.sc-thumb.has-shot .badge { position: absolute; z-index: 1; bottom: 8px; inset-inline-end: 8px; width: 34px; height: 34px; border-radius: 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.sc-thumb .tag { z-index: 1; }
@media (prefers-reduced-motion: reduce) { .sc-shot { transition: none; } }
.mode-btn { display: inline-flex; flex-direction: row; align-items: center; width: auto; padding-inline: 10px; gap: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mode-btn svg { width: 15px; height: 15px; }
.mode-btn.rtc { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

/* ===== قنوات تويتش ويوتيوب وتيك توك ===== */
.player .embed, .mv-video .embed { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.ov-link { margin-top: 14px; text-decoration: none; width: auto; }
.overlay .ov-link { pointer-events: auto; }
.tag.plat { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1; font-weight: 700; color: #fff; }
.tag.plat-twitch { background: #9146ff; }
.tag.plat-youtube { background: #ff0033; }
.tag.plat-tiktok { background: #111; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.src-chips { margin-bottom: 4px; }
.src-input { min-width: 0; height: 44px; padding-inline: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 14px; }
.manual-live { margin-top: 14px; padding: 14px 16px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--bg-2); border: 1px solid var(--line); }
.manual-live > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.manual-live .btn { text-decoration: none; }

/* ===== القنوات المفضلة ===== */
.fav-btn { position: absolute; z-index: 2; bottom: 8px; inset-inline-start: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; transition: transform .15s, background .2s; }
.fav-btn svg, .fav-now svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fav-btn:hover { transform: scale(1.08); background: rgba(0, 0, 0, .75); }
.fav-btn.on, .fav-now.on { color: #ffc531; }
.fav-btn.on svg, .fav-now.on svg { fill: currentColor; }
.fav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .fav-btn { transition: none; } }

/* ===== التصميم 2: الشعار، التنقل، البطاقات، التذييل ===== */
body {
  background-image:
    radial-gradient(1000px 520px at 88% -14%, rgba(255, 59, 92, .14), transparent 62%),
    radial-gradient(800px 460px at -8% -6%, rgba(255, 122, 89, .06), transparent 60%);
}
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }

/* الشريط العلوي */
.topbar { background: rgba(7, 8, 12, .78); }
.topbar-in { height: 70px; gap: 16px; }
.brand { gap: 12px; flex: none; }
.brand-logo { display: block; width: auto; height: 30px; filter: drop-shadow(0 4px 14px color-mix(in srgb, var(--accent) 55%, transparent)); transition: transform .25s; }
.brand:hover .brand-logo { transform: scale(1.06) rotate(-3deg); }
.brand-name { font-size: 21px; }
.site-nav { flex: 1; gap: 2px; margin-inline: 22px 0; }
.site-nav a { gap: 8px; height: 40px; padding-inline: 14px; font-size: 14.5px; }
.site-nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.site-nav a[aria-current="page"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.site-nav a[aria-current="page"] svg { color: var(--accent); opacity: 1; }
.site-nav a.nav-cta {
  margin-inline-start: auto; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.site-nav a.nav-cta svg { opacity: 1; color: #fff; }
.site-nav a.nav-cta:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.site-nav a.nav-cta[aria-current="page"] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }

/* الجوال: الشعار في الأعلى، والتنقل شريط سفلي مثل التطبيقات */
@media (max-width: 720px) {
  /* الضبابية تجعل الشريط السفلي يتبع الشريط العلوي بدل الشاشة */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(7, 8, 12, .96); }
  .topbar-in { height: 58px; min-height: 0; flex-wrap: nowrap; padding-block: 0; }
  .brand-logo { height: 26px; }
  .brand-name { font-size: 18px; }
  .site-nav {
    position: fixed; z-index: 40; inset-inline: 0; bottom: 0; margin: 0; width: auto; order: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(9, 10, 15, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .site-nav a {
    flex-direction: column; justify-content: center; gap: 3px; height: 54px; padding: 0 2px; border-radius: 12px;
    font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; color: var(--faint);
  }
  .site-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .site-nav a svg { width: 22px; height: 22px; }
  .site-nav a[aria-current="page"] { background: none; box-shadow: none; color: var(--text); }
  .site-nav a.nav-cta { margin: 0; background: none; box-shadow: none; color: var(--accent); }
  .site-nav a.nav-cta svg { color: #fff; width: 38px; height: 26px; padding: 4px 10px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-sizing: border-box; }
  .site-nav a.nav-cta[aria-current="page"] { box-shadow: none; color: var(--text); }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .ed-fab { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .top-meta .pill { height: 30px; padding-inline: 10px; font-size: 12.5px; }
}

/* عناوين الأقسام */
.section-head h2, .panel-head h2, .tour-section h2 { display: flex; align-items: center; gap: 10px; }
.section-head h2::before, .panel-head h2::before, .tour-section h2::before {
  content: ""; flex: none; width: 4px; height: 1em; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.section-head .sub { padding-inline-start: 14px; }

/* المشغل */
.player-card { border-color: var(--line-2); }
.overlay:not([data-state="loading"]) .ov-icon {
  width: 92px; height: 56px; border: 0; border-radius: 0; background: url("logo.png") center / contain no-repeat;
  opacity: .9; filter: drop-shadow(0 8px 24px color-mix(in srgb, var(--accent) 60%, transparent));
}
.overlay:not([data-state="loading"]) .ov-icon svg { display: none; }
.overlay { background: radial-gradient(ellipse at center, rgba(40, 14, 24, .85), rgba(0, 0, 0, .97) 70%); }
.now { border-top: 1px solid var(--line); }
.now .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.now .eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s infinite; }

/* بطاقات القنوات */
.stream-grid { gap: 16px; }
.stream-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); transition: transform .25s, border-color .25s, box-shadow .25s; }
.stream-card:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -24px rgba(0, 0, 0, .9); }
.stream-card.is-live:hover { box-shadow: 0 22px 44px -22px color-mix(in srgb, var(--accent) 55%, transparent); }
.sc-shot { transition: opacity .4s, transform .5s; }
.stream-card:hover .sc-shot { transform: scale(1.04); }
.sc-thumb .tag.plat { inset-inline-start: auto; inset-inline-end: 10px; }
.stream-card:not(.is-live) .sc-thumb { background: radial-gradient(circle at 50% 45%, #1a1e2b, #07080c 75%); }
.stream-card:not(.is-live) .sc-body strong { color: #d5d8e1; }
.sc-body { padding: 12px 14px 14px; }
.tag.off { background: rgba(0, 0, 0, .6); color: #aab0bf; font-weight: 600; }
.chip[aria-pressed="true"] { box-shadow: 0 6px 18px -8px rgba(255, 255, 255, .35); }
@media (max-width: 600px) {
  .stream-grid .sc-thumb .tag.plat { inset-inline-end: 6px; top: 6px; }
}

/* لوحة مباشر الآن وبطاقة أضف قناتك */
.panel { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.add-channel { position: relative; overflow: hidden; }
.add-channel::after {
  content: ""; position: absolute; width: 150px; height: 90px; inset-inline-end: -26px; top: -14px;
  background: url("logo.png") center / contain no-repeat; opacity: .07; transform: rotate(-12deg); pointer-events: none;
}
.add-channel > * { position: relative; z-index: 1; }
@media (max-width: 1080px) {
  /* على الشاشات الصغيرة شبكة القنوات تعرض المباشر أولاً، فنكتفي ببطاقة أضف قناتك */
  .blk[data-block="queue"] .panel-head, .blk[data-block="queue"] .live-list { display: none; }
  .blk[data-block="queue"].panel { background: none; border: 0; }
  .blk[data-block="queue"] .add-channel { margin: 0; padding: 20px; }
}

/* بطاقات البطولات */
.tour-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); transition: transform .25s, border-color .25s, box-shadow .25s; }
.tour-card:hover { box-shadow: 0 22px 40px -24px rgba(0, 0, 0, .9); }

/* الأزرار */
.btn { transition: filter .2s, background .2s, border-color .2s, transform .15s; }
.btn:active:not(:disabled) { transform: scale(.98); }

/* التذييل */
.foot { margin-top: 24px; padding: 0; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent); color: var(--faint); font-size: 13px; }
.foot-in { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding-block: 28px 20px; }
.foot-brand { display: flex; align-items: center; gap: 14px; }
.foot-brand img { width: auto; height: 34px; opacity: .9; }
.foot-brand div { display: flex; flex-direction: column; }
.foot-brand strong { direction: ltr; text-align: right; font-family: var(--display); font-size: 18px; color: var(--text); }
.foot-brand strong b { color: var(--accent); }
.foot-brand span { color: var(--muted); font-size: 13px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.foot-links a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.foot-links a:hover { color: var(--text); background: var(--surface-2); }
.foot-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-block: 16px 26px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .foot-in { flex-direction: column; align-items: flex-start; }
  .foot-links { display: none; }
}
@media (prefers-reduced-motion: reduce) { .brand-logo, .sc-shot, .stream-card, .tour-card { transition: none; } }

/* ===== الدردشة المباشرة ===== */
.chat { display: flex; flex-direction: column; height: 560px; min-height: 0; }
.chat-head { flex: none; padding: 14px 18px; align-items: center; }
.chat-head .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-me { flex: none; max-width: 120px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c9cdfb; background: color-mix(in srgb, var(--discord) 22%, transparent); }
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; }
.chat-list {
  flex: 1; min-height: 0; list-style: none; margin: 0; padding: 8px 8px 4px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.msg { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 6px 8px; border-radius: 10px; }
.msg:hover { background: rgba(255, 255, 255, .035); }
.msg-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--surface-3); }
.msg-body { min-width: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-name { font-weight: 700; margin-inline-end: 6px; }
.msg-tag { display: inline-block; margin-inline-end: 6px; padding: 0 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; vertical-align: 1px; color: #fff; background: var(--accent); }
.msg-text { color: #dfe2ea; }
.msg-time { font-size: 11px; color: var(--faint); padding-top: 3px; font-variant-numeric: tabular-nums; }
.msg-tools { position: absolute; top: 4px; inset-inline-end: 6px; display: none; gap: 4px; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.msg:hover .msg-time { visibility: hidden; }
.msg-btn { height: 24px; min-width: 24px; padding-inline: 7px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.msg-btn:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.msg-btn.armed { color: #fff; background: var(--accent); border-color: var(--accent); }
@media (hover: none) { .msg-tools { display: flex; position: static; grid-column: 2 / -1; } .msg:hover .msg-time { visibility: visible; } }
.chat-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 24px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.chat-empty strong { color: var(--text); font-size: 15px; }
.chat-new {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); height: 32px; padding-inline: 14px; border-radius: 999px;
  border: 0; color: #fff; font-size: 13px; font-weight: 600; background: var(--accent); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .8);
}
.chat-form { flex: none; display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; min-width: 0; height: 44px; padding-inline: 14px; border-radius: 12px; outline: none;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font-size: 15px; transition: border-color .2s;
}
.chat-form input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.chat-send { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.chat-send svg { width: 19px; height: 19px; }
.chat-send:hover { filter: brightness(1.08); }
.chat-gate { flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }
.chat-gate .btn { width: 100%; height: 44px; text-decoration: none; }
.chat-gate .btn svg { width: 20px; height: 20px; }
.chat-gate p { margin: 0; padding: 10px; border-radius: 10px; text-align: center; font-size: 13.5px; color: var(--muted); background: var(--bg-2); }

/* الشاشات الصغيرة: الدردشة تحت المشغل مباشرة، ثم بقية الأقسام */
@media (max-width: 1080px) {
  body:not(.editing) .layout { display: flex; flex-direction: column; align-items: stretch; }
  body:not(.editing) .layout > .slot { display: contents; }
  body:not(.editing) .slot[data-slot="top"] > .blk { order: 0; }
  body:not(.editing) .slot[data-slot="main"] > .blk { order: 20; }
  body:not(.editing) .slot[data-slot="main"] > .blk[data-block="player"] ~ .blk { order: 22; }
  body:not(.editing) .layout .blk[data-block="chat"] { order: 21; }
  body:not(.editing) .slot[data-slot="side"] > .blk:not([data-block="chat"]) { order: 30; }
  body:not(.editing) .slot[data-slot="bottom"] > .blk { order: 40; }
  .chat { height: 420px; }
}
@media (max-width: 560px) { .chat { height: 380px; } .chat-form input { font-size: 16px; } }
/* الدردشة بطول المشغل، فالعمود الجانبي يتحرك مع الصفحة */
.slot[data-slot="side"] { position: static; }
@media (max-width: 720px) { #chat { scroll-margin-bottom: 84px; scroll-margin-top: 70px; } }

/* ===== سيرفر ديسكورد ===== */
.dc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dc-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.dc-steps li::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); }
.dc-steps li.done { color: var(--text); }
.dc-steps li.done::before { content: "✓"; display: grid; place-items: center; border: 0; background: var(--ok); color: #04120c; font-weight: 700; font-size: 13px; }
.dc-log { list-style: none; margin: 14px 0 0; padding: 10px 12px; max-height: 220px; overflow: auto; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.dc-log .err { color: #ff8a9c; }
.dc-join {
  display: flex; align-items: center; gap: 12px; margin: 0 8px 8px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--discord), #4049c7); box-shadow: 0 12px 28px -16px var(--discord); transition: filter .2s, transform .2s;
}
.dc-join:hover { filter: brightness(1.08); transform: translateY(-2px); }
.dc-join svg { width: 30px; height: 30px; flex: none; }
.dc-join span { display: flex; flex-direction: column; min-width: 0; }
.dc-join strong { font-size: 15px; }
.dc-join small { font-size: 12.5px; opacity: .85; display: inline-flex; align-items: center; gap: 6px; }
.dc-join small::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ba55d; }
.dc-join small:empty { display: none; }
@media (max-width: 1080px) { .blk[data-block="queue"] .dc-join { margin: 12px 0 0; } }
