/* ==========================================================================
   CHESS STRIKE ⚡ — css/style.css
   Estilo gamer dark/neon: HUD de FPS + synthwave.
   Todas as classes/ids do jogo usam prefixo cs-.
   Acoplado a js/ui.js (que constrói o DOM dentro de #ui-root).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET + VARIÁVEIS
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

:root {
  --cs-bg:        #0a0a14;
  --cs-bg-2:      #11131f;
  --cs-cyan:      #00f0ff;
  --cs-magenta:   #ff2d78;
  --cs-yellow:    #ffe600;
  --cs-green:     #3dff8c;
  --cs-red:       #ff3b3b;
  --cs-orange:    #ff8c1a;
  --cs-ink:       #e8f6ff;
  --cs-ink-dim:   #8fa3c0;

  --cs-font-display: 'Orbitron', Impact, 'Arial Black', sans-serif;
  --cs-font-body:    'Rajdhani', 'Trebuchet MS', Impact, sans-serif;

  --cs-glow-cyan:    0 0 10px rgba(0, 240, 255, .55), 0 0 26px rgba(0, 240, 255, .25);
  --cs-glow-magenta: 0 0 10px rgba(255, 45, 120, .55), 0 0 26px rgba(255, 45, 120, .25);
  --cs-glow-yellow:  0 0 10px rgba(255, 230, 0, .55), 0 0 26px rgba(255, 230, 0, .25);
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--cs-bg);
  color: var(--cs-ink);
  font-family: var(--cs-font-body);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: rgba(255, 45, 120, .65); color: #fff; }

/* --------------------------------------------------------------------------
   2. LAYOUT BASE — canvas atrás (recebe cliques), UI por cima
   -------------------------------------------------------------------------- */

#game-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  cursor: crosshair;
}
#game-container canvas { display: block; }

#ui-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;     /* canvas recebe cliques fora dos painéis */
  user-select: none;
  -webkit-user-select: none;
}

/* Scanlines sutis estilo CRT por cima de tudo */
#ui-root::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, .14) 0px,
    rgba(0, 0, 0, .14) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: .30;
}

/* Faixa de "refresh" descendo devagar */
#ui-root::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16vh;
  z-index: 91;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 240, 255, .045), transparent);
  animation: cs-scanline 9s linear infinite;
}

.cs-hidden { display: none !important; }

/* --------------------------------------------------------------------------
   3. RESET DE BOTÕES + MOLDURA CHANFRADA (HUD de FPS)
   -------------------------------------------------------------------------- */

.cs-btn, .cs-abtn, .cs-toggle, .cs-lvl, .cs-skin-card,
.cs-promo-card, .cs-log-head, .cs-help-close, .cs-back-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  background: none;
  cursor: pointer;
  text-transform: uppercase;
  text-align: center;
}

/* Painel com cantos chanfrados + borda neon (truque do ::before interno) */
.cs-frame {
  --cs-cut: 14px;
  --cs-frame-grad: linear-gradient(155deg,
      rgba(0, 240, 255, .85), rgba(0, 240, 255, .14) 38%,
      rgba(255, 45, 120, .25) 72%, rgba(255, 45, 120, .8));
  --cs-frame-fill: linear-gradient(180deg, rgba(23, 27, 50, .94), rgba(9, 10, 20, .96));
  position: relative;
  isolation: isolate;
  background: var(--cs-frame-grad);
  clip-path: polygon(
    var(--cs-cut) 0, 100% 0,
    100% calc(100% - var(--cs-cut)),
    calc(100% - var(--cs-cut)) 100%,
    0 100%, 0 var(--cs-cut)
  );
}
.cs-frame::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  z-index: -1;
  background: var(--cs-frame-fill);
  clip-path: polygon(
    var(--cs-cut) 0, 100% 0,
    100% calc(100% - var(--cs-cut)),
    calc(100% - var(--cs-cut)) 100%,
    0 100%, 0 var(--cs-cut)
  );
}

/* --------------------------------------------------------------------------
   4. BOTÕES
   -------------------------------------------------------------------------- */

.cs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 22px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .14em;
  color: var(--cs-ink);
  text-shadow: 0 0 8px rgba(0, 240, 255, .35);
  transition: transform .15s ease, filter .15s ease;
}
.cs-btn:hover {
  --cs-frame-grad: linear-gradient(155deg, var(--cs-cyan), rgba(0, 240, 255, .45) 45%, var(--cs-magenta));
  --cs-frame-fill: linear-gradient(180deg, rgba(0, 70, 86, .92), rgba(12, 14, 30, .96));
  transform: translateY(-2px);
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, .55));
}
.cs-btn:active { transform: translateY(1px) scale(.98); filter: drop-shadow(0 0 6px rgba(0, 240, 255, .4)); }
.cs-btn:focus-visible { filter: drop-shadow(0 0 10px var(--cs-yellow)) brightness(1.2); }

