/* Widoki gry: ekrany, pojedynek, odliczanie, werdykt. */

.screen { display: none; }
.screen.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.wrap.narrow { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; }
.wrap.narrow.center { text-align: center; }
.wrap.narrow.center .panel, .wrap.narrow.center .stage { text-align: left; }

.stage.solo { aspect-ratio: 4 / 3; max-width: 520px; margin: 0 auto; }

/* --- pojedynek --- */

.duel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 10px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (min-width: 860px) {
  .duel { grid-template-columns: 1fr 130px 1fr; align-items: start; gap: 14px; padding: 18px; }
}

.fighter .stage { aspect-ratio: 4 / 3; }
.fighter .stage video { object-fit: cover; }
#oppCam { transform: none; }

.fighter .score {
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.fighter .who { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
.fighter .cm {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
.fighter .cm small { font-size: 16px; color: var(--muted); margin-left: 5px; font-weight: 700; }
.fighter .best { font-size: 12px; color: var(--muted); margin-top: 6px; }

.bar {
  height: 9px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 9px;
  border: 1px solid var(--line);
}
.bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.fighter.leading .score { border-color: rgba(88, 214, 141, 0.55); box-shadow: 0 0 0 1px rgba(88, 214, 141, 0.25); }
.fighter.leading .cm { color: var(--win); }

.middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
}
.middle .timer {
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}
.middle .timer.hot { color: var(--lose); animation: pulse 0.5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.middle .vs { font-size: 13px; letter-spacing: 3px; color: var(--muted); font-weight: 800; }

.stage .waiting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  background: repeating-linear-gradient(45deg, #14100c, #14100c 12px, #171310 12px, #171310 24px);
}
.stage .waiting.hidden { display: none; }

.countdown {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: min(38vw, 260px);
  font-weight: 900;
  color: var(--accent);
  background: rgba(13, 11, 9, 0.72);
  backdrop-filter: blur(3px);
  z-index: 50;
  pointer-events: none;
}
.countdown.show { display: flex; animation: pop 0.4s ease; }
@keyframes pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- narzędzia w kadrze --- */

.stage .tools {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  gap: 6px;
  z-index: 5;
}
button.icon {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 17px;
  border-radius: 10px;
  background: rgba(13, 11, 9, 0.75);
  border: 1px solid var(--line);
  color: var(--ink);
  backdrop-filter: blur(6px);
}
button.icon.off { opacity: 0.45; }

/* --- wstrząs kadru --- */

.shake { animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.shake-hard { animation: shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); animation-iteration-count: 1; }
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 2px, 0); }
  40%, 60% { transform: translate3d(7px, -1px, 0); }
}
.shake-hard { animation-name: shakeHard; }
@keyframes shakeHard {
  10%, 90% { transform: translate3d(-5px, 1px, 0) rotate(-0.4deg); }
  20%, 80% { transform: translate3d(9px, -4px, 0) rotate(0.5deg); }
  30%, 50%, 70% { transform: translate3d(-14px, 4px, 0) rotate(-0.7deg); }
  40%, 60% { transform: translate3d(14px, -3px, 0) rotate(0.7deg); }
}

/* --- werdykt --- */

.verdict {
  font-size: clamp(40px, 11vw, 82px);
  font-weight: 900;
  letter-spacing: -2px;
  margin: 30px 0 6px;
  line-height: 1;
}
.verdict.win { color: var(--win); }
.verdict.lose { color: var(--lose); }
