/* ══════════════════════════════════════
   POKÉMON VERSUS — Styles
══════════════════════════════════════ */

/* ── SCREENS ── */
.vs-screen {
  display: none;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 40px;
  animation: fadeIn .25s ease;
}
.vs-screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARD ── */
.vs-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  padding: 32px 28px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 48px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.vs-enter-card { max-width: 400px; }
.vs-results-card { max-width: 480px; }

/* ── LOGO ── */
.vs-logo {
  font-family: 'Press Start 2P', sans-serif;
  font-size: clamp(14px, 3vw, 18px);
  color: #fff;
  text-align: center;
  line-height: 1.6;
}
.vs-logo span {
  display: block;
  color: var(--gold);
  font-size: clamp(18px, 4.5vw, 26px);
  margin-top: 4px;
}

.vs-sub {
  text-align: center;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  margin: 0;
}
.vs-sub strong { color: var(--gold); }

/* ── FORM FIELDS ── */
.vs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-label {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 9px;
  color: rgba(255,255,255,.55);
  letter-spacing: .06em;
}

.vs-input {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  color: #fff;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  box-sizing: border-box;
}
.vs-input::placeholder { color: rgba(255,255,255,.3); }
.vs-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(251,191,36,.18);
}

.code-input {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 22px;
  letter-spacing: .25em;
  text-align: center;
  text-transform: uppercase;
}

/* ── STEPPER ── */
.vs-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  overflow: hidden;
}
.vs-stepper button {
  background: rgba(255,255,255,.08);
  border: none;
  color: #fff;
  font-size: 20px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .15s;
  line-height: 1;
}
.vs-stepper button:hover { background: rgba(255,255,255,.18); }
.vs-stepper span {
  flex: 1;
  text-align: center;
  font-family: 'Press Start 2P', sans-serif;
  font-size: 14px;
  color: #fff;
}
#val-difficulty { font-size: 8px; letter-spacing: .04em; }

/* ── BUTTONS ── */
.vs-btn {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 11px;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .2s;
  letter-spacing: .04em;
  width: 100%;
}
.vs-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.vs-btn:active:not(:disabled) { transform: translateY(0); }
.vs-btn:disabled { opacity: .45; cursor: not-allowed; }

.vs-btn.primary  { background: var(--gold); color: #1a1000; }
.vs-btn.secondary { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.vs-btn.danger   { background: rgba(220,50,50,.75); color: #fff; }
.vs-btn.sm       { font-size: 9px; padding: 10px 16px; }

.vs-btn-row {
  display: flex;
  gap: 10px;
}
.vs-btn-row .vs-btn { flex: 1; }

/* ── LOBBY OPTIONS ── */
.vs-lobby-options {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.vs-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.vs-panel-title {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 9px;
  color: var(--gold);
  margin: 0;
  letter-spacing: .06em;
}
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  position: relative;
}
.vs-divider::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,.12);
}
.vs-divider span {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 8px;
  color: rgba(255,255,255,.35);
  background: #0f0e1a;
  padding: 6px 0;
  position: relative;
  z-index: 1;
}

@media (max-width: 520px) {
  .vs-lobby-options { flex-direction: column; }
  .vs-divider { flex-direction: row; padding: 4px 0; }
  .vs-divider::before { top: 50%; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }
  .vs-divider span { padding: 0 10px; }
}

/* ── ERROR ── */
.vs-error {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 14px;
  color: #ff6b6b;
  text-align: center;
  margin: 0;
}

/* ── BACK LINK ── */
.vs-back-link {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  transition: color .2s;
}
.vs-back-link:hover { color: rgba(255,255,255,.75); }

/* ══════════════════════════════════════
   WAITING ROOM
══════════════════════════════════════ */
.vs-room-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vs-room-label {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 8px;
  color: rgba(255,255,255,.4);
  letter-spacing: .1em;
}
.vs-room-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.vs-room-code {
  font-family: 'Press Start 2P', sans-serif;
  font-size: clamp(22px, 7vw, 34px);
  color: var(--gold);
  letter-spacing: .25em;
}
.vs-copy-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .2s;
}
.vs-copy-btn:hover { background: rgba(255,255,255,.18); }
.vs-copy-btn svg { width: 18px; height: 18px; fill: currentColor; }