.cs-btn--primary {
  --cs-frame-grad: linear-gradient(155deg, var(--cs-yellow), rgba(255, 230, 0, .25) 40%, var(--cs-magenta));
  color: var(--cs-yellow);
  text-shadow: var(--cs-glow-yellow);
  animation: cs-pulse-glow 2.2s ease-in-out infinite;
}
.cs-btn--primary:hover {
  --cs-frame-grad: linear-gradient(155deg, var(--cs-yellow), rgba(255, 230, 0, .6) 45%, var(--cs-magenta));
  filter: drop-shadow(0 0 14px rgba(255, 230, 0, .6));
}

.cs-btn--ghost { opacity: .92; }

/* Toggles (som / música) */
.cs-toggle {
  font-family: var(--cs-font-display);
  font-size: .72rem;
  letter-spacing: .12em;
  color: var(--cs-ink-dim);
  padding: 9px 14px;
  border: 1px solid rgba(0, 240, 255, .28);
  background: rgba(10, 12, 24, .72);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: color .15s, border-color .15s, filter .15s;
}
.cs-toggle b { color: var(--cs-cyan); font-weight: 700; }
.cs-toggle:hover { color: var(--cs-ink); border-color: var(--cs-cyan); filter: drop-shadow(0 0 8px rgba(0, 240, 255, .4)); }
.cs-toggle.cs-off b { color: var(--cs-red); }

.cs-off { opacity: .55; filter: grayscale(.4); }

/* --------------------------------------------------------------------------
   5. TELAS CHEIAS (menu / skins)
   -------------------------------------------------------------------------- */

.cs-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(26, 20, 58, .72), rgba(7, 7, 16, .92) 75%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Grid synthwave em perspectiva no rodapé do menu */
.cs-menu::after {
  content: "";
  position: absolute;
  left: -40%;
  right: -40%;
  bottom: -14%;
  height: 48%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, .25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 45, 120, .22) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(380px) rotateX(64deg);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%);
  mask-image: linear-gradient(180deg, transparent, #000 40%);
  animation: cs-grid-scroll 2.4s linear infinite;
  opacity: .55;
}

.cs-menu-inner, .cs-skins-inner {
  position: relative;
  z-index: 1;
  margin: auto;
  width: 100%;
  max-width: 540px;
  padding: 28px 18px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.cs-skins-inner { max-width: 780px; }

/* ----- LOGO ----- */

.cs-logo-wrap { text-align: center; animation: cs-float 5.5s ease-in-out infinite; }

.cs-logo {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .16em;
  font-family: var(--cs-font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(2.5rem, 10vw, 5.6rem);
  line-height: .95;
  letter-spacing: .01em;
  white-space: nowrap;
}
.cs-logo-word { position: relative; }
.cs-logo-word--a {
  color: #eaffff;
  text-shadow: 0 0 8px rgba(0, 240, 255, .9), 0 0 30px rgba(0, 240, 255, .55), 0 0 70px rgba(0, 240, 255, .3);
}
.cs-logo-word--b {
  background: linear-gradient(180deg, #ff8cba, var(--cs-magenta) 55%, #a90f4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 45, 120, .6));
}
/* fatias de glitch */
.cs-logo-word::before,
.cs-logo-word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: none;
  opacity: 0;
  pointer-events: none;
}
.cs-logo-word::before {
  color: var(--cs-cyan);
  clip-path: inset(8% 0 56% 0);
  transform: translate(-4px, -2px);
  animation: cs-glitch-a 3.7s steps(1) infinite;
}
.cs-logo-word::after {
  color: var(--cs-magenta);
  clip-path: inset(62% 0 6% 0);
  transform: translate(4px, 2px);
  animation: cs-glitch-b 2.9s steps(1) infinite;
}
.cs-logo-bolt {
  font-style: normal;
  font-size: .8em;
  color: var(--cs-yellow);
  text-shadow: var(--cs-glow-yellow);
  animation: cs-bolt 1.6s ease-in-out infinite;
}

.cs-tagline {
  margin-top: 10px;
  font-family: var(--cs-font-body);
  font-weight: 700;
  font-size: clamp(.8rem, 2.6vw, 1.05rem);
  letter-spacing: .42em;
  text-indent: .42em;
  color: var(--cs-yellow);
  text-shadow: 0 0 12px rgba(255, 230, 0, .45);
}

/* ----- CARD DO JOGADOR ----- */

.cs-player-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}
.cs-player-card::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-top: 2px solid var(--cs-yellow);
  border-right: 2px solid var(--cs-yellow);
  opacity: .75;
}
.cs-player-rank-icon {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(255, 230, 0, .5));
}
.cs-player-meta { flex: 1; min-width: 0; }
.cs-player-rankname {
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .14em;
}
.cs-player-level {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: .85rem;
  letter-spacing: .1em;
  color: var(--cs-ink-dim);
  margin: 3px 0 5px;
}
.cs-player-xp-num { color: var(--cs-cyan); font-weight: 700; }
.cs-player-stats {
  margin-top: 6px;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--cs-ink-dim);
}

