/* Design System Tokens */
:root {
  --neon-pink: #ff007f;
  --neon-blue: #00f0ff;
  --neon-green: #39ff14;
  --neon-yellow: #fff01f;
  --bg-dark: #0a0813;
  --bg-cabinet: #161224;
  --panel-bg: rgba(22, 18, 36, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  
  --font-display: 'Orbitron', 'Noto Sans KR', sans-serif;
  --font-retro: 'Press Start 2P', monospace;
  --font-body: 'Noto Sans KR', 'Inter', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text-primary);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Keyframe Animations */
@keyframes neon-pulse-pink {
  0%, 100% {
    text-shadow: 0 0 4px var(--neon-pink), 0 0 10px var(--neon-pink), 0 0 20px var(--neon-pink);
    box-shadow: 0 0 4px var(--neon-pink), inset 0 0 4px var(--neon-pink);
  }
  50% {
    text-shadow: 0 0 8px var(--neon-pink), 0 0 18px var(--neon-pink), 0 0 35px var(--neon-pink);
    box-shadow: 0 0 12px var(--neon-pink), inset 0 0 8px var(--neon-pink);
  }
}

@keyframes neon-pulse-blue {
  0%, 100% {
    text-shadow: 0 0 4px var(--neon-blue), 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    box-shadow: 0 0 4px var(--neon-blue), inset 0 0 4px var(--neon-blue);
  }
  50% {
    text-shadow: 0 0 8px var(--neon-blue), 0 0 18px var(--neon-blue), 0 0 35px var(--neon-blue);
    box-shadow: 0 0 12px var(--neon-blue), inset 0 0 8px var(--neon-blue);
  }
}

@keyframes neon-pulse-green {
  0%, 100% {
    text-shadow: 0 0 4px var(--neon-green), 0 0 10px var(--neon-green);
    box-shadow: 0 0 4px var(--neon-green), inset 0 0 4px var(--neon-green);
  }
  50% {
    text-shadow: 0 0 8px var(--neon-green), 0 0 18px var(--neon-green);
    box-shadow: 0 0 12px var(--neon-green), inset 0 0 8px var(--neon-green);
  }
}

@keyframes glass-glare-anim {
  0% { transform: translate(-100%, -100%) rotate(-45deg); }
  100% { transform: translate(100%, 100%) rotate(-45deg); }
}

@keyframes banner-slide-in {
  0% { transform: translate(-50%, -150%); opacity: 0; }
  15% { transform: translate(-50%, 0); opacity: 1; }
  85% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -150%); opacity: 0; }
}

/* Neon Helper Classes */
.neon-pink { color: var(--neon-pink); text-shadow: 0 0 5px var(--neon-pink); }
.neon-blue { color: var(--neon-blue); text-shadow: 0 0 5px var(--neon-blue); }
.neon-text-pink { text-shadow: 0 0 8px var(--neon-pink); }
.neon-text-blue { text-shadow: 0 0 8px var(--neon-blue); }
.neon-text-green { text-shadow: 0 0 8px var(--neon-green); }

