/* ============================================================
   TEAM · CHAMPION SELECT LAYOUT — Locuste Crew
   Used by: Senior / Junior / Locust3
   (Sciame keeps the original .pcard grid)
   ============================================================ */

/* ── per-team accent injection ──
   Per ogni nuovo team (layout "cs") aggiungere una riga qui.
   Formato: .cs-team[data-cs-accent="KEY"] { --cs-accent: COLOR; --cs-accent-dark: COLOR_DARK; --cs-accent-soft: COLOR_ALPHA; }
   ── */
.cs-team[data-cs-accent="senior"]    { --cs-accent: var(--green-bright); --cs-accent-dark: var(--green-dark);       --cs-accent-soft: rgba(77,184,77,0.12); }
.cs-team[data-cs-accent="junior"]    { --cs-accent: var(--gold);         --cs-accent-dark: rgba(201,168,96,0.45);   --cs-accent-soft: rgba(201,168,96,0.10); }
.cs-team[data-cs-accent="perla"]     { --cs-accent: var(--blue-perla);   --cs-accent-dark: rgba(96,165,250,0.45);   --cs-accent-soft: rgba(96,165,250,0.10); }
.cs-team[data-cs-accent="scommessa"] { --cs-accent: var(--orange);       --cs-accent-dark: rgba(249,115,22,0.45);   --cs-accent-soft: rgba(249,115,22,0.10); }

/* ── Stage ─────────────────────────────────────────────── */
.cs-stage {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  min-height: 600px;
  align-items: stretch;
  margin-top: 32px;
}

/* ── Rail (titolari + riserve scrollabili) ─────────────── */
.cs-rail {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cs-accent) 45%, transparent) transparent;
}
.cs-rail::-webkit-scrollbar { width: 3px; }
.cs-rail::-webkit-scrollbar-track { background: transparent; }
.cs-rail::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--cs-accent) 45%, transparent);
  border-radius: 2px;
}
/* Titolari: crescono per riempire lo spazio disponibile */
.cs-rail > li {
  flex: 1 0 auto;
  display: flex;
}
.cs-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1;
  padding: 10px 12px;
  background: #161618;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  color: var(--gray-light);
  font: inherit;
}
.cs-slot:hover { border-color: rgba(255,255,255,0.18); background: #1c1c1f; }
.cs-slot.is-active {
  background: #232327;
  border-color: var(--cs-accent);
  box-shadow: inset 4px 0 0 var(--cs-accent);
}
.cs-slot__role {
  color: rgba(255,255,255,0.4);
  display: flex; align-items: center;
  transition: color .15s ease;
  flex-shrink: 0;
}
.cs-slot.is-active .cs-slot__role { color: var(--cs-accent); }

.cs-slot__portrait {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 4px;
  background: linear-gradient(135deg, #1c1c1c 0%, #2a2a2a 100%);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cs-slot__portrait img { width: 100%; height: 100%; object-fit: cover; }
.cs-slot__portrait .cs-slot__init {
  font-family: var(--font-title);
  font-size: 1rem; font-weight: 900;
  color: var(--cs-accent);
  letter-spacing: 0.04em;
}

.cs-slot__info { flex: 1; min-width: 0; }
.cs-slot__nick {
  font-family: var(--font-title);
  font-size: 0.95rem; font-weight: 700;
  color: var(--white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-slot__meta {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.62rem;
  color: var(--gray-mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-slot__indicator {
  font-size: 14px;
  color: rgba(255,255,255,0.18);
  flex-shrink: 0;
}
.cs-slot.is-active .cs-slot__indicator { color: var(--cs-accent); }

/* ── Preview ──────────────────────────────────────────── */
.cs-preview {
  position: relative;
  background: #050505;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  display: flex; flex-direction: column;
  isolation: isolate;
}

/* Media layer (video or placeholder) */
.cs-preview__media { position: absolute; inset: 0; overflow: hidden; }
.cs-preview__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-preview__mediaOverlay {
  position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 30%, rgba(0,0,0,0.85) 100%),
    linear-gradient(90deg, rgba(13,13,13,0.55) 0%, rgba(13,13,13,0.2) 60%, transparent 100%);
  pointer-events: none;
}

/* Placeholder (champ splash with Ken Burns + mock video chrome) */
.cs-placeholder { position: absolute; inset: 0; overflow: hidden; background: #050505; }
.cs-placeholder__player-photo {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  pointer-events: none;
  transition: opacity 0.08s step-start;
}
.cs-placeholder__bg {
  position: absolute; inset: -6%;
  background-size: cover; background-position: center 22%;
  filter: saturate(0.55) brightness(0.65) contrast(1.05);
  transform-origin: 50% 35%;
  animation: csKenBurns 22s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes csKenBurns {
  0%   { transform: scale(1.04) translate(-1.2%, 1%); }
  50%  { transform: scale(1.14) translate(1.5%, -1.5%); }
  100% { transform: scale(1.08) translate(-1%, 0.8%); }
}
.cs-placeholder__grid {
  position: absolute; inset: 0; z-index: 1;
  background-image:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--cs-accent) 12%, transparent) 0, color-mix(in srgb, var(--cs-accent) 12%, transparent) 1px, transparent 1px, transparent 14px),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.022) 0, rgba(255,255,255,0.022) 1px, transparent 1px, transparent 14px);
  mix-blend-mode: overlay;
}
.cs-placeholder__grain {
  position: absolute; inset: 0; z-index: 1;
  background-image:
    radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.18) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: overlay;
  opacity: 0.35;
  animation: csGrain 0.9s steps(6) infinite;
}
@keyframes csGrain {
  0%, 100% { transform: translate(0, 0); }
  20%  { transform: translate(-1px, 1px); }
  40%  { transform: translate(1px, -1px); }
  60%  { transform: translate(-1px, -1px); }
  80%  { transform: translate(1px, 1px); }
}
.cs-placeholder__vignette {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse 90% 70% at 50% 55%, transparent 35%, rgba(0,0,0,0.55) 75%, rgba(0,0,0,0.85) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.45) 0%, transparent 25%, transparent 60%, rgba(0,0,0,0.65) 100%);
}
.cs-placeholder__center {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center;
}
.cs-placeholder__playRing {
  width: 84px; height: 84px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--cs-accent) 65%, transparent);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: var(--cs-accent);
  display: flex; align-items: center; justify-content: center;
  padding-left: 4px;
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--cs-accent) 10%, transparent),
    0 0 40px color-mix(in srgb, var(--cs-accent) 30%, transparent);
  animation: csPulse 2.4s ease-in-out infinite;
}
@keyframes csPulse {
  0%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--cs-accent) 10%, transparent), 0 0 40px color-mix(in srgb, var(--cs-accent) 30%, transparent); }
  50%      { box-shadow: 0 0 0 12px color-mix(in srgb, var(--cs-accent) 5%, transparent), 0 0 64px color-mix(in srgb, var(--cs-accent) 45%, transparent); }
}
.cs-placeholder__lbl {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.68rem;
  color: var(--cs-accent);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}