/* Barra de XP */
.cs-xpbar {
  position: relative;
  height: 10px;
  background: rgba(0, 0, 0, .6);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, .9);
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
  overflow: hidden;
}
.cs-xpbar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--cs-cyan), var(--cs-yellow));
  box-shadow: 0 0 10px rgba(0, 240, 255, .8);
  transition: width .6s cubic-bezier(.25, 1, .3, 1);
}
.cs-xpbar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: cs-hp-sheen 2.8s ease-in-out infinite;
}
.cs-xpbar--end { height: 16px; width: min(380px, 76vw); margin: 10px auto 0; }

/* ----- BOTÕES DO MENU ----- */

.cs-menu-btns {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-level-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: max-height .3s ease, opacity .25s ease, transform .25s ease;
}
.cs-level-picker.cs-open {
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
}
.cs-lvl {
  --cs-cut: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  transition: transform .15s ease, filter .15s ease;
}
.cs-lvl:hover { transform: translateY(-3px); filter: drop-shadow(0 0 10px rgba(0, 240, 255, .55)); }
.cs-lvl:active { transform: scale(.96); }
.cs-lvl-emoji { font-size: 1.7rem; line-height: 1.1; }
.cs-lvl-name {
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .12em;
}
.cs-lvl-desc { font-size: .68rem; font-weight: 600; letter-spacing: .1em; color: var(--cs-ink-dim); }
.cs-lvl[data-level="1"] .cs-lvl-name { color: var(--cs-green); }
.cs-lvl[data-level="2"] .cs-lvl-name { color: var(--cs-cyan); }
.cs-lvl[data-level="3"] .cs-lvl-name { color: var(--cs-magenta); }

.cs-menu-toggles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.cs-menu-footer {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  color: rgba(143, 163, 192, .55);
}

/* --------------------------------------------------------------------------
   6. HUD DE PARTIDA
   -------------------------------------------------------------------------- */

.cs-hud { position: absolute; inset: 0; pointer-events: none; z-index: 15; }

.cs-hud-top {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

/* Cards VOCÊ vs BOT */
.cs-pcard {
  flex: 0 1 330px;
  min-width: 150px;
  padding: 10px 16px 12px;
  pointer-events: none;
  animation: cs-slide-down .4s ease-out both;
}
.cs-pcard::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--cs-yellow);
  border-right: 2px solid var(--cs-yellow);
  opacity: .7;
}
.cs-pcard--foe {
  --cs-frame-grad: linear-gradient(205deg,
      rgba(255, 45, 120, .85), rgba(255, 45, 120, .14) 38%,
      rgba(0, 240, 255, .25) 72%, rgba(0, 240, 255, .8));
}
.cs-pcard-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.cs-pcard--foe .cs-pcard-row { flex-direction: row-reverse; }
.cs-pcard-name {
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: .92rem;
  letter-spacing: .12em;
  color: #fff;
  text-shadow: var(--cs-glow-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-pcard--foe .cs-pcard-name { text-shadow: var(--cs-glow-magenta); }
.cs-pcard-tag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--cs-ink-dim);
  white-space: nowrap;
}

/* ----- HP BAR ----- */

.cs-hpbar {
  position: relative;
  height: 17px;
  background: rgba(0, 0, 0, .58);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .9);
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  overflow: hidden;
}
.cs-pcard--foe .cs-hpbar { clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 100%, 7px 100%); }