.vs-config-summary {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* Players list */
.vs-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.vs-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.08);
}
.vs-player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', sans-serif;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.vs-player-name {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}
.vs-player-badge {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 7px;
  background: var(--gold);
  color: #1a1000;
  border-radius: 6px;
  padding: 3px 7px;
}
.vs-player-me { font-size: 7px; color: rgba(255,255,255,.4); font-family:'Press Start 2P',sans-serif; }

.vs-status-msg {
  text-align: center;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 14px;
  color: rgba(255,255,255,.45);
  margin: 0;
}

/* ══════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════ */
#screen-game {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  min-height: 100dvh;
}

.vs-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,.45);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.vs-game-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vs-round-indicator {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 10px;
  color: var(--gold);
}
.vs-room-tag {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,.4);
  letter-spacing: .06em;
}

.vs-scoreboard-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: #fff;
  font-family: 'Press Start 2P', sans-serif;
  font-size: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .2s;
}
.vs-scoreboard-toggle:hover { background: rgba(255,255,255,.16); }
.vs-scoreboard-toggle svg { width: 16px; height: 16px; fill: currentColor; }

/* Scoreboard panel */
.vs-scoreboard {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  background: rgba(0,0,0,.5);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.vs-scoreboard.open { max-height: 260px; }

.vs-scoreboard-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  max-height: 250px;
  overflow-y: auto;
}

.vs-sb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.vs-sb-rank {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 9px;
  color: rgba(255,255,255,.4);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.vs-sb-rank.top1 { color: var(--gold); }
.vs-sb-rank.top2 { color: #c0c0c0; }
.vs-sb-rank.top3 { color: #cd7f32; }
.vs-sb-name {
  flex: 1;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.vs-sb-name.is-me { color: var(--gold); }
.vs-sb-score {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 10px;
  color: #fff;
}
.vs-sb-last {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  font-family: 'Pixelify Sans', sans-serif;
}
.vs-sb-last.got-correct { color: var(--correct); }
.vs-sb-last.got-wrong   { color: var(--wrong); }

/* Timer bar */
#vs-timer-bar-wrap {
  position: relative;
  height: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 0 6px;
  transition: background .15s;
}
#vs-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--gold);
  transform-origin: left;
  transition: background .5s;
}
#vs-timer-bar.warning { background: var(--wrong); }

@keyframes timeup-flash {
  0%   { background: rgba(239,68,68,.7); }
  100% { background: rgba(255,255,255,.1); }
}
#vs-timer-bar-wrap.timeup {
  animation: timeup-flash .38s ease-out forwards;
}

/* ══════════════════════════════════════
   COUNTDOWN OVERLAY
══════════════════════════════════════ */
#vs-countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,5,18,.9);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
#vs-countdown-overlay.show {
  display: flex;
}

.vs-countdown-num {
  font-family: 'Press Start 2P', sans-serif;
  font-size: clamp(64px, 20vw, 120px);
  color: var(--gold);
  animation: countPop .8s ease infinite;
}
@keyframes countPop {
  0%   { transform: scale(1.2); opacity: .6; }
  50%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.2); opacity: .6; }
}

/* ══════════════════════════════════════
   RESULTS SCREEN
══════════════════════════════════════ */
.vs-results-title {
  font-family: 'Press Start 2P', sans-serif;
  font-size: clamp(12px, 3.5vw, 16px);
  color: var(--gold);
  text-align: center;
  line-height: 1.7;
}

.vs-final-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vs-final-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
}
.vs-final-row.rank-1 {
  background: rgba(251,191,36,.12);
  border-color: rgba(251,191,36,.35);
}
.vs-final-row.rank-2 { background: rgba(192,192,192,.08); }
.vs-final-row.rank-3 { background: rgba(205,127,50,.08); }
.vs-final-row.is-me  { outline: 2px solid rgba(251,191,36,.45); }

.vs-final-rank {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 14px;
  width: 28px;
  text-align: center;
}
.rank-1 .vs-final-rank { color: var(--gold); }
.rank-2 .vs-final-rank { color: #c0c0c0; }
.rank-3 .vs-final-rank { color: #cd7f32; }

.vs-final-name {
  flex: 1;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.vs-final-score {
  font-family: 'Press Start 2P', sans-serif;
  font-size: 12px;
  color: #fff;
}
.vs-final-correct {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 13px;
  color: var(--correct);
}
