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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background: #0d0d0d;
  color: #ffffff;
  font-family: 'Courier New', Courier, monospace;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ─── Screen System ─────────────────────────────────────────────────────────── */
.screen {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; flex-direction: column; align-items: center; }

/* ─── Common Layout ─────────────────────────────────────────────────────────── */
.screen-inner {
  width: 100%;
  max-width: 720px;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.logo-area {
  text-align: center;
}
.logo-area .game-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: #00e676;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.logo-area .game-subtitle {
  font-size: 0.85rem;
  color: #666;
  letter-spacing: 2px;
  margin-top: 4px;
}

/* ─── Screen 1: Event Selection ─────────────────────────────────────────────── */
#screen-select-event .section-title {
  font-size: 1rem;
  color: #aaa;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

#event-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.event-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s, background 0.2s;
  color: #fff;
  width: 100%;
  font-family: inherit;
}
.event-card:hover, .event-card:focus {
  border-color: #00e676;
  background: #1e2e1e;
  outline: none;
}
.event-card .event-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: #00e676;
}
.event-card .event-location {
  font-size: 0.9rem;
  color: #ccc;
}
.event-card .event-date {
  font-size: 0.8rem;
  color: #666;
}

.empty-state {
  color: #666;
  text-align: center;
  padding: 24px;
}

/* ─── Screen 2: Registration ────────────────────────────────────────────────── */
#screen-register .event-badge {
  background: #1a2e1a;
  border: 1px solid #00e676;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #00e676;
  letter-spacing: 1px;
  text-align: center;
}

form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.8rem;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"] {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 14px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus,
input[type="email"]:focus {
  border-color: #00e676;
}

.gdpr-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 14px;
}
.gdpr-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #00e676;
  cursor: pointer;
}
.gdpr-group label {
  font-size: 0.78rem;
  color: #aaa;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.gdpr-group a { color: #00e676; }

#form-error {
  display: none;
  background: #2d0a0a;
  border: 1px solid #8b0000;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #ff6b6b;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: #00e676;
  color: #0d0d0d;
  border: none;
  border-radius: 8px;
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: bold;
  font-family: inherit;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { background: #69f0ae; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled {
  background: #2a2a2a;
  color: #555;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 0.9rem;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: #666; color: #ccc; }

/* ─── Screen 3: Game ────────────────────────────────────────────────────────── */
#screen-game {
  justify-content: center;
  background: #0d0d0d;
  touch-action: none;
}

#game-canvas {
  display: block;
  touch-action: none;
  border: 1px solid #1e1e1e;
  max-width: 100%;
  max-height: 100%;
}

/* Swipe hint overlay */
.swipe-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #444;
  letter-spacing: 1px;
  pointer-events: none;
  white-space: nowrap;
}

/* ─── Screen 4: Game Over ───────────────────────────────────────────────────── */
#screen-gameover .score-display {
  text-align: center;
  background: #1a2e1a;
  border: 1px solid #00e676;
  border-radius: 12px;
  padding: 28px 40px;
  width: 100%;
}
#screen-gameover .score-display .score-label {
  font-size: 0.8rem;
  color: #aaa;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#screen-gameover .score-display .score-value {
  font-size: 4rem;
  font-weight: bold;
  color: #00e676;
  line-height: 1;
  margin: 8px 0;
}
#screen-gameover .score-display .score-player {
  font-size: 0.9rem;
  color: #ccc;
}

/* Leaderboard */
.leaderboard-section {
  width: 100%;
}
.leaderboard-section h2 {
  font-size: 0.9rem;
  color: #aaa;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 12px;
}
.leaderboard-section .event-label {
  color: #00e676;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th {
  font-size: 0.75rem;
  color: #666;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 10px;
  border-bottom: 1px solid #222;
  text-align: left;
}
.leaderboard-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 0.95rem;
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table .rank { color: #666; width: 36px; }
.leaderboard-table .player-name { color: #ccc; }
.leaderboard-table .player-score { color: #00e676; font-weight: bold; text-align: right; }
.leaderboard-table tr.current-player td { background: #0d200d; color: #fff; }
.leaderboard-table tr.current-player .player-name { color: #00e676; }
.loading-cell, .error-cell, .empty-cell {
  text-align: center;
  color: #666;
  padding: 20px !important;
  font-size: 0.85rem;
}

.gameover-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.retry-info {
  text-align: center;
  font-size: 0.8rem;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 1.2em;
}

.btn-secondary {
  width: 100%;
  padding: 16px;
  border: 1px solid #444;
  border-radius: 8px;
  background: transparent;
  color: #aaa;
  font-size: 1rem;
  font-family: monospace;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover {
  border-color: #00e676;
  color: #00e676;
}

/* Score column right-align (replaces inline style) */
.leaderboard-table .col-score-right { text-align: right; }

/* ─── Screen 1: Kiosk Wait ──────────────────────────────────────────────────── */
.kiosk-wait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 40px 0;
}
.kiosk-wait-msg {
  font-size: 1rem;
  color: #666;
  letter-spacing: 1px;
  text-align: center;
  line-height: 1.6;
}

/* Animated dots */
.kiosk-dots {
  display: flex;
  gap: 10px;
}
.kiosk-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00e676;
  opacity: 0.2;
  animation: kiosk-pulse 1.4s ease-in-out infinite;
}
.kiosk-dots span:nth-child(2) { animation-delay: 0.2s; }
.kiosk-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes kiosk-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
  40%           { opacity: 1;   transform: scale(1); }
}