.cs-hpbar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, #00c8ff, var(--cs-cyan) 55%, var(--cs-green));
  box-shadow: 0 0 14px rgba(0, 240, 255, .8), inset 0 0 6px rgba(255, 255, 255, .35);
  transition: width .55s cubic-bezier(.25, 1, .35, 1), filter .25s ease;
}
.cs-pcard--foe .cs-hpbar-fill {
  left: auto;
  right: 0;
  background: linear-gradient(270deg, #ff5e3a, var(--cs-magenta) 55%, #ff7ab1);
  box-shadow: 0 0 14px rgba(255, 45, 120, .8), inset 0 0 6px rgba(255, 255, 255, .35);
}
.cs-hpbar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 46%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .4), transparent);
  animation: cs-hp-sheen 2.6s ease-in-out infinite;
}
.cs-hpbar--hit .cs-hpbar-fill { filter: brightness(2.4) saturate(.6); transition: width .55s cubic-bezier(.25,1,.35,1), filter .05s; }
.cs-hpbar--low .cs-hpbar-fill {
  background: linear-gradient(90deg, var(--cs-red), var(--cs-orange)) !important;
  box-shadow: 0 0 16px rgba(255, 59, 59, .95) !important;
  animation: cs-hp-low .65s ease-in-out infinite alternate;
}
.cs-hpbar-num {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 2;
  font-family: var(--cs-font-display);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
  text-shadow: 0 0 4px #000, 0 0 6px #000;
}
.cs-pcard--foe .cs-hpbar-num { right: auto; left: 10px; }

/* ----- CENTRO: VS + TURNO ----- */

.cs-hud-center {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding-top: 2px;
}
.cs-vs {
  font-family: var(--cs-font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: .06em;
  color: var(--cs-yellow);
  text-shadow: var(--cs-glow-yellow);
  animation: cs-vs-pulse 1.8s ease-in-out infinite;
}
.cs-turn {
  --cs-cut: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 18px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .16em;
  color: var(--cs-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, .5);
  white-space: nowrap;
}
.cs-turn--thinking { color: var(--cs-cyan); text-shadow: 0 0 8px rgba(0, 240, 255, .5); }
.cs-turn--thinking .cs-turn-text { animation: cs-blink 1.2s ease-in-out infinite; }
.cs-spinner {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid rgba(0, 240, 255, .25);
  border-top-color: var(--cs-cyan);
  border-radius: 50%;
  animation: cs-spin .7s linear infinite;
}

/* ----- COMBAT LOG ----- */

.cs-log {
  position: absolute;
  top: 112px;
  left: 12px; /* lado esquerdo: não colide com kill feed/streak badge (direita) */
  width: 224px;
  pointer-events: auto;
  --cs-cut: 10px;
  animation: cs-slide-right .4s ease-out both;
}
.cs-log-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .16em;
  color: var(--cs-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, .4);
}
.cs-log-caret { transition: transform .25s ease; font-size: .8rem; }
.cs-log--collapsed .cs-log-caret { transform: rotate(-90deg); }
.cs-log-body {
  max-height: 36vh;
  overflow-y: auto;
  padding: 2px 12px 10px;
  transition: max-height .25s ease, padding .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, .5) transparent;
}
.cs-log--collapsed .cs-log-body { max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.cs-log-body::-webkit-scrollbar { width: 5px; }
.cs-log-body::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, .45); }
.cs-log-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 6px;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .04em;
  padding: 1px 0;
}
.cs-log-num { color: rgba(0, 240, 255, .55); font-weight: 700; }
.cs-log-w { color: #e3fcff; }
.cs-log-b { color: #ffd2e2; }
.cs-log-new { animation: cs-log-flash .6s ease-out; }
.cs-log-empty { font-size: .8rem; color: var(--cs-ink-dim); letter-spacing: .08em; padding: 2px 0 4px; }

/* ----- BOTÕES DE AÇÃO (rodapé) ----- */

.cs-hud-actions {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 96vw;
  pointer-events: auto;
  animation: cs-slide-up .4s ease-out both;
}
.cs-abtn {
  --cs-cut: 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .12em;
  color: var(--cs-ink);
  transition: transform .12s ease, filter .15s ease;
}
.cs-abtn:hover { transform: translateY(-2px); filter: drop-shadow(0 0 10px rgba(0, 240, 255, .6)); }
.cs-abtn:active { transform: translateY(1px) scale(.97); }
.cs-abtn:focus-visible { filter: drop-shadow(0 0 10px var(--cs-yellow)) brightness(1.2); }
.cs-abtn--danger {
  --cs-frame-grad: linear-gradient(155deg, var(--cs-red), rgba(255, 59, 59, .2) 45%, var(--cs-magenta));
  color: #ffb3b3;
}
.cs-abtn--danger:hover { filter: drop-shadow(0 0 10px rgba(255, 59, 59, .7)); }
.cs-abtn--icon { padding: 10px 13px; font-size: .9rem; }

/* --------------------------------------------------------------------------
   7. CAMADA DE MODAIS
   -------------------------------------------------------------------------- */

.cs-modal-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 5, 12, .8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: cs-fade-in .2s ease-out;
}
.cs-modal {
  max-width: min(680px, 94vw);
  max-height: 92vh;
  overflow: hidden auto;
  animation: cs-pop .3s cubic-bezier(.2, 1.4, .35, 1) both;
  scrollbar-width: thin;
}

/* ----- COMO JOGAR ----- */

.cs-help { padding: 26px 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.cs-help-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: 1.4rem;
  letter-spacing: .14em;
  color: var(--cs-cyan);
  text-shadow: var(--cs-glow-cyan);
  text-align: center;
}
.cs-help-sub {
  margin: 0 0 4px;
  text-align: center;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .18em;
  color: var(--cs-ink-dim);
}
.cs-tip {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 12px;
  background: rgba(0, 240, 255, .05);
  border-left: 2px solid var(--cs-cyan);
  animation: cs-slide-right .35s ease-out both;
}
.cs-tip:nth-child(odd) { border-left-color: var(--cs-magenta); background: rgba(255, 45, 120, .05); }
.cs-tip-icon { font-size: 1.4rem; line-height: 1.2; filter: drop-shadow(0 0 6px rgba(0, 240, 255, .4)); }
.cs-tip-name {
  font-family: var(--cs-font-display);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--cs-yellow);
  margin-bottom: 2px;
}
.cs-tip-text { font-size: .95rem; font-weight: 500; line-height: 1.35; color: var(--cs-ink); }
.cs-help-close { margin-top: 6px; align-self: center; min-width: 220px; }