/* Arcade Cabinet Frame */
.arcade-cabinet {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 850px;
  background-color: var(--bg-cabinet);
  border: 4px solid #2d2644;
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 0, 127, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (max-width: 480px) {
  .arcade-cabinet {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* Cabinet Header */
.game-header {
  height: 60px;
  background: linear-gradient(180deg, #1c172d 0%, #0d0a1b 100%);
  border-bottom: 2px solid var(--neon-pink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
}

.game-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 2px;
}

.header-right {
  display: flex;
  gap: 10px;
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
  transform: translateY(-2px);
}

.icon-btn:active {
  transform: translateY(0);
}

/* Main Viewport (Glass Enclosure) */
.game-viewport {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at center, #1b172b 0%, #090712 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#canvas-container {
  width: 100%;
  flex: 1;
  position: relative;
  background-color: transparent;
}

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

/* Neon Borders & Glass FX in Viewport */
.neon-border-top {
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background-color: var(--neon-blue);
  box-shadow: 0 0 10px var(--neon-blue);
}

.neon-border-left {
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 3px;
  background-color: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
}

.neon-border-right {
  position: absolute;
  top: 0; right: 0; bottom: 0; width: 3px;
  background-color: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
}

.glass-glare {
  position: absolute;
  top: 0; left: 0; width: 200%; height: 200%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.05) 30%,
    rgba(255, 255, 255, 0) 31%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* HUD System */
.game-hud {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.hud-item {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 90px;
  text-align: center;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.hud-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-retro);
  font-size: 12px;
}

/* Catch Notification Banner */
.catch-banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  background: linear-gradient(135deg, rgba(255,0,127,0.9) 0%, rgba(22,18,36,0.95) 100%);
  border: 2px solid var(--neon-pink);
  border-radius: 12px;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.6);
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  width: 80%;
  max-width: 320px;
}

.catch-banner.show {
  animation: banner-slide-in 2.5s ease forwards;
}

.banner-title {
  font-family: var(--font-retro);
  font-size: 14px;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 0 5px #000;
}

.banner-item-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--neon-blue);
  margin-bottom: 2px;
}

.banner-item-points {
  font-family: var(--font-retro);
  font-size: 12px;
  color: var(--neon-green);
}

