/* ============================================================
   PRISM — Piece R4 styles. ABET design system.
   Player: rounded + embossed (sunken into page).
   Below: collapsible section with category pills + channel list.
   ============================================================ */

:root {
  --bg-dark: #090D14;
  --bg-darker: #070B0F;
  --accent-primary: #00B8D4;
  --accent-secondary: #FFD600;
  --accent-tertiary: #FF0055;
  --text-light: #E6F4FF;
  --text-muted: #7A8B9A;
  --border-color: rgba(0, 184, 212, 0.3);
  --menu-bg: rgba(0, 45, 114, 0.4);
  color-scheme: dark;
}

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

body {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #070B0F; }
::-webkit-scrollbar-thumb { background: #00B8D4; border-radius: 4px; }
::selection { background: rgba(255,214,0,.3); }

/* ---------- player: rounded + embossed (sunk-in) ---------- */
.stage { padding: 14px 12px 6px; }
@media (min-width: 900px) { .stage { max-width: 1100px; margin: 0 auto; } }

.player-shell {
  position: relative;
  border-radius: 18px; overflow: hidden;
  background: #000;
  border: 1px solid rgba(0, 184, 212, 0.15);
  box-shadow:
    inset 0 3px 12px rgba(0, 0, 0, 0.7),
    inset 0 -2px 8px rgba(0, 184, 212, 0.08),
    0 4px 20px rgba(0, 184, 212, 0.1);
  aspect-ratio: 16 / 9;
}
.player-shell video { width: 100%; height: 100%; object-fit: contain; display: block; }

.player-loading {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9,13,20,.82); pointer-events: none;
}
.player-err {
  display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  background: rgba(255,68,68,.15); border-top: 1px solid rgba(255,68,68,.45);
  color: #ff9999; font-size: 12px; padding: 7px 12px;
}
.player-err.show { display: block; }

.mute-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 7; background: rgba(255,214,0,.92); color: #000;
  border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 9px 18px;
}

/* ---------- casino-chip / ABET spinner ---------- */
@keyframes chipSpin { to { transform: rotate(360deg); } }
.poker-chip {
  display: inline-block; width: 46px; height: 46px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0d1320 0 34%, transparent 34%),
    conic-gradient(#FFD600 0 30deg, #090D14 30deg 60deg, #FFD600 60deg 90deg, #090D14 90deg 120deg,
                   #FFD600 120deg 150deg, #090D14 150deg 180deg, #FFD600 180deg 210deg, #090D14 210deg 240deg,
                   #FFD600 240deg 270deg, #090D14 270deg 300deg, #FFD600 300deg 330deg, #090D14 330deg 360deg);
  border: 3px solid #FFD600;
  box-shadow: 0 0 16px rgba(255,214,0,.45), inset 0 0 10px rgba(0,0,0,.7);
  animation: chipSpin 1.15s linear infinite;
}
.poker-chip i {
  display: block; position: absolute; inset: 22%; border-radius: 50%;
  background: radial-gradient(circle, #101725 55%, #00B8D4 56%, #090D14 78%);
  box-shadow: inset 0 0 6px rgba(0,184,212,.6);
}

/* ---------- collapsible section ---------- */
.collapse-section {
  margin: 10px 12px 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-darker);
}
@media (min-width: 900px) { .collapse-section { max-width: 1100px; margin: 10px auto 0; } }

.collapse-header {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 0 16px;
  background: rgba(0,45,114,.25);
  border: none; border-bottom: 1px solid rgba(0,184,212,.15);
  color: var(--text-light); cursor: pointer; text-align: left;
  font-family: inherit; transition: all .2s;
}
.collapse-header:hover { background: rgba(0,184,212,.12); }
.collapse-chevron { font-size: 13px; color: var(--accent-primary); width: 18px; text-align: center; flex-shrink: 0; }
.collapse-title { color: var(--accent-secondary); font-weight: 700; font-size: 13px; letter-spacing: 1.5px; flex-shrink: 0; }
.collapse-count { margin-left: auto; font-size: 11px; color: var(--text-muted); letter-spacing: .5px; }

.collapse-body { max-height: 65vh; overflow-y: auto; }
.collapse-section:not(.open) .collapse-body { display: none; }

/* ---------- category pill bar ---------- */
.pill-bar {
  display: flex; gap: 8px; padding: 12px 14px;
  overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg-darker);
}
.pill-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  background: var(--menu-bg); border: 1px solid var(--border-color);
  color: var(--text-light); font-family: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  min-height: 36px; padding: 0 14px; border-radius: 18px;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.cat-pill:hover { background: rgba(0,184,212,.25); }
.cat-pill.on {
  background: var(--accent-secondary); border-color: var(--accent-secondary);
  color: var(--bg-dark); box-shadow: 0 0 10px rgba(255,214,0,.4);
}