/* ----- PROMOÇÃO: "ESCOLHA SUA ARMA" ----- */

.cs-promo { padding: 28px 26px 26px; text-align: center; }
.cs-promo-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  letter-spacing: .14em;
  color: var(--cs-yellow);
  text-shadow: var(--cs-glow-yellow);
}
.cs-promo-sub {
  margin: 8px 0 18px;
  font-weight: 600;
  font-size: .85rem;
  letter-spacing: .16em;
  color: var(--cs-ink-dim);
}
.cs-promo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cs-promo-card {
  --cs-cut: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 10px 14px;
  transition: transform .15s ease, filter .15s ease;
  animation: cs-pop .35s cubic-bezier(.2, 1.4, .35, 1) both;
}
.cs-promo-card:nth-child(1) { animation-delay: .05s; }
.cs-promo-card:nth-child(2) { animation-delay: .12s; }
.cs-promo-card:nth-child(3) { animation-delay: .19s; }
.cs-promo-card:nth-child(4) { animation-delay: .26s; }
.cs-promo-card:hover {
  transform: translateY(-5px) scale(1.04);
  filter: drop-shadow(0 0 14px rgba(255, 230, 0, .55));
  --cs-frame-grad: linear-gradient(155deg, var(--cs-yellow), rgba(255, 230, 0, .4) 45%, var(--cs-magenta));
}
.cs-promo-card--picked { transform: scale(1.1); filter: drop-shadow(0 0 20px var(--cs-yellow)) brightness(1.4); }
.cs-promo-glyph { font-size: clamp(42px, 9vw, 72px); line-height: 1.05; }
.cs-promo-glyph--w { color: #f4ffff; text-shadow: 0 0 12px rgba(0, 240, 255, .9), 0 0 30px rgba(0, 240, 255, .4); }
.cs-promo-glyph--b { color: #2a2438; text-shadow: 0 0 2px #fff, 0 0 12px rgba(255, 45, 120, .95), 0 0 30px rgba(255, 45, 120, .5); }
.cs-promo-name {
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .14em;
  color: var(--cs-ink);
}
.cs-promo-tag { font-size: .68rem; font-weight: 600; letter-spacing: .12em; color: var(--cs-ink-dim); }

/* ----- TELA DE FIM DE PARTIDA ----- */

.cs-modal--end { width: min(620px, 94vw); }
.cs-end { position: relative; padding: 36px 34px 30px; text-align: center; overflow: hidden; }
.cs-end-rays {
  position: absolute;
  inset: -45%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}
.cs-end--win .cs-end .cs-end-rays,
.cs-modal--end.cs-end--win .cs-end-rays {
  opacity: 1;
  background: repeating-conic-gradient(rgba(255, 230, 0, .07) 0 9deg, transparent 9deg 18deg);
  animation: cs-spin 26s linear infinite;
}
.cs-end-content { position: relative; z-index: 1; }
.cs-end-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 7vw, 3rem);
  letter-spacing: .06em;
  line-height: 1.1;
  animation: cs-title-in .55s cubic-bezier(.2, 1.3, .35, 1) both;
}
.cs-end--win .cs-end-title {
  background: linear-gradient(180deg, #fff7c2, var(--cs-yellow) 45%, #ff9d00);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 230, 0, .65));
}
.cs-end--loss .cs-end-title {
  color: var(--cs-red);
  text-shadow: 0 0 16px rgba(255, 59, 59, .8), 0 0 50px rgba(255, 59, 59, .35);
  animation: cs-title-in .55s cubic-bezier(.2, 1.3, .35, 1) both, cs-shake .5s ease-out .55s;
}
.cs-end--draw .cs-end-title { color: var(--cs-cyan); text-shadow: var(--cs-glow-cyan); }
.cs-end-sub {
  margin: 10px 0 0;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .2em;
  color: var(--cs-ink-dim);
  animation: cs-fade-in .5s ease-out .3s both;
}

.cs-end-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}
.cs-end-stat {
  --cs-cut: 9px;
  flex: 0 1 150px;
  padding: 12px 8px 10px;
  animation: cs-pop .4s cubic-bezier(.2, 1.4, .35, 1) both;
}
.cs-end-stat:nth-child(1) { animation-delay: .25s; }
.cs-end-stat:nth-child(2) { animation-delay: .35s; }
.cs-end-stat:nth-child(3) { animation-delay: .45s; }
.cs-end-stat-num {
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: 1.7rem;
  color: var(--cs-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, .5);
}
.cs-end-stat-label {
  margin-top: 2px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--cs-ink-dim);
}