/* Start Overlay Screens */
.overlay-screen {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(10, 8, 19, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay-screen.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-content {
  width: 85%;
  text-align: center;
  padding: 30px 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top, #231b3c 0%, #110d21 100%);
  border: 1px solid rgba(255, 0, 127, 0.3);
  box-shadow: 0 0 25px rgba(0,0,0,0.6);
}

.overlay-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
}

.overlay-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.play-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.btn {
  padding: 14px 24px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.btn-primary {
  background: linear-gradient(90deg, var(--neon-pink) 0%, #d00069 100%);
  color: #fff;
  border: 1px solid var(--neon-pink);
}

.btn-glow:hover {
  box-shadow: 0 0 15px var(--neon-pink);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--neon-blue);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.shortcuts-guide {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.shortcuts-guide h3 {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--neon-blue);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.shortcuts-guide ul {
  list-style: none;
}

.shortcuts-guide li {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

.shortcuts-guide li:last-child {
  margin-bottom: 0;
}

kbd {
  background: #332d44;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.5);
  color: #fff;
  display: inline-block;
  font-size: 10px;
  font-family: var(--font-retro);
  margin-right: 4px;
  padding: 2px 6px;
}

/* Control Panel (Footer) */
.control-panel {
  background: linear-gradient(180deg, #1b172a 0%, #100d1b 100%);
  border-top: 3px solid var(--neon-blue);
  padding: 20px;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 240, 255, 0.1);
  z-index: 10;
}

.cabinet-grille {
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background-image: linear-gradient(90deg, transparent 50%, #000 50%);
  background-size: 8px 100%;
  opacity: 0.3;
}

.controls-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

/* Joystick Styles */
.joystick-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.joystick-base {
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, #25203b 0%, #0c0a14 100%);
  border: 3px solid #3d345b;
  border-radius: 50%;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.8), 0 4px 6px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
}

.joystick-stick {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #5a5477 0%, #201b31 100%);
  border-radius: 50%;
  position: absolute;
  cursor: grab;
  transition: transform 0.05s ease;
  z-index: 3;
}

.joystick-stick::before {
  content: '';
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 36px;
  background: linear-gradient(180deg, #dcdcdc, #555);
  transform-origin: bottom center;
  z-index: -1;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.joystick-knob {
  width: 32px;
  height: 32px;
  background: radial-gradient(circle at 10px 10px, var(--neon-pink) 0%, #8b0042 100%);
  border-radius: 50%;
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), 0 0 10px var(--neon-pink);
}

.joystick-stick:active {
  cursor: grabbing;
}

.joystick-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 1px;
}

/* Cabinet Status Display */
.cabinet-status {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.digital-display {
  background: #08060f;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  max-width: 160px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9);
}

.display-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-retro);
  font-size: 8px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.display-row:last-child {
  margin-bottom: 0;
}

.display-row span:last-child {
  color: var(--neon-blue);
  text-shadow: 0 0 5px var(--neon-blue);
}

.display-row .status-active {
  color: var(--neon-green) !important;
  text-shadow: 0 0 5px var(--neon-green) !important;
  animation: neon-pulse-green 2s infinite;
}

.coin-slot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.coin-slot {
  width: 28px;
  height: 40px;
  background: #0f0b1a;
  border: 2px solid #33284f;
  border-radius: 4px;
  position: relative;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
}

.coin-entry {
  width: 4px;
  height: 24px;
  background-color: var(--neon-yellow);
  box-shadow: 0 0 10px var(--neon-yellow);
  position: absolute;
  top: 6px;
  left: 10px;
  border-radius: 2px;
}

.coin-label {
  font-size: 8px;
  color: var(--neon-yellow);
  font-weight: 700;
  text-shadow: 0 0 3px var(--neon-yellow);
  letter-spacing: 0.5px;
}

/* Action Drop Button */
.action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.btn-drop {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #1a162b;
  border: 3px solid #332b4f;
  position: relative;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.5);
  outline: none;
}

.btn-drop-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 18px 18px, #ff0055 0%, #aa003c 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 0, 85, 0.6);
  transition: all 0.1s ease;
  display: block;
}

.btn-drop:hover .btn-drop-inner {
  background: radial-gradient(circle at 18px 18px, #ff2a75 0%, #cc004a 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 0, 85, 0.9);
}

.btn-drop:active {
  transform: translateY(2px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.btn-drop:active .btn-drop-inner {
  background: radial-gradient(circle at 18px 18px, #b30034 0%, #800025 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 5px rgba(255, 0, 85, 0.3);
  transform: scale(0.96);
}

.btn-drop-label {
  position: absolute;
  bottom: -22px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* Modals General Styles */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(10, 8, 19, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 85%;
  max-width: 400px;
  background: #17132a;
  border: 1px solid rgba(0, 240, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 20px rgba(0, 240, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 10px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--neon-blue);
  text-shadow: 0 0 5px var(--neon-blue);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--neon-pink);
}

/* Leaderboard Details */
.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  box-shadow: 0 0 5px rgba(0,240,255,0.3);
}

.leaderboard-table-container {
  max-height: 250px;
  overflow-y: auto;
  border-radius: 6px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.03);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th, 
.leaderboard-table td {
  padding: 10px 12px;
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.leaderboard-table th {
  font-family: var(--font-display);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
}

.leaderboard-table td {
  font-family: var(--font-body);
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr.top-rank-1 td { color: #ffd700; font-weight: bold; } /* Gold */
.leaderboard-table tr.top-rank-2 td { color: #c0c0c0; font-weight: bold; } /* Silver */
.leaderboard-table tr.top-rank-3 td { color: #cd7f32; font-weight: bold; } /* Bronze */

.leaderboard-table tr.top-rank-1 td:first-child::before { content: '🥇 '; }
.leaderboard-table tr.top-rank-2 td:first-child::before { content: '🥈 '; }
.leaderboard-table tr.top-rank-3 td:first-child::before { content: '🥉 '; }

/* Loading Spinner */
.leaderboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 240, 255, 0.1);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Name Input Modal Specifics */
.text-center {
  text-align: center;
}

.score-announcement {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 15px 0;
}

.font-bold {
  font-weight: bold;
}

#player-name-input {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  background: #0c0919;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.2s ease;
}

#player-name-input:focus {
  border-color: var(--neon-pink);
  box-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

/* Rules / Markdown style */
.markdown-style h3 {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--neon-blue);
  margin-top: 15px;
  margin-bottom: 8px;
}

.markdown-style p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.doll-score-list {
  list-style: none;
  padding-left: 0;
}

.doll-score-list li {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.doll-score-list strong {
  color: #fff;
}
