/* ==========================================================
   NEON PINBALL LOTTERY - STYLE SHEET
   Cyberpunk Neon Arcade Theme
   ========================================================== */

:root {
  --bg-color: #080914;
  --panel-bg: rgba(18, 20, 42, 0.75);
  --panel-border: rgba(0, 243, 255, 0.25);
  --panel-glow: rgba(0, 243, 255, 0.15);
  
  --neon-cyan: #00f3ff;
  --neon-pink: #ff007f;
  --neon-purple: #9d4edd;
  --neon-green: #00ff88;
  --neon-yellow: #ffd700;
  --neon-red: #ff3366;
  
  --text-main: #ffffff;
  --text-muted: #8e9bb4;
  --text-dim: #5c6882;

  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-ui: 'Rajdhani', 'Pretendard', sans-serif;
  --font-sans: 'Pretendard', -apple-system, sans-serif;

  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Background Cyber Grid & Glow Orbs */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(0, 243, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}

.bg-glow-1 {
  top: -100px;
  left: 10%;
  background: var(--neon-cyan);
}

.bg-glow-2 {
  bottom: -100px;
  right: 10%;
  background: var(--neon-pink);
}

/* Main Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1540px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px var(--panel-glow);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 26px;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
  animation: pulseLogo 3s ease-in-out infinite alternate;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  color: #fff;
}

.logo-text span {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

@keyframes pulseLogo {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px var(--neon-cyan)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 14px var(--neon-pink)); color: var(--neon-pink); }
}

/* Layout */
.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  gap: 20px;
  flex: 1;
  min-height: 0; /* Important for flex/grid child overflow */
}

/* Glass Panels */
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 243, 255, 0.03);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-header h2 {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--neon-cyan);
}

.badge {
  font-family: var(--font-display);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
}

.badge.danger {
  background: rgba(255, 0, 127, 0.15);
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
}

/* Input Form */
.input-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-box {
  display: flex;
  gap: 8px;
}

.input-box input {
  flex: 1;
  background: rgba(8, 9, 20, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}

.input-box input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
  background: rgba(12, 14, 30, 0.95);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.text-btn:hover {
  color: var(--neon-cyan);
  background: rgba(0, 243, 255, 0.08);
}

.text-btn.danger:hover {
  color: var(--neon-red);
  background: rgba(255, 51, 102, 0.1);
}

/* Participant List */
.participant-list-container {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  background: rgba(8, 9, 20, 0.6);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px;
  position: relative;
}

.participant-list-container::-webkit-scrollbar,
.elimination-feed::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 6px;
}

.participant-list-container::-webkit-scrollbar-thumb,
.elimination-feed::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  background: rgba(0, 243, 255, 0.25);
  border-radius: 3px;
}

.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participant-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: tagPop 0.25s ease-out;
}

.participant-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.participant-tag .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

.participant-tag .tag-remove-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
  transition: color 0.15s;
}

.participant-tag .tag-remove-btn:hover {
  color: #ff3366;
}

@keyframes tagPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 80%;
  pointer-events: none;
}

.empty-state i {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.15);
}

.empty-state p {
  font-size: 13px;
  line-height: 1.4;
}

/* Buttons */
.action-btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #00a8ff);
  color: #060919;
  font-family: var(--font-ui);
  font-weight: 700;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.action-btn-primary:hover {
  background: linear-gradient(135deg, #4ef8ff, #00d2ff);
  box-shadow: 0 0 22px rgba(0, 243, 255, 0.7);
  transform: translateY(-1px);
}

.start-btn {
  width: 100%;
  background: linear-gradient(135deg, #ff007f, #9d4edd);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  border-radius: var(--border-radius-md);
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.start-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 35px rgba(255, 0, 127, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.4);
}

.start-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}

.start-btn.small {
  width: auto;
  font-size: 14px;
  padding: 8px 18px;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
}

.glass-btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.glass-btn.active {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 0, 127, 0.3);
}

/* Game Board Section (Center) */
.game-board-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  gap: 10px;
}

/* In-Game HUD */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 8px 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  letter-spacing: 0.5px;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.hud-item.highlight .hud-value {
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green);
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speed-selector,
.map-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.speed-selector select,
.map-selector select {
  background: rgba(8, 9, 20, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.3);
  color: var(--neon-cyan);
  font-family: var(--font-ui);
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}

/* Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 100%;
  max-height: 820px;
  aspect-ratio: 600 / 920;
  background: radial-gradient(circle at 50% 30%, #151835 0%, #080914 90%);
  border-radius: var(--border-radius-lg);
  border: 2px solid rgba(0, 243, 255, 0.4);
  box-shadow: 
    0 0 30px rgba(0, 243, 255, 0.25),
    inset 0 0 40px rgba(0, 0, 0, 0.8),
    inset 0 0 15px rgba(0, 243, 255, 0.15);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Glass Reflection Layer on Pinball Canvas */
.canvas-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 50%, rgba(0, 243, 255, 0.03) 100%);
  pointer-events: none;
  z-index: 5;
}

canvas#pinballCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlays inside Canvas Wrapper */
.countdown-overlay,
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 20, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.countdown-text {
  font-family: var(--font-display);
  font-size: 90px;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-pink);
  animation: countdownPulse 0.9s ease-in-out infinite;
}

@keyframes countdownPulse {
  0% { transform: scale(1.4); opacity: 0.3; }
  50% { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.pause-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pause-content i {
  font-size: 40px;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px var(--neon-yellow);
}

.pause-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  color: #fff;
}

.pause-content p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Elimination Log Panel (Right) */
.elimination-panel {
  display: flex;
  flex-direction: column;
}

.elimination-feed {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.elimination-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 51, 102, 0.08);
  border: 1px solid rgba(255, 51, 102, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  animation: feedSlideIn 0.3s ease-out;
}

.elimination-item .rank-badge {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.elimination-item .name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.elimination-item .ball-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.elimination-item .name-text {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.elimination-item .status-text {
  font-size: 11px;
  color: var(--neon-red);
  font-weight: 700;
}

@keyframes feedSlideIn {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

.empty-feed {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
  gap: 10px;
}

.empty-feed i {
  font-size: 32px;
  opacity: 0.3;
}

.empty-feed p {
  font-size: 13px;
  line-height: 1.5;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.25s ease;
}

.modal-box {
  background: #11142a;
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--panel-glow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalScaleUp 0.25s ease-out;
}

@keyframes modalScaleUp {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-ui);
  font-size: 18px;
  color: var(--neon-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #fff;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  background: rgba(8, 9, 20, 0.9);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Winner Modal Specifics */
.winner-box {
  max-width: 520px;
  text-align: center;
  align-items: center;
  padding: 36px 28px;
  background: radial-gradient(circle at 50% 0%, #201a45 0%, #0e1022 100%);
  border: 2px solid var(--neon-yellow);
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.35), inset 0 0 25px rgba(255, 215, 0, 0.15);
}

.winner-trophy {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.trophy-glow {
  position: absolute;
  inset: 0;
  background: var(--neon-yellow);
  border-radius: 50%;
  filter: blur(25px);
  opacity: 0.6;
}

.trophy-icon {
  position: relative;
  font-size: 54px;
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow);
  animation: bounceTrophy 2s infinite ease-in-out;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.winner-sub {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
}

.winner-name-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.4);
  padding: 14px 28px;
  border-radius: 40px;
  margin: 10px 0;
  animation: winnerGlow 2s ease-in-out infinite alternate;
}

@keyframes winnerGlow {
  0% { transform: scale(1); border-color: var(--neon-cyan); box-shadow: 0 0 20px var(--neon-cyan); }
  100% { transform: scale(1.04); border-color: var(--neon-pink); box-shadow: 0 0 35px var(--neon-pink); }
}

.winner-ball-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 15px currentColor;
}

.winner-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.winner-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

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

.action-btn-primary.large,
.glass-btn.large {
  padding: 14px 24px;
  font-size: 15px;
  justify-content: center;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 280px 1fr 260px;
    gap: 14px;
  }
}

@media (max-width: 992px) {
  .app-container {
    height: auto;
    min-height: 100vh;
  }
  
  .main-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .game-board-section {
    order: 1;
  }

  .side-panel#setupPanel {
    order: 2;
  }

  .side-panel#logPanel {
    order: 3;
  }

  .canvas-wrapper {
    height: 70vh;
    max-height: 680px;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 10px;
  }

  .app-header {
    padding: 8px 12px;
  }

  .logo-text {
    font-size: 15px;
  }

  .logo-icon {
    font-size: 20px;
  }

  .btn-text {
    display: none;
  }

  .canvas-wrapper {
    height: 65vh;
    border-radius: var(--border-radius-md);
  }

  .winner-name {
    font-size: 24px;
  }

  .countdown-text {
    font-size: 60px;
  }
}