.cs-end-xp { margin-top: 22px; }
.cs-end-xp-num {
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .08em;
  color: var(--cs-yellow);
  text-shadow: var(--cs-glow-yellow);
}
.cs-end-levelup {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 18px;
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .18em;
  color: #0a0a14;
  background: linear-gradient(90deg, var(--cs-yellow), #ff9d00);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  box-shadow: 0 0 20px rgba(255, 230, 0, .6);
  animation: cs-levelup .5s cubic-bezier(.2, 1.6, .35, 1) both;
}

.cs-end-banner {
  margin: 16px auto 0;
  max-width: 420px;
  padding: 10px 18px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .14em;
  border: 1px solid currentColor;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  background: rgba(0, 0, 0, .4);
  animation: cs-banner-in .45s ease-out both;
}
.cs-end-banner--rank { color: var(--cs-cyan); animation-delay: .6s; box-shadow: 0 0 16px rgba(0, 240, 255, .25); }
.cs-end-banner--skin { color: var(--cs-magenta); animation-delay: .75s; box-shadow: 0 0 16px rgba(255, 45, 120, .25); }

.cs-end-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
  animation: cs-fade-in .5s ease-out .6s both;
}
.cs-end-btns .cs-btn { width: auto; min-width: 170px; padding: 13px 22px; font-size: .85rem; }

/* --------------------------------------------------------------------------
   8. ARSENAL (SKINS)
   -------------------------------------------------------------------------- */

.cs-skins-head { width: 100%; display: flex; align-items: center; gap: 14px; }
.cs-back-btn {
  --cs-cut: 8px;
  flex: 0 0 auto;
  padding: 10px 16px;
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .12em;
  color: var(--cs-ink);
  transition: transform .12s ease, filter .15s ease;
}
.cs-back-btn:hover { transform: translateX(-3px); filter: drop-shadow(0 0 8px rgba(0, 240, 255, .5)); }
.cs-skins-title {
  margin: 0;
  flex: 1;
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  letter-spacing: .14em;
  color: var(--cs-magenta);
  text-shadow: var(--cs-glow-magenta);
}
.cs-skins-sub {
  width: 100%;
  margin: -6px 0 4px;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .2em;
  color: var(--cs-ink-dim);
}