.cs-placeholder__sub {
  font-family: var(--font-title);
  font-size: 0.78rem;
  color: var(--gray-light);
  letter-spacing: 0.16em;
  font-weight: 600;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

/* Film strip + timecode chrome (always visible on placeholder) */
.cs-filmstrip {
  position: absolute; left: 0; right: 0; height: 14px;
  display: flex; gap: 8px; padding: 0 12px;
  align-items: center; pointer-events: none;
  background: rgba(0,0,0,0.65);
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 2;
}
.cs-filmstrip--top { top: 0; }
.cs-filmstrip--bot { bottom: 0; }
.cs-filmstrip span { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 1px; }

.cs-tc {
  position: absolute;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--gray-light);
  padding: 4px 8px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 2px;
  display: inline-flex; align-items: center; gap: 5px;
  z-index: 3;
  pointer-events: none;
}
.cs-tc--tl { top: 64px; left: 16px; }
.cs-tc--tr { top: 64px; right: 16px; }
.cs-tc--bl { bottom: 22px; left: 16px; }
.cs-tc--br { bottom: 22px; right: 16px; }
.cs-tc__rec {
  width: 7px; height: 7px; border-radius: 50%;
  background: #E26A6A;
  box-shadow: 0 0 6px #E26A6A;
  animation: csBlink 1.4s ease-in-out infinite;
}
@keyframes csBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Glitch effect ──────────────────────────────────────── */
@keyframes csGlitchSlice {
  0%, 92%, 100% { clip-path: none; transform: none; opacity: 1; filter: none; }
  93%  { clip-path: inset(30% 0 55% 0); transform: translateX(-4px); opacity: 0.85; filter: hue-rotate(80deg) saturate(2); }
  94%  { clip-path: inset(55% 0 15% 0); transform: translateX( 3px); opacity: 0.85; filter: hue-rotate(100deg) brightness(1.3); }
  95%  { clip-path: inset(10% 0 70% 0); transform: translateX(-2px); opacity: 0.9;  filter: hue-rotate(90deg) saturate(1.5); }
  96%  { clip-path: none;               transform: none;              opacity: 1;    filter: none; }
}
@keyframes csGlitchRgb {
  0%, 92%, 100% { text-shadow: none; }
  93%  { text-shadow: -3px 0 rgba(77,255,77,0.8), 3px 0 #0ff; }
  94%  { text-shadow:  2px 0 #0ff, -2px 0 rgba(77,255,77,0.9); }
  95%  { text-shadow: -1px 0 rgba(77,255,77,0.7), 1px 0 #0ff; }
  96%  { text-shadow: none; }
}
@keyframes csGlitchScan {
  0%, 94%, 100% { opacity: 0; background: rgba(255,255,255,0.06); }
  95%  { opacity: 0.5; transform: translateY(-60px); background: rgba(77,255,77,0.12); }
  96%  { opacity: 0.3; transform: translateY( 40px); background: rgba(77,255,77,0.08); }
  97%  { opacity: 0; }
}

.cs-preview__media {
  animation: csGlitchSlice 3.5s steps(1) infinite;
}
.cs-preview__nick {
  animation: csGlitchRgb 3.5s steps(1) infinite;
}
.cs-preview__scanlines::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.06);
  height: 40px; width: 100%;
  top: 0;
  animation: csGlitchScan 3.5s steps(1) infinite;
  pointer-events: none;
}


.cs-preview__scanlines {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0, rgba(0,0,0,0.18) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 3;
}

/* Header strip (role + PICK badge) */
.cs-preview__top {
  position: relative; z-index: 4;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(0,0,0,0.75) 0%, transparent 100%);
}
.cs-preview__role {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.68rem;
  color: var(--cs-accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.cs-preview__pick {
  font-family: var(--font-title);
  font-size: 0.65rem;
  padding: 4px 12px;
  background: var(--cs-accent);
  color: var(--bg-main);
  border-radius: 2px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

/* Body (nick + stats + lock button) */
.cs-preview__body {
  position: relative; z-index: 4;
  flex: 1;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px;
}
.cs-preview__nickwrap {
  position: relative;
  margin-bottom: 24px;
}
.cs-preview__watermark {
  position: absolute;
  left: -8px;
  bottom: 18px;
  font-family: var(--font-title);
  font-size: clamp(3.2rem, 9vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: rgba(255,255,255,0.05);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.cs-preview__nick {
  position: relative;
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--white);
  text-transform: uppercase;
  margin: 0 0 8px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.7);
}
.cs-preview__champ {
  position: relative;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--gray-mid);
  letter-spacing: 0.16em;
}
.cs-preview__champ strong { color: var(--cs-accent); font-weight: 600; }

.cs-preview__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.cs-preview__stat {
  background: rgba(13,13,13,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 12px;
}
.cs-preview__statLbl {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 9px;
  color: var(--gray-mid);
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}
.cs-preview__statVal {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: 4px;
}
.cs-preview__statSub {
  font-size: 10px;
  color: var(--gray-mid);
}

.cs-preview__lock {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--cs-accent);
  color: var(--bg-main);
  border: 0;
  padding: 14px 22px;
  cursor: pointer;
  border-radius: 4px;
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background .15s, transform .15s, box-shadow .15s;
  width: 100%;
}
.cs-preview__lock:hover {
  box-shadow: 0 0 28px color-mix(in srgb, var(--cs-accent) 55%, transparent);
  transform: translateY(-1px);
}
.cs-preview__lockArrow { font-size: 1.1rem; font-weight: 400; }


/* ── Empty state (Locust3 with no roster yet) ────────────── */
.cs-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--gray-mid);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-align: center;
}

