/* ═══════════════════════════════════════════════════════════════════
   Játékgyűjtemény — globális stílus
   iPad portré mód, kétjátékos, érintőképernyő
═══════════════════════════════════════════════════════════════════ */

/* ── CSS custom properties ──────────────────────────────────────── */
:root {
  --p1-color:      #E24B4A;
  --p2-color:      #378ADD;
  --neutral-bg:    #1a1a2e;
  --surface:       #16213e;
  --center-height: 40px;
  --half-height:   calc((100dvh - var(--center-height)) / 2);
  --touch-min:     60px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body ───────────────────────────────────────────────────────── */
body {
  margin: 0;
  overflow: hidden;
  height: 100dvh;
  background: var(--neutral-bg);
  font-family: system-ui, -apple-system, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── App root ───────────────────────────────────────────────────── */
#app {
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ── Screen (fullscreen layer, menu or game) ────────────────────── */
.screen {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ── Player zones ───────────────────────────────────────────────── */
.player1-zone {
  height: var(--half-height);
  flex-shrink: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--p1-color) 8%, var(--surface));
  position: relative;
}

.player2-zone {
  height: var(--half-height);
  flex-shrink: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--p2-color) 8%, var(--surface));
  transform: rotate(180deg);
  position: relative;
}

/* ── Center bar ─────────────────────────────────────────────────── */
.center-bar {
  height: var(--center-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--surface);
  border-top:    1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 10;
}

.app-title {
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Game selection grid ────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  padding: 8px;
  height: 100%;
  width: 100%;
}

/* ── Game card ──────────────────────────────────────────────────── */
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch-min);
  min-width:  var(--touch-min);
  padding: 8px 4px;

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;

  /* reset button defaults */
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.game-card:active {
  background: rgba(255,255,255,0.14);
  transform: scale(0.95);
  transition: transform 0.08s, background 0.08s;
}

.game-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.game-card-icon svg {
  width: 40px;
  height: 40px;
}

.game-card-name {
  font-size: clamp(9px, 1.5vw, 12px);
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
  color: rgba(255,255,255,0.75);
}

/* ── Placeholder screen (játék még nincs kész) ──────────────────── */
/* The router injects .player2-zone, .center-bar, .player1-zone
   directly into #game-container (.screen), so no wrapper needed.  */

.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.placeholder-text {
  color: rgba(255,255,255,0.70);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 500;
  text-align: center;
  padding: 0 24px;
  line-height: 1.4;
}

/* ── Vissza gomb ────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  min-width: 140px;
  padding: 12px 28px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 17px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.back-btn:active {
  background: rgba(255,255,255,0.20);
  transform: scale(0.97);
}

/* ── Általános gombok ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  min-width:  var(--touch-min);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.btn:active {
  filter: brightness(1.2);
  transform: scale(0.97);
}

.btn-primary {
  background: var(--p1-color);
  color: white;
}

.btn-secondary {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.85);
}

.btn-p1 { background: var(--p1-color); color: white; }
.btn-p2 { background: var(--p2-color); color: white; }

/* ── Pontszám jelvény ───────────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 700;
}

.score-badge.p1 {
  background: color-mix(in srgb, var(--p1-color) 25%, transparent);
  color: var(--p1-color);
}

.score-badge.p2 {
  background: color-mix(in srgb, var(--p2-color) 25%, transparent);
  color: var(--p2-color);
}

/* ── Időzítő kijelző ────────────────────────────────────────────── */
.timer-display {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.85);
  min-width: 44px;
  text-align: center;
}

.timer-display.urgent {
  color: var(--p1-color);
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes timer-pulse {
  from { opacity: 1; }
  to   { opacity: 0.55; }
}

/* ── Győztes kiemelés ───────────────────────────────────────────── */
.winner-highlight {
  animation: winner-flash 0.45s ease-in-out 4;
}

@keyframes winner-flash {
  0%, 100% { filter: brightness(1);   }
  50%       { filter: brightness(1.6); }
}

/* ── Középső banner (showCenterBanner) ──────────────────────────── */
.center-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: white;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  padding: 3px 14px;
  border-radius: 20px;
  pointer-events: none;
}

/* ── Játékos felirat ────────────────────────────────────────────── */
.player-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.40);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Aktív zóna keret ───────────────────────────────────────────── */
.player1-zone.active-zone {
  border-top: 2px solid var(--p1-color);
}

.player2-zone.active-zone {
  /* rotated, so visually the border appears at the player's top */
  border-top: 2px solid var(--p2-color);
}