.cs-skins-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.cs-skin-card {
  --cs-cut: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 20px 10px 16px;
  transition: transform .15s ease, filter .15s ease;
  animation: cs-pop .35s cubic-bezier(.2, 1.4, .35, 1) both;
}
.cs-skin-card:nth-child(1) { animation-delay: .04s; }
.cs-skin-card:nth-child(2) { animation-delay: .09s; }
.cs-skin-card:nth-child(3) { animation-delay: .14s; }
.cs-skin-card:nth-child(4) { animation-delay: .19s; }
.cs-skin-card:nth-child(5) { animation-delay: .24s; }
.cs-skin-card:hover { transform: translateY(-4px); filter: drop-shadow(0 0 12px rgba(0, 240, 255, .5)); }
.cs-skin-card:active { transform: scale(.97); }

.cs-skin-swatch {
  width: 62px;
  height: 62px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow: 0 0 18px rgba(0, 240, 255, .4);
}
.cs-skin-swatch--neon   { background: linear-gradient(135deg, var(--cs-cyan) 49%, var(--cs-magenta) 51%); }
.cs-skin-swatch--lava   { background: linear-gradient(135deg, #ff7300 49%, #9ad8ff 51%); }
.cs-skin-swatch--gold   { background: linear-gradient(135deg, #ffd24a 49%, #cfd8e3 51%); }
.cs-skin-swatch--matrix { background: linear-gradient(135deg, #16ff70 49%, #0a5c2b 51%); }
.cs-skin-swatch--galaxy { background: linear-gradient(135deg, #9d4dff 49%, #ff5ed2 51%); }

.cs-skin-emoji { font-size: 1.3rem; line-height: 1; margin-top: 2px; }
.cs-skin-name {
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .16em;
  color: var(--cs-ink);
}
.cs-skin-status {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--cs-cyan);
}

.cs-skin--on {
  --cs-frame-grad: linear-gradient(155deg, var(--cs-yellow), rgba(255, 230, 0, .35) 45%, var(--cs-green));
  animation: cs-pulse-glow 2s ease-in-out infinite;
}
.cs-skin--on .cs-skin-status { color: var(--cs-green); }
.cs-skin--locked { filter: grayscale(.85) brightness(.62); }
.cs-skin--locked:hover { transform: none; filter: grayscale(.85) brightness(.75); }
.cs-skin--locked .cs-skin-status { color: var(--cs-yellow); }

/* --------------------------------------------------------------------------
   9. TOAST
   -------------------------------------------------------------------------- */

.cs-toast-wrap {
  position: absolute;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 94vw;
}
.cs-toast {
  font-family: var(--cs-font-display);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cs-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, .4);
  background: rgba(12, 12, 24, .94);
  border: 1px solid rgba(255, 230, 0, .55);
  box-shadow: 0 0 16px rgba(255, 230, 0, .25);
  padding: 11px 20px;
  max-width: 94vw;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  animation: cs-toast-in .25s cubic-bezier(.2, 1.4, .35, 1) both;
}
.cs-toast--out { animation: cs-toast-out .4s ease-in both; }

/* --------------------------------------------------------------------------
   10. LOADING (usado pelo index.html)
   -------------------------------------------------------------------------- */

#cs-loading, .cs-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--cs-bg);
  font-family: var(--cs-font-display);
  letter-spacing: .3em;
  color: var(--cs-cyan);
  text-shadow: var(--cs-glow-cyan);
  transition: opacity .45s ease;
}
#cs-loading.cs-loading--done, .cs-loading.cs-loading--done { opacity: 0; pointer-events: none; }

.cs-loading-logo {
  font-size: clamp(26px, 5vw, 54px);
  font-weight: 900;
  animation: cs-float 2.2s ease-in-out infinite;
}
.cs-loading-logo span { color: var(--cs-yellow); text-shadow: var(--cs-glow-yellow, 0 0 14px rgba(255,230,0,.8)); }
.cs-loading-bar {
  width: min(320px, 70vw);
  height: 10px;
  border: 1px solid var(--cs-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, .35);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  overflow: hidden;
}
.cs-loading-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--cs-cyan), var(--cs-magenta));
  animation: cs-loading-slide 1s ease-in-out infinite alternate;
}
@keyframes cs-loading-slide {
  from { transform: translateX(-40%); }
  to   { transform: translateX(260%); }
}
.cs-loading-tip { font-size: 13px; opacity: .75; letter-spacing: .4em; }

/* --------------------------------------------------------------------------
   11. KEYFRAMES
   -------------------------------------------------------------------------- */

@keyframes cs-spin { to { transform: rotate(360deg); } }

@keyframes cs-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

@keyframes cs-bolt {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 6px rgba(255, 230, 0, .6)); }
  45%      { transform: scale(1.18) rotate(-6deg); filter: drop-shadow(0 0 18px rgba(255, 230, 0, .95)); }
  55%      { transform: scale(.96) rotate(4deg); }
}

