/* Arena de duel. Fisier separat, ca sa nu ingroase stilul comun al celorlalte aplicatii.
   CSP-ul site-ului are style-src 'self' fara 'unsafe-inline': aici nu exista niciun stil
   in marcaj, iar valorile dinamice (latimea barelor si a stelelor) se pun din JS prin CSSOM.

   Regula de aranjare: rezultatul incape intr-un ecran, fara derulare. Cine a castigat,
   stelele si cate o propozitie stau sus; rundele si barele se deschid la cerere. */

.duel {
  --a:  #ff7a3d;  --a2: #ffc043;
  --b:  #3aa0ff;  --b2: #8b5cff;
  --pop: #b14bff;
  position: relative;
}
:root[data-theme="light"] .duel {
  --a: #e8561f; --a2: #f59e0b;
  --b: #1b7fd6; --b2: #5b46d6;
  --pop: #8b3ddb;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .duel {
    --a: #e8561f; --a2: #f59e0b;
    --b: #1b7fd6; --b2: #5b46d6;
    --pop: #8b3ddb;
  }
}

/* ── fundal viu, dar discret ──
   Fara latire pe orizontala: un element mai lat decat pagina ar aduce derulare
   laterala pe telefon. Masca radiala sterge muchiile, ca sa para lumina, nu banda. */
