/* Rhythm Practice Tool Styles */
/* Neon/Cyberpunk Theme */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a0f;
  --bg-card: #12121a;
  --neon-pink: #ff00ff;
  --neon-cyan: #00ffff;
  --neon-orange: #ff6b00;
  --neon-green: #00ff88;
  --neon-left: #ff00ff;
  --neon-down: #00ffff;
  --neon-up: #00ff88;
  --neon-right: #ff6b00;
  --text-white: #ffffff;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-dark);
  color: var(--text-white);
  height: 100vh;
  overflow: hidden;
}

.practice-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
}

/* Game Area */
.game-area {
  flex: 1;
  min-height: 300px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--neon-pink);
  border-radius: 8px;
  background: rgba(18, 18, 26, 0.8);
  outline: none;
}

.game-area:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* Focus Hint */
.focus-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  z-index: 100;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.lanes {
  display: flex;
  height: 100%;
  justify-content: center;
  gap: 10px;
  padding: 10px;
}

.lane {
  width: 50px;
  height: 100%;
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lane[data-key="ArrowLeft"] { border-color: var(--neon-left); border-width: 2px; }
.lane[data-key="ArrowDown"] { border-color: var(--neon-down); border-width: 2px; }
.lane[data-key="ArrowUp"] { border-color: var(--neon-up); border-width: 2px; }
.lane[data-key="ArrowRight"] { border-color: var(--neon-right); border-width: 2px; }

.target-zone {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 3px solid;
  border-radius: 8px;
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.1s ease;
}

.lane[data-key="ArrowLeft"] .target-zone {
  border-color: var(--neon-left);
  color: var(--neon-left);
}
.lane[data-key="ArrowDown"] .target-zone {
  border-color: var(--neon-down);
  color: var(--neon-down);
}
.lane[data-key="ArrowUp"] .target-zone {
  border-color: var(--neon-up);
  color: var(--neon-up);
}
.lane[data-key="ArrowRight"] .target-zone {
  border-color: var(--neon-right);
  color: var(--neon-right);
}

/* Arrow Notes */
.arrow {
  position: absolute;
  width: 40px;
  height: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: 8px;
  color: #000;
  font-weight: bold;
  animation: fall linear forwards;
}

.arrow.left {
  background: var(--neon-left);
  box-shadow: 0 0 15px var(--neon-left);
  color: #fff;
}
.arrow.down {
  background: var(--neon-down);
  box-shadow: 0 0 15px var(--neon-down);
  color: #000;
}
.arrow.up {
  background: var(--neon-up);
  box-shadow: 0 0 15px var(--neon-up);
  color: #000;
}
.arrow.right {
  background: var(--neon-orange);
  box-shadow: 0 0 15px var(--neon-orange);
  color: #fff;
}

/* Hold Notes - Long arrows */
.arrow.hold-note {
  border-radius: 8px 8px 20px 20px;
  align-items: flex-start;
  padding-top: 8px;
}

/* 长按音符底部显示对应方向的符号 */
.arrow.hold-note.left::after {
  content: '←';
  position: absolute;
  bottom: 8px;
  font-size: 16px;
  opacity: 0.7;
}

.arrow.hold-note.down::after {
  content: '↓';
  position: absolute;
  bottom: 8px;
  font-size: 16px;
  opacity: 0.7;
}

.arrow.hold-note.up::after {
  content: '↑';
  position: absolute;
  bottom: 8px;
  font-size: 16px;
  opacity: 0.7;
}

.arrow.hold-note.right::after {
  content: '→';
  position: absolute;
  bottom: 8px;
  font-size: 16px;
  opacity: 0.7;
}

/* 长按音符正在按住时的效果 - 使用filter而不是修改动画 */
.arrow.hold-note.holding {
  filter: brightness(1.5) saturate(1.5);
  box-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
}

.arrow.hold-note.left {
  background: linear-gradient(180deg, var(--neon-left), rgba(255, 0, 255, 0.5));
}

.arrow.hold-note.down {
  background: linear-gradient(180deg, var(--neon-down), rgba(0, 255, 255, 0.5));
}

.arrow.hold-note.up {
  background: linear-gradient(180deg, var(--neon-up), rgba(0, 255, 136, 0.5));
}

.arrow.hold-note.right {
  background: linear-gradient(180deg, var(--neon-orange), rgba(255, 107, 0, 0.5));
}

@keyframes fall {
  from { top: -50px; }
  to { top: calc(100% + 50px); }
}

/* Hit Effect */
.hit-effect {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  animation: hitPulse 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes hitPulse {
  0% {
    transform: translateX(-50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1.5);
    opacity: 0;
  }
}

/* Stats */
.stats {
  display: flex;
  justify-content: space-around;
  padding: 10px;
  margin-top: 10px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: var(--neon-cyan);
  letter-spacing: 2px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-white);
  text-shadow: 0 0 10px var(--neon-pink);
}

/* Time stat special styling */
.time-stat .stat-label {
  color: var(--neon-orange);
}

.time-stat .stat-value {
  text-shadow: 0 0 10px var(--neon-orange);
  transition: color 0.3s ease;
}

/* Feedback */
.feedback {
  text-align: center;
  height: 30px;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
}

.feedback.perfect {
  color: var(--neon-green);
  text-shadow: 0 0 15px var(--neon-green);
}
.feedback.good {
  color: var(--neon-cyan);
  text-shadow: 0 0 15px var(--neon-cyan);
}
.feedback.miss {
  color: var(--neon-orange);
  text-shadow: 0 0 15px var(--neon-orange);
}

/* Controls */
.controls {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}

.controls select, .controls button {
  flex: 1;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--neon-pink);
  border-radius: 8px;
  color: var(--text-white);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.controls select:hover, .controls button:hover {
  background: rgba(255, 0, 255, 0.2);
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
}

.controls button {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
  border: none;
}

.controls .lb-btn {
  flex: 0 0 50px;
  background: var(--bg-card);
  border: 1px solid var(--neon-orange);
}

/* Countdown */
.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 72px;
  font-weight: bold;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px var(--neon-cyan);
  z-index: 100;
  display: none;
  animation: countdownPulse 0.5s ease-out;
}