@keyframes cs-glitch-a {
  0%, 85%  { opacity: 0; }
  86%      { opacity: .85; transform: translate(-5px, -2px); }
  88%      { opacity: 0; }
  92%      { opacity: .7;  transform: translate(4px, 1px); }
  93%      { opacity: 0; }
}
@keyframes cs-glitch-b {
  0%, 78%  { opacity: 0; }
  79%      { opacity: .8; transform: translate(5px, 2px); }
  81%      { opacity: 0; }
  90%      { opacity: .6; transform: translate(-4px, 3px); }
  91%      { opacity: 0; }
}

@keyframes cs-grid-scroll {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 46px, 0 0; }
}

@keyframes cs-scanline {
  from { transform: translateY(-22vh); }
  to   { transform: translateY(112vh); }
}

@keyframes cs-pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 230, 0, .25)); }
  50%      { filter: drop-shadow(0 0 14px rgba(255, 230, 0, .6)); }
}

@keyframes cs-vs-pulse {
  0%, 100% { transform: scale(1) skewX(-6deg); opacity: .92; }
  50%      { transform: scale(1.12) skewX(-6deg); opacity: 1; }
}

@keyframes cs-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

@keyframes cs-hp-sheen {
  0%   { left: -60%; }
  60%  { left: 115%; }
  100% { left: 115%; }
}

@keyframes cs-hp-low {
  from { opacity: 1; }
  to   { opacity: .55; }
}

@keyframes cs-pop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes cs-title-in {
  from { transform: scale(2.4); opacity: 0; filter: blur(8px); }
  to   { transform: scale(1); opacity: 1; filter: blur(0); }
}

@keyframes cs-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes cs-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cs-slide-up {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes cs-slide-down {
  from { transform: translateY(-18px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes cs-slide-left {
  from { transform: translateX(26px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes cs-slide-right {
  from { transform: translateX(-18px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes cs-log-flash {
  from { background: rgba(0, 240, 255, .35); }
  to   { background: transparent; }
}

@keyframes cs-toast-in {
  from { transform: translateY(18px) scale(.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cs-toast-out {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(-14px); opacity: 0; }
}

@keyframes cs-levelup {
  from { transform: scale(0) rotate(-8deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes cs-banner-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   12. RESPONSIVO (mínimo 360px)
   -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .cs-pcard { flex-basis: 44vw; min-width: 0; padding: 8px 10px 10px; }
  .cs-pcard-name { font-size: .72rem; }
  .cs-pcard-tag { font-size: .6rem; }
  .cs-hpbar { height: 13px; }
  .cs-hpbar-num { font-size: .52rem; right: 7px; }
  .cs-pcard--foe .cs-hpbar-num { left: 7px; }
  .cs-vs { font-size: 1.05rem; }
  .cs-turn { font-size: .62rem; padding: 6px 11px; letter-spacing: .1em; }
  .cs-hud-center { gap: 5px; }
  .cs-log { width: 178px; top: 104px; left: 8px; }
  .cs-log-row { font-size: .85rem; }
  .cs-hud-actions { gap: 6px; bottom: 10px; }
  .cs-abtn { padding: 9px 12px; font-size: .64rem; }
  .cs-abtn-extra { display: none; }
  .cs-promo-grid { grid-template-columns: repeat(2, 1fr); }
  .cs-end { padding: 26px 18px 22px; }
  .cs-end-stats { gap: 8px; }
  .cs-end-btns { flex-direction: column; align-items: center; }
  .cs-end-btns .cs-btn { width: 100%; max-width: 280px; }
  .cs-player-stats { font-size: .74rem; }
  .cs-skins-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
}

@media (max-width: 430px) {
  .cs-menu-inner { padding: 20px 12px 32px; gap: 14px; }
  .cs-logo { font-size: clamp(2rem, 11.5vw, 2.9rem); }
  .cs-tagline { letter-spacing: .28em; text-indent: .28em; }
  .cs-player-card { padding: 11px 14px; gap: 12px; }
  .cs-player-rank-icon { font-size: 1.9rem; }
  .cs-btn { padding: 13px 14px; font-size: .85rem; letter-spacing: .1em; }
  .cs-lvl-desc { display: none; }
  .cs-log { width: 152px; }
  .cs-turn { max-width: 40vw; overflow: hidden; }
  .cs-turn-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .cs-help { padding: 20px 14px 18px; }
  .cs-tip { gap: 10px; padding: 8px 10px; }
}

/* Acessibilidade: respeita usuários sem animação */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