.duel-bg {
  position: absolute; inset: -10px 0 auto; height: 540px;
  z-index: -1; overflow: hidden; pointer-events: none;
  -webkit-mask-image: radial-gradient(115% 72% at 50% 26%, #000 22%, transparent 72%);
  mask-image: radial-gradient(115% 72% at 50% 26%, #000 22%, transparent 72%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(78px); opacity: 0.42; }
.blob.b1 { width: 44%; padding-bottom: 44%; height: 0; top: 2%;  left: -6%;  background: var(--a); animation: float1 19s ease-in-out infinite; }
.blob.b2 { width: 42%; padding-bottom: 42%; height: 0; top: 6%;  right: -6%; background: var(--b); animation: float2 23s ease-in-out infinite; }
.blob.b3 { width: 36%; padding-bottom: 36%; height: 0; top: 38%; left: 34%;  background: var(--pop); opacity: 0.3; animation: float3 27s ease-in-out infinite; }

/* ── pregatire ── */

.corners { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 620px) { .corners { grid-template-columns: 1fr; } }

.corner {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 18px 16px; background: var(--bg-soft);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}
.corner::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.corner.a::before { background: linear-gradient(90deg, var(--a), var(--a2)); }
.corner.b::before { background: linear-gradient(90deg, var(--b), var(--b2)); }
.corner.a:focus-within { border-color: var(--a); box-shadow: 0 10px 30px rgba(255,122,61,0.18); transform: translateY(-2px); }
.corner.b:focus-within { border-color: var(--b); box-shadow: 0 10px 30px rgba(58,160,255,0.18); transform: translateY(-2px); }

.corner > label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.corner .tag {
  display: grid; place-items: center; min-width: 24px; height: 24px; flex: none;
  padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 800; color: #fff;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.corner .tag.named { padding: 0 10px; letter-spacing: 0.01em; }
.corner.a .tag { background: linear-gradient(135deg, var(--a), var(--a2)); }
.corner.b .tag { background: linear-gradient(135deg, var(--b), var(--b2)); }
.corner .say { min-height: 18px; margin: 8px 0 0; font-weight: 600; }

/* Butonul de pornire: centrat si departat de campuri, ca sa nu para lipit de ele. */
.start-row { display: flex; justify-content: center; margin-top: 30px; }
.btn.go {
  padding: 15px 42px; font-size: 17px; font-weight: 700; border: none;
  border-radius: 999px; color: #fff; letter-spacing: 0.01em;
  background: linear-gradient(120deg, var(--a), var(--pop) 55%, var(--b));
  background-size: 200% 100%;
  box-shadow: 0 10px 28px rgba(177,75,255,0.28);
  transition: transform 0.18s, box-shadow 0.22s, background-position 0.6s;
}
.btn.go:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(177,75,255,0.4); background-position: 100% 0; color: #fff; }
.btn.go:active { transform: translateY(0); }
.btn.go:disabled { opacity: 0.6; transform: none; }

/* ── scena rezultatului: tot ce conteaza, intr-un ecran ── */

.stage {
  position: relative; border-radius: 22px; padding: 18px 16px 20px;
  background: var(--bg-soft); border: 1px solid var(--line);
  overflow: hidden;
}
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

.fighters {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: start; gap: 12px;
}

.fighter { margin: 0; text-align: center; position: relative; }

/* Insigna pastreaza loc si cand e goala, ca cele doua coloane sa ramana aliniate. */
.badge {
  display: block; min-height: 26px; margin-bottom: 4px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  opacity: 0;
}
.fighter .badge.on {
  opacity: 1; padding: 4px 12px; border-radius: 999px;
  width: fit-content; margin-inline: auto; border: 1.5px solid currentColor;
}
.fighter.a .badge.on { color: var(--a); }
.fighter.b .badge.on { color: var(--b); }
.badge.draw { color: var(--ink-soft); }

.fighter .shot {
  position: relative; display: inline-block; padding: 4px; border-radius: 18px;
  transition: transform 0.14s ease-out, box-shadow 0.24s; will-change: transform;
  transform-style: preserve-3d;
}
.fighters.tilting .shot { box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42); }
.fighter.a .shot { background: linear-gradient(135deg, var(--a), var(--a2)); }
.fighter.b .shot { background: linear-gradient(135deg, var(--b), var(--b2)); }
.fighter img { max-height: 150px; border-radius: 14px; display: block; background: var(--bg-soft); }
.fighter figcaption { margin-top: 9px; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }

.crown {
  position: absolute; top: 18px; left: 0; right: 0;
  font-size: 28px; line-height: 1; pointer-events: none; z-index: 3;
  filter: drop-shadow(0 3px 8px rgba(255,192,67,0.55));
}

.fighter.lost { opacity: 0.62; }
.fighter.a.won .shot { box-shadow: 0 0 0 3px var(--a2), 0 12px 34px rgba(255,192,67,0.32); }
.fighter.b.won .shot { box-shadow: 0 0 0 3px var(--b2), 0 12px 34px rgba(139,92,255,0.32); }

/* ── stele, cu jumatati ──
   Doua straturi: cele goale dedesubt, cele pline taiate la procentul cerut. */
.stars { position: relative; display: inline-block; white-space: nowrap; letter-spacing: 2px; }
.stars .base { color: var(--line-strong); }
.stars .fill {
  position: absolute; left: 0; top: 0; width: 0;
  overflow: hidden; white-space: nowrap;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.stars.a .fill { color: var(--a2); }
.stars.b .fill { color: var(--b2); }
.stars.mini { font-size: 13px; letter-spacing: 1px; }

.rate { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 21px; }
.rate .rating { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

.oneline { margin: 9px auto 0; max-width: 26ch; font-size: 13px; line-height: 1.45; color: var(--ink-soft); }

.vs { position: relative; display: grid; place-items: center; width: 70px; height: 70px; margin-top: 46px; }
.vs .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--a), var(--pop), var(--b), var(--a));
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%);
  mask: radial-gradient(circle, transparent 60%, #000 61%);
}
.vs .core {
  position: relative; display: grid; place-items: center;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-weight: 800; font-size: 16px; letter-spacing: 0.04em; color: var(--ink);
}
.vs .zap { position: absolute; top: -15px; font-size: 17px; }

/* ── actiuni si detalii ── */

/* Verdictul e partea cea mai citita, deci sta la vedere si respira. */
.out.verdict {
  margin-top: 18px; padding: 18px 20px; border-radius: 16px;
  font-size: 15.5px; line-height: 1.6;
  border: 1px solid var(--line); background: var(--bg-soft);
  border-left: 4px solid var(--pop);
}

.row.actions { justify-content: center; margin-top: 18px; }
.btn.wa {
  border-color: #25d366; color: #25d366; font-weight: 650;
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn.wa:hover { background: rgba(37, 211, 102, 0.12); border-color: #25d366; color: #25d366; }
.btn.wa::before { content: '💬 '; }
.btn.wide { display: block; width: 100%; margin-top: 12px; padding: 11px; border-radius: 12px; font-weight: 600; }
.detail-body { display: none; margin-top: 16px; }
.detail-body.open { display: block; animation: riseIn 0.35s ease-out both; }

.round { margin-bottom: 18px; opacity: 0; }
.round.show { opacity: 1; }

.rhead { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.rhead .cat { font-weight: 700; }
.rhead .spacer { flex: 1; }
.rhead .sep { color: var(--ink-soft); font-size: 11px; font-style: normal; }

/* Inaltimea trebuie sa fie pe .half: barele au height:100%, iar un parinte
   fara inaltime proprie le-ar face de zero pixeli — invizibile. */
.track { display: flex; align-items: center; height: 16px; }
.track .half { flex: 1; display: flex; height: 16px; overflow: hidden; background: var(--line); }
.track .half.l { justify-content: flex-end; border-radius: 8px 0 0 8px; }
.track .half.r { justify-content: flex-start; border-radius: 0 8px 8px 0; }
.track .mid { width: 3px; height: 20px; background: var(--ink-soft); opacity: 0.5; flex: none; border-radius: 2px; }
.track .bar { display: block; width: 0; height: 100%; position: relative; overflow: hidden; }
.track .bar.ba { background: linear-gradient(90deg, var(--a2), var(--a)); border-radius: 8px 0 0 8px; }
.track .bar.bb { background: linear-gradient(90deg, var(--b), var(--b2)); border-radius: 0 8px 8px 0; }
.track .bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  transform: translateX(-120%);
}
.round.show .bar { transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1); }
.round.show .bar::after { animation: sheen 1.1s ease-out 0.45s 1; }
.round .note { margin: 7px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.status { color: var(--ink-soft); font-size: 14px; font-weight: 600; text-align: center; margin-top: 14px; }

/* Pe telefon cele doua imagini plus discul VS nu incap la marimea mare. */
@media (max-width: 560px) {
  .stage { padding: 14px 10px 16px; }
  .fighters { gap: 6px; }
  .fighter img { max-height: 96px; }
  .fighter figcaption { font-size: 13px; }
  .rate { font-size: 17px; gap: 5px; }
  .rate .rating { font-size: 12px; }
  .oneline { font-size: 12px; max-width: 20ch; }
  .badge { font-size: 10px; letter-spacing: 0.05em; }
  .fighter .badge.on { padding: 3px 8px; }
  .vs { width: 50px; height: 50px; margin-top: 40px; }
  .vs .core { width: 40px; height: 40px; font-size: 13px; }
  .vs .zap { top: -12px; font-size: 14px; }
  .crown { top: 14px; font-size: 22px; }
}

/* ── miscare ── */

@keyframes float1 { 50% { transform: translate(26px, 22px) scale(1.14); } }
@keyframes float2 { 50% { transform: translate(-30px, 16px) scale(1.1); } }
@keyframes float3 { 50% { transform: translate(18px, -20px) scale(1.18); } }
@keyframes inLeft  { from { opacity: 0; transform: translateX(-38px); } }
@keyframes inRight { from { opacity: 0; transform: translateX(38px); } }
@keyframes slam {
  0%   { opacity: 0; transform: scale(2.6) rotate(-14deg); }
  55%  { opacity: 1; transform: scale(0.8) rotate(4deg); }
  75%  { transform: scale(1.1) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fightPulse { 50% { opacity: 0.3; transform: scale(0.9); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes sheen { to { transform: translateX(120%); } }
@keyframes crownDrop {
  0%   { opacity: 0; transform: translateY(-22px) rotate(-22deg); }
  70%  { transform: translateY(3px) rotate(5deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}
@keyframes badgePop {
  0%   { opacity: 0; transform: scale(0.5); }
  55%  { opacity: 1; transform: scale(1.16); }
  100% { opacity: 1; transform: scale(1); }
}

.arena .fighter.a { animation: inLeft 0.5s ease-out both; }
.arena .fighter.b { animation: inRight 0.5s ease-out both; }
.arena .vs { animation: slam 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both; }
.vs .ring { animation: spin 7s linear infinite; }
.vs.fighting .zap { animation: fightPulse 0.9s ease-in-out infinite; }
.crown { animation: crownDrop 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
.fighter .badge.on { animation: badgePop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Cine a cerut mai putina miscare vede totul dintr-o data, complet. */
@media (prefers-reduced-motion: reduce) {
  .arena .fighter.a, .arena .fighter.b, .arena .vs, .vs .ring,
  .round.show, .crown, .fighter .badge.on, .detail-body.open,
  .blob.b1, .blob.b2, .blob.b3,
  .round.show .bar::after { animation: none; }
  .vs.fighting .zap { animation: none; }
  .round.show .bar, .stars .fill, .fighter .shot { transition: none; }
  .corner, .btn.go { transition: none; }
}
