/* ==========================================================================
   Neon Tap Tap Shots - Style Sheet
   ========================================================================== */

:root {
  --bg-color: #0b0b16;
  --grid-color: rgba(0, 240, 255, 0.04);
  --grid-size: 40px;
  
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff007f;
  --neon-yellow: #fffb00;
  --neon-purple: #9d4edd;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a5c0;
  
  --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.2);
  --glow-magenta: 0 0 10px rgba(ff, 0, 127, 0.5), 0 0 20px rgba(ff, 0, 127, 0.2);
  --glow-yellow: 0 0 10px rgba(255, 251, 0, 0.5), 0 0 20px rgba(255, 251, 0, 0.2);
  
  --font-display: 'Outfit', sans-serif;
  --font-korean: 'Noto Sans KR', sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-korean);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Background Grid Pattern & Glows */
.space-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  z-index: 1;
  pointer-events: none;
}

.ambient-glow {
  position: absolute;
  width: 40vmax;
  height: 40vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 2;
  animation: floatGlow 15s infinite alternate ease-in-out;
}

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

.magenta-glow {
  background: var(--neon-magenta);
  bottom: -10%;
  right: -10%;
  animation-delay: -5s;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.2); }
}

/* Main Game Wrapper */
.game-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 800px;
  background: rgba(13, 13, 27, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

/* Screens System */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 15;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

/* 1. START SCREEN */
.logo-area {
  text-align: center;
  margin-top: 40px;
}

.game-logo {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: #fff;
  text-shadow: 0 0 10px rgba(255,255,255,0.2);
  line-height: 1.2;
}

.accent-text {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  display: block;
  font-size: 3rem;
  margin: 5px 0;
  animation: logoPulse 2s infinite alternate ease-in-out;
}

@keyframes logoPulse {
  0% { text-shadow: var(--glow-cyan); }
  100% { text-shadow: 0 0 20px rgba(0, 240, 255, 0.8), 0 0 35px rgba(0, 240, 255, 0.4); }
}

.tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.high-score-badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 50px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.05);
}

.badge-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.badge-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.instruction-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
}

.instruction-box h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.guide-list {
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.guide-list li {
  margin-bottom: 8px;
  position: relative;
  padding-left: 14px;
}

.guide-list li::before {
  content: "•";
  color: var(--neon-cyan);
  position: absolute;
  left: 0;
  font-weight: bold;
}

.guide-list code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #fff;
}

.settings-panel {
  display: flex;
  gap: 16px;
}

.settings-toggle {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 20px;
  border-radius: 50px;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.settings-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Buttons System */
.glow-btn {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-bottom: 20px;
}

.glow-btn:active {
  transform: scale(0.97);
}

.btn-cyan {
  background: var(--neon-cyan);
  color: #0b0b16;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.btn-cyan:hover {
  background: #fff;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
}

.btn-magenta {
  background: var(--neon-magenta);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.btn-magenta:hover {
  background: #fff;
  color: var(--neon-magenta);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.7);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* 2. GAMEPLAY SCREEN */
#game-screen {
  padding: 12px;
  justify-content: flex-start;
  gap: 10px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  z-index: 20;
}

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

.hud-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.hud-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.1;
}

.score-display .hud-num {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.combo-display .hud-num {
  color: var(--neon-yellow);
  text-shadow: var(--glow-yellow);
}

.timer-container {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin: 0 16px;
  overflow: hidden;
  position: relative;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: 10px;
  transition: width 0.1s linear, background-color 0.3s;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.timer-low {
  background: var(--neon-magenta);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.8);
  animation: pulseWarning 0.5s infinite alternate;
}

@keyframes pulseWarning {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Canvas Container */
.canvas-wrapper {
  position: relative;
  width: 100%;
  flex-grow: 1;
  background: #05050e;
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.tap-overlay-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  padding: 12px 24px;
  border-radius: 50px;
  animation: hintBlink 1.5s infinite ease-in-out;
}

.tap-overlay-hint.hidden {
  display: none;
}

@keyframes hintBlink {
  0%, 100% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.95); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.05); }
}

/* Screen Shake Effect */
.shake {
  animation: shake 0.3s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* 3. GAME OVER SCREEN */
#gameover-screen {
  justify-content: center;
  gap: 30px;
}

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

.gameover-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
  letter-spacing: 2px;
  animation: gameoverPulse 2s infinite alternate ease-in-out;
}

@keyframes gameoverPulse {
  0% { text-shadow: var(--glow-magenta); }
  100% { text-shadow: 0 0 25px rgba(255, 0, 127, 0.8), 0 0 40px rgba(255, 0, 127, 0.4); }
}

.gameover-subtext {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

.score-summary {
  display: flex;
  gap: 20px;
  width: 100%;
}

.summary-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.summary-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.summary-val {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
}

.final-score-card {
  border-color: rgba(255, 0, 127, 0.2);
}

.final-score-card .summary-val {
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.best-score-card {
  border-color: rgba(0, 240, 255, 0.2);
}

.best-score-card .summary-val {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.new-record-banner {
  background: linear-gradient(45deg, var(--neon-yellow), #ffa700);
  border-radius: 8px;
  padding: 8px 24px;
  color: #0b0b16;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: var(--glow-yellow);
  animation: bounceRecord 1s infinite alternate ease-in-out;
}

.new-record-banner.hidden {
  display: none;
}

@keyframes bounceRecord {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-5px) scale(1.05); }
}

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

.action-buttons .glow-btn {
  margin-bottom: 0;
}

/* Footer Styling */
.app-footer {
  margin-top: 16px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
  z-index: 5;
}

/* Scrollbar styling for instructions */
.instruction-box::-webkit-scrollbar {
  width: 6px;
}
.instruction-box::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}
.instruction-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.instruction-box::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Scaling for Desktop Screens */
@media (min-height: 801px) {
  body {
    padding: 20px 0;
  }
}

@media (max-width: 480px) {
  .game-container {
    border-radius: 0;
    border: none;
    height: 100vh;
    max-height: 100vh;
  }
  
  body {
    background-color: #0d0d1b;
  }
  
  .space-grid {
    display: none;
  }
}