.countdown.show {
  display: block;
}

@keyframes countdownPulse {
  0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--neon-pink);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
}

/* Modal Close Button */
.modal-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--neon-cyan);
  border-radius: 50%;
  color: var(--neon-cyan);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--neon-cyan);
  color: var(--bg-dark);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.modal-content h2 {
  color: var(--neon-cyan);
  text-shadow: 0 0 15px var(--neon-cyan);
  margin-bottom: 20px;
  font-size: 24px;
}

.final-score {
  margin: 20px 0;
}

.final-score .score-label {
  display: block;
  font-size: 12px;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.final-score .score-value {
  font-size: 48px;
  font-weight: bold;
  color: var(--text-white);
  text-shadow: 0 0 20px var(--neon-pink);
}

.encouragement {
  color: var(--neon-green);
  font-size: 14px;
  margin: 16px 0;
  line-height: 1.5;
}

.new-record {
  display: none;
  color: var(--neon-orange);
  font-size: 18px;
  font-weight: bold;
  margin: 16px 0;
  animation: recordPulse 0.5s ease-in-out infinite alternate;
}

.new-record.show {
  display: block;
}

@keyframes recordPulse {
  from { text-shadow: 0 0 10px var(--neon-orange); }
  to { text-shadow: 0 0 25px var(--neon-orange); }
}

.play-again-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
  border: none;
  border-radius: 8px;
  color: var(--text-white);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.3s ease;
}

.play-again-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.7);
}

/* Leaderboard Modal */
.leaderboard-modal {
  max-width: 320px;
}

.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.lb-tab {
  flex: 1;
  padding: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--neon-pink);
  border-radius: 4px;
  color: var(--text-white);
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lb-tab.active {
  background: var(--neon-pink);
  color: #000;
}

.leaderboard-list {
  max-height: 200px;
  overflow-y: auto;
}

.lb-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.lb-item.gold { background: rgba(255, 215, 0, 0.2); }
.lb-item.silver { background: rgba(192, 192, 192, 0.2); }
.lb-item.bronze { background: rgba(205, 127, 50, 0.2); }

.lb-rank {
  font-weight: bold;
  color: var(--neon-cyan);
  width: 30px;
}

.lb-score {
  font-weight: bold;
  color: var(--neon-pink);
}

.lb-empty {
  color: var(--text-white);
  opacity: 0.5;
  padding: 20px;
}

.close-lb-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-weight: bold;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.3s ease;
}

.close-lb-btn:hover {
  background: rgba(0, 255, 255, 0.2);
}

/* Footer Links */
.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 11px;
}

.footer-links a {
  color: var(--neon-cyan);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.footer-links a:hover {
  opacity: 1;
  text-shadow: 0 0 8px var(--neon-cyan);
}

.footer-links a.more-games {
  color: var(--neon-pink);
  opacity: 0.8;
}

.footer-links a.more-games:hover {
  text-shadow: 0 0 8px var(--neon-pink);
}

.footer-links .divider {
  color: var(--neon-pink);
  opacity: 0.4;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .lane {
    width: 70px;
  }

  .target-zone {
    width: 60px;
    height: 60px;
    font-size: 32px;
  }

  .arrow {
    width: 56px;
    height: 56px;
    font-size: 32px;
  }

  .stat-value {
    font-size: 20px;
  }

  .feedback {
    font-size: 16px;
  }

  .focus-hint {
    font-size: 12px;
    padding: 12px 20px;
  }
}

@media (max-width: 480px) {
  .practice-container {
    padding: 5px;
  }

  .lanes {
    gap: 5px;
    padding: 5px;
  }

  .lane {
    width: 60px;
  }

  .target-zone {
    width: 54px;
    height: 54px;
    font-size: 28px;
  }

  .arrow {
    width: 50px;
    height: 50px;
    font-size: 28px;
  }

  .stat-label {
    font-size: 9px;
  }

  .stat-value {
    font-size: 18px;
  }

  .controls select, .controls button {
    padding: 8px;
    font-size: 14px;
  }
}