/* .cs-subs / .cs-sub-card rimossi — riserve ora dentro .cs-rail */

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 980px) {
  .cs-stage { grid-template-columns: 1fr; gap: 12px; min-height: 0; }
  .cs-rail { max-height: 420px; }
  .cs-preview { min-height: 480px; }
  .cs-preview__stats { grid-template-columns: repeat(3, 1fr); }
  /* Watermark non deve uscire dalla preview */
  .cs-preview__watermark {
    font-size: clamp(2rem, 8vw, 4rem);
    white-space: normal;
    overflow: hidden;
  }
}
@media (max-width: 560px) {
  .cs-slot { padding: 8px 10px; gap: 10px; }
  .cs-slot__portrait { width: 44px; height: 44px; }
  .cs-slot__nick { font-size: 0.85rem; }
  /* Touch target slot minimo 44px */
  .cs-slot { min-height: 44px; }
  .cs-preview__top { padding: 14px 16px; }
  .cs-preview__body { padding: 18px; }
  .cs-preview__stats { grid-template-columns: 1fr 1fr; }
  .cs-preview__stat:last-child { grid-column: 1 / -1; }
  /* Lock button touch target */
  .cs-preview__lock { min-height: 48px; padding: 14px 18px; }
  /* Timecode chrome — nascosto su mobile per spazio */
  .cs-tc--tr, .cs-tc--bl, .cs-tc--br { display: none; }
  .cs-tc--tl { top: 50px; }
}
@media (max-width: 400px) {
  /* Rail compresso su iPhone SE */
  .cs-slot__portrait { width: 38px; height: 38px; }
  .cs-slot__nick { font-size: 0.78rem; }
  .cs-slot__meta { font-size: 0.56rem; }
  .cs-stage { gap: 8px; }
}