/* ---------- channel rows ---------- */
.ch-list { display: flex; flex-direction: column; }
.ch-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 14px;
  background: none; border: none; border-bottom: 1px solid rgba(0,184,212,.09);
  color: var(--text-light); font-family: inherit; font-size: 15px; text-align: left;
  cursor: pointer; transition: background .15s;
  width: 100%;
}
.ch-row:hover { background: rgba(0,184,212,.12); color: var(--accent-primary); }
.ch-row.nostream { opacity: .42; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: #39424f; }
.dot.working { background: #00ff88; box-shadow: 0 0 6px rgba(0,255,136,.7); }
.dot.dead { background: #ff4444; }
.ch-logo { height: 24px; max-width: 52px; object-fit: contain; flex-shrink: 0; }
.ch-flag { width: 22px; border-radius: 2px; flex-shrink: 0; }
.ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-cc { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

/* show more */
.list-more-wrap { padding: 10px 14px 16px; text-align: center; }
.list-more {
  background: var(--menu-bg); border: 1px solid var(--border-color);
  color: var(--text-light); font-family: inherit; font-size: 12px; font-weight: 600;
  letter-spacing: 1px; min-height: 40px; padding: 0 24px;
  border-radius: 6px; cursor: pointer; transition: all .2s;
}
.list-more:hover { background: rgba(0,184,212,.3); border-color: var(--accent-primary); }

.list-boot {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px 0; color: var(--text-muted); font-size: 12px; letter-spacing: 1px;
}

.list-sentinel { height: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg-darker); color: var(--text-light);
  border: 1px solid var(--border-color);
  font-family: inherit; font-size: 12px; letter-spacing: 1px;
  padding: 11px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; z-index: 1300;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tree-empty { color:var(--text-muted); font-size:12px; padding:18px 14px; }

@media (max-width: 640px) {
  .stage { padding: 8px 8px 4px; }
  .player-shell { border-radius: 12px; }
  .ch-row { font-size: 16px; min-height: 54px; padding: 10px 12px; }
  .cat-pill { min-height: 40px; font-size: 12px; padding: 0 16px; }
  .collapse-section { margin: 8px 8px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .poker-chip { animation-duration: 3s !important; }
}


/* ---------- R4a: working/country filter bar ---------- */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(0,184,212,.09);
  background: rgba(0,45,114,.08);
}
.f-work {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--text-muted);
  cursor: pointer; white-space: nowrap; letter-spacing: .5px;
}
.f-work input { accent-color: var(--accent-primary); width: 15px; height: 15px; }
.f-country {
  background: var(--bg-darker); border: 1px solid var(--border-color);
  color: var(--text-light); font-family: inherit; font-size: 12px;
  padding: 6px 10px; min-height: 34px; border-radius: 6px; cursor: pointer;
}
option { background: #070B0F; color: #E6F4FF; }
select { color-scheme: dark; }

@media (max-width:640px) {
  .filter-bar { flex-wrap: wrap; }
  .f-country, .f-work { min-height: 40px; }
}


/* ---------- ABET chip loader (verbatim from live bundle) ---------- */
.abet-chip-perspective { perspective: 620px; width: 56px; height: 56px; }
.abet-chip-spinner { width:100%; height:100%; position:relative; transform-style:preserve-3d; animation:abet-chip-flip 2.4s cubic-bezier(.45,.05,.35,1) infinite; }
.abet-chip-face { position:absolute; inset:0; border-radius:50%; background:#0b0f17; display:flex; align-items:center; justify-content:center; backface-visibility:hidden; }
.abet-chip-seg { position:absolute; left:50%; top:5px; width:9px; height:16px; margin-left:-4.5px; border-radius:3px; background:rgba(253,181,21,0.85); }
.abet-chip-txt { font-family:Georgia,'Times New Roman',serif; font-size:13px; letter-spacing:1px; color:#FDB515; text-shadow:0 0 8px rgba(253,181,21,.65); }
.abet-chip-back { transform:rotateY(180deg); }
@keyframes abet-chip-flip {
  0% { transform:rotateY(0deg) translateY(0); }
  45% { transform:rotateY(540deg) translateY(-10px); }
  70% { transform:rotateY(720deg) translateY(0); }
  78% { transform:rotateY(720deg) translateY(-4px); }
  100% { transform:rotateY(1080deg) translateY(0); }
}
.chip-label { font-size:11px; letter-spacing:1.5px; color:var(--text-muted); text-transform:uppercase; margin-left:12px; }

/* ---------- pill bar additions ---------- */
.pill-work.on {
  background: #00ff88; border-color: #00ff88;
  color: var(--bg-dark); box-shadow: 0 0 12px rgba(0,255,136,.4);
}
.pill-sep {
  flex-shrink: 0; width: 1px; align-self: stretch;
  background: rgba(0,184,212,.2); margin: 4px 2px;
}

/* channel initial fallback (when no logo/flag) */
.ch-initial {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  background: rgba(0,184,212,.1); flex-shrink: 0;
}
