/* style.css - 1v1 Pinball Cyberpunk Arcade Styling */
:root {
  --bg-color: #0b0e14;
  --table-bg: #101622;
  --table-border: #1f293d;
  --p1-color: #00f3ff;
  --p1-glow: rgba(0, 243, 255, 0.45);
  --p2-color: #ff3366;
  --p2-glow: rgba(255, 51, 102, 0.45);
  --accent-gold: #ffbe0b;
  --text-main: #f0f4fc;
  --text-muted: #8b9bb4;
  --glass-bg: rgba(18, 25, 38, 0.78);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(255, 51, 102, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(0, 243, 255, 0.08) 0%, transparent 45%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Top Header Bar */
#top-bar {
  position: absolute;
  top: 10px;
  width: 95%;
  max-width: 580px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  padding: 8px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px var(--accent-gold));
}

.game-title {
  background: linear-gradient(135deg, #00f3ff, #ff3366);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Scoreboard HUD */
#scoreboard {
  position: absolute;
  top: 60px;
  width: 95%;
  max-width: 540px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  min-width: 140px;
}

.player-card.p1 {
  border-left: 3px solid var(--p1-color);
  box-shadow: -4px 0 16px var(--p1-glow);
}

.player-card.p2 {
  flex-direction: row-reverse;
  border-right: 3px solid var(--p2-color);
  box-shadow: 4px 0 16px var(--p2-glow);
  text-align: right;
}

.player-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-score {
  font-size: 26px;
  font-weight: 900;
  font-family: 'Courier New', monospace;
}

.p1 .player-score {
  color: var(--p1-color);
  text-shadow: 0 0 10px var(--p1-glow);
}

.p2 .player-score {
  color: var(--p2-color);
  text-shadow: 0 0 10px var(--p2-glow);
}

.match-target {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  letter-spacing: 1px;
  color: var(--accent-gold);
}

/* Canvas Area */
#canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: 92vh;
}

canvas#pinball-canvas {
  background: #090d15;
  border-radius: 20px;
  border: 2px solid #1a2336;
  box-shadow: 
    0 0 40px rgba(0, 0, 0, 0.8),
    0 0 80px rgba(0, 243, 255, 0.08),
    inset 0 0 40px rgba(0, 0, 0, 0.9);
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Touch controls overlay for mobile */
#touch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 15;
}

.touch-zone {
  position: absolute;
  bottom: 0;
  width: 50%;
  height: 45%;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.15;
  transition: opacity 0.15s ease;
}

.touch-zone:active {
  opacity: 0.4;
}

.touch-zone.left {
  left: 0;
  background: radial-gradient(circle at 30% 70%, var(--p1-color), transparent 70%);
}

.touch-zone.right {
  right: 0;
  background: radial-gradient(circle at 70% 70%, var(--p1-color), transparent 70%);
}

.touch-label {
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Quick Emotes Bar */
#emote-bar {
  position: absolute;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  z-index: 20;
}

.emote-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: transform 0.15s ease;
}

.emote-btn:hover {
  transform: scale(1.35);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 12, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: #111724;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  text-align: center;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

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

.form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.input-text {
  background: #090e18;
  border: 1px solid #1f2a3e;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-text:focus {
  border-color: var(--p1-color);
  box-shadow: 0 0 10px var(--p1-glow);
}

.btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #00f3ff, #0099ff);
  color: #050c18;
  box-shadow: 0 4px 20px var(--p1-glow);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 26px var(--p1-glow);
}

.btn-coral {
  background: linear-gradient(135deg, #ff3366, #ff6b3d);
  color: white;
  box-shadow: 0 4px 20px var(--p2-glow);
}

.btn-coral:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 26px var(--p2-glow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-secondary {
  background: #1a2334;
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #232f46;
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.room-code-display {
  background: #080d16;
  border: 2px dashed rgba(0, 243, 255, 0.4);
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  margin: 10px 0;
}

.room-code-text {
  font-size: 32px;
  font-weight: 900;
  font-family: monospace;
  letter-spacing: 4px;
  color: var(--p1-color);
  text-shadow: 0 0 12px var(--p1-glow);
}

.share-link-box {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.key-badge {
  display: inline-block;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 700;
  color: #94a3b8;
}

/* Emote Float animations */
.floating-emote {
  position: absolute;
  font-size: 36px;
  pointer-events: none;
  animation: floatUp 2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  z-index: 50;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  15% { opacity: 1; transform: translateY(-20px) scale(1.2); }
  80% { opacity: 1; transform: translateY(-90px) scale(1.0); }
  100% { opacity: 0; transform: translateY(-130px) scale(0.8); }
}

/* Toast alert notification */
#toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  #top-bar { top: 6px; padding: 6px 10px; }
  #scoreboard { top: 48px; }
  .player-card { min-width: 100px; padding: 4px 8px; }
  .player-score { font-size: 20px; }
  .touch-zone { display: flex; }
}
