/* Language Dojo × Project DIVA - Complete Styles */

:root {
  /* Diva Colors - Updated for kawaii consistency */
  --diva-cyan: #7eb8da;
  --diva-pink: #f7a8c7;
  --diva-purple: #b89cd6;
  --diva-blue: #7eb8da;
  --diva-green: #85d4bd;
  --diva-yellow: #f5d76e;
  --diva-orange: #ffb085;

  /* PlayStation Button Colors */
  --ps-triangle: #5bc0a8;
  --ps-circle: #e85d8c;
  --ps-cross: #5b8fc0;
  --ps-square: #e8a85d;

  /* UI Colors */
  --bg-dark: #2d2d44;
  --bg-light: var(--panel);
  --text-light: #ffffff;

  /* Judgment Colors */
  --judge-cool: #35a7ff;
  --judge-great: #00c853;
  --judge-fine: #ffb300;
  --judge-miss: #ff1744;

  /* Animations */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Study Canvas Styles */
#study {
  background: linear-gradient(
    135deg,
    var(--diva-purple) 0%,
    var(--diva-pink) 50%
  );
  border-radius: 16px;
  position: relative;
}

.study-canvas-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

#studyCanvas {
  width: 100%;
  height: auto;
  max-height: 80vh;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: block;
  image-rendering: pixelated;
}

.study-hud-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.study-hud-overlay .hud-pill {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.study-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.study-controls .pixel-btn {
  font-size: 14px;
  padding: 8px 12px;
}

/* Floating Miku */
.floating-miku {
  position: fixed;
  right: 2%;
  bottom: 5%;
  width: 200px;
  opacity: 0.3;
  transition: all 0.3s ease;
  z-index: -1;
  pointer-events: none;
  animation: floatMiku 6s ease-in-out infinite;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

/* In typing mode, make floating Miku more visible */
.typing-active .floating-miku,
.typing-active #floatingMikusContainer {
  opacity: 0.7;
  transform: scale(1.1);
}

/* Hide rhythm game elements in typing mode */
.typing-active .rhythm-lanes {
  display: none !important;
}

.typing-active .question-content {
  display: none !important;
}

.typing-active .answer-grid {
  display: none !important;
}

/* Main HUD */
.main-hud {
  padding: 20px;
  background: linear-gradient(
    180deg,
    rgba(45, 45, 68, 0.95) 0%,
    rgba(45, 45, 68, 0.6) 50%,
    transparent 100%
  );
  backdrop-filter: blur(5px);
  z-index: 100;
  animation: hudSlideIn 0.5s var(--ease-out);
}

.hud-top,
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.hud-bottom {
  gap: 15px;
  flex-wrap: wrap;
}

/* Judge Echo - positioned in hud-bottom */
.judge-echo {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-light);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  padding: 6px 15px;
  background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-purple));
  border-radius: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: pulseBorder 2s infinite;
  min-width: 80px;
  text-align: center;
  order: 3; /* Places it between timer and lives */
  letter-spacing: 1px;
}

@keyframes pulseBorder {
  0%,
  100% {
    border-color: var(--pastel-pink);
    box-shadow: 0 0 10px var(--pastel-pink);
  }
  50% {
    border-color: var(--pastel-purple);
    box-shadow: 0 0 20px var(--pastel-purple);
  }
}

.hud-top,
.hud-bottom {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 10px;
}

.level-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: linear-gradient(135deg, var(--diva-purple), var(--diva-blue));
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.level-display .label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
}

.level-display .value {
  font-size: 20px;
  font-weight: 900;
  color: white;
}

.voltage-bar {
  flex: 1;
  max-width: 300px;
  height: 24px;
  background: rgba(45, 45, 68, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.voltage-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--diva-cyan), var(--diva-pink));
  box-shadow: 0 0 20px var(--diva-cyan);
  transition: width 0.3s var(--ease-out);
}

.voltage-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
}

.combo-display {
  background: rgba(45, 45, 68, 0.6);
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.combo-label {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 700;
  margin-right: 8px;
}

.combo-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-light);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  order: 1;
}

.score-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 2px;
}

.score-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-light);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  font-weight: 700;
  font-size: 16px;
  order: 2;
}

.timer-icon {
  font-size: 18px;
}

.timer-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

.lives-display {
  display: flex;
  gap: 5px;
  order: 4; /* Places it after judge echo */
}

.life {
  font-size: 16px;
  color: var(--diva-pink);
  text-shadow: 0 0 6px rgba(247, 168, 199, 0.6);
  transition: all 0.3s;
}

.life:not(.active) {
  color: rgba(255, 255, 255, 0.3);
  text-shadow: none;
}

/* Judgment Display */
.judgment-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}

.judgment-display.show {
  animation: judgmentPop 0.5s var(--ease-bounce);
}

.judgment-display.cool {
  color: var(--judge-cool);
  text-shadow: 0 0 30px var(--judge-cool);
}

.judgment-display.great {
  color: var(--judge-great);
  text-shadow: 0 0 30px var(--judge-great);
}

.judgment-display.fine {
  color: var(--judge-fine);
  text-shadow: 0 0 30px var(--judge-fine);
}

.judgment-display.miss {
  color: var(--judge-miss);
  text-shadow: 0 0 30px var(--judge-miss);
}

/* Main Container */
.main-container {
  max-width: 1200px;
  padding: 20px;
  position: relative;
  z-index: 10;
}

/* Menu Panel */
.menu-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: panelFadeIn 0.6s var(--ease-out);
}

.dojo-title {
  text-align: center;
  margin-bottom: 30px;
}

.title-jp {
  display: block;
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--diva-purple), var(--diva-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 5px;
}

.title-en {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 5px;
}

.title-diva {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--diva-cyan);
  letter-spacing: 2px;
}

/* Difficulty Selector */
.difficulty-selector {
  background: linear-gradient(
    135deg,
    rgba(165, 148, 249, 0.1),
    rgba(107, 195, 255, 0.1)
  );
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 25px;
}

.difficulty-selector label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ink);
}

#difficultySlider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--diva-green) 0%,
    var(--diva-yellow) 50%,
    var(--diva-pink) 100%
  );
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#difficultySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--diva-purple);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.diff-display {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-weight: 700;
}

#diffValue {
  font-size: 24px;
  color: var(--diva-purple);
}

#diffLabel {
  font-size: 14px;
  padding: 5px 10px;
  background: linear-gradient(135deg, var(--diva-purple), var(--diva-pink));
  color: white;
  border-radius: 10px;
}

/* Game Modes */
.game-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

.mode-btn {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(250, 251, 252, 0.95)
  );
  border: 2px solid var(--border);
  border-radius: 15px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mode-btn::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(255, 192, 203, 0.7),
    rgba(255, 235, 59, 0.6)
  );
  border-radius: 15px;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s;
}

.mode-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(230, 209, 255, 0.4);
}

.mode-btn:hover::before {
  opacity: 1;
}

.mode-icon {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 10px;
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--ink);
}

.mode-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 5px;
}

.mode-desc {
  font-size: 12px;
  color: #4a5568;
  font-weight: 600;
}

/* Word of the Day */
.wod-panel {
  background: linear-gradient(135deg, var(--pastel-yellow), var(--pastel-pink));
  border-radius: 15px;
  padding: 15px;
  margin-top: 15px;
  border: 2px solid var(--pastel-purple);
  box-shadow: 0 4px 20px rgba(230, 209, 255, 0.3);
}

.wod-panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wod-content {
  min-height: 120px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 255, 255, 0.5);
  padding: 10px;
  border-radius: 10px;
  text-align: center;
}

.wod-word {
  font-size: 24px;
  font-weight: 900;
  color: var(--diva-purple);
  margin-bottom: 3px;
}

.wod-reading {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}

.wod-meaning {
  font-size: 14px;
  color: var(--ink);
}

.wod-next {
  background: linear-gradient(135deg, var(--pastel-mint), var(--pastel-blue));
  color: var(--ink);
  border: 2px solid var(--pastel-purple);
  padding: 8px 16px;
  border-radius: 15px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
}

.wod-next:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px var(--pastel-purple);
}

/* Daily Quests */
.daily-quests {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 15px;
  padding: 20px;
}

.daily-quests h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--ink);
}

.quest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 10px;
  margin-bottom: 10px;
}

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

.quest-text {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
}

.quest-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--diva-purple);
}

/* Game Area */
.game-area {
  /* shiny pastel */
  background: linear-gradient(
    var(--panel),
    var(--diva-purple),
    var(--panel),
    var(--panel),
    var(--panel)
  );
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  min-height: 600px;
}

/* Rhythm Lanes */
.rhythm-lanes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 250px;
  display: flex;
  justify-content: space-around;
  padding: 10px 20px;
  pointer-events: none;
  z-index: 5;
}

.lane {
  width: 60px;
  position: relative;
}

.lane-track {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
}

.lane-target {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  border: 3px solid;
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 20px currentColor;
}

.lane-triangle .lane-target {
  color: var(--ps-triangle);
  border-color: var(--ps-triangle);
}

.lane-circle .lane-target {
  color: var(--ps-circle);
  border-color: var(--ps-circle);
}

.lane-cross .lane-target {
  color: var(--ps-cross);
  border-color: var(--ps-cross);
}

.lane-square .lane-target {
  color: var(--ps-square);
  border-color: var(--ps-square);
}

/* Falling Notes */
.falling-note {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  animation: noteFall 2s ease-out;
}

.falling-note.triangle {
  background: var(--ps-triangle);
}

.falling-note.circle {
  background: var(--ps-circle);
}

.falling-note.cross {
  background: var(--ps-cross);
}

.falling-note.square {
  background: var(--ps-square);
}

/* Subtle fade-out when note passes target */
.falling-note.fade-out {
  animation: noteFadeOut 300ms ease-out forwards;
}

@keyframes noteFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
}

/* Question Panel */
.question-panel {
  margin-top: 260px;
  margin-bottom: 30px;
  text-align: center;
  position: relative;
}

.question-timer {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 30px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 15px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--diva-green),
    var(--diva-yellow),
    var(--diva-pink)
  );
  transition: width 1s linear;
  width: 100%;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.question-content {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(250, 251, 252, 0.95)
  );
  border: 2px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin: 15px;
}

.question-jp {
  font-size: 40px;
  color: var(--diva-purple);
}

.question-sub {
  font-size: 18px;
  color: #666;
}

/* Answer Grid */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 15px;
  max-width: 600px;
  margin: 0 auto;
  min-height: 200px;
}

.answer-btn {
  position: relative;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff, #fafbfc);
  border: 3px solid;
  border-radius: 15px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  overflow: hidden;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
}

.answer-btn[data-ps="triangle"] {
  border-color: var(--ps-triangle);
  color: var(--ps-triangle);
}

.answer-btn[data-ps="circle"] {
  border-color: var(--ps-circle);
  color: var(--ps-circle);
}

.answer-btn[data-ps="cross"] {
  border-color: var(--ps-cross);
  color: var(--ps-cross);
}

.answer-btn[data-ps="square"] {
  border-color: var(--ps-square);
  color: var(--ps-square);
}

.answer-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.answer-btn.correct {
  background: linear-gradient(135deg, #3ca05b, #7ec144);
  color: #fff;
  animation: correctPulse 0.5s;
}

.answer-btn.incorrect {
  background: linear-gradient(135deg, #df3a32, #d7185a);
  color: #fff;
  animation: shake 0.5s;
}

.answer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ps-symbol {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 20px;
  opacity: 0.5;
}

/* Typing Area */
.typing-area {
  max-width: 700px;
  margin: 60px auto 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(250, 251, 252, 0.95)
  );
  border: 2px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.typing-target {
  text-align: center;
  margin-bottom: 15px;
}
.typing-target .jp-text {
  font-size: 48px;
  font-weight: 900;
  color: var(--diva-purple);
  margin-bottom: 8px;
}
.typing-target .sub-text {
  font-size: 16px;
  color: #4a5568;
  font-weight: 600;
}

.typing-input {
  width: 100%;
  max-width: 400px;
  padding: 15px;
  font-size: 24px;
  border: 2px solid var(--border);
  border-radius: 15px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.typing-input:focus {
  border-color: var(--diva-purple);
  box-shadow: 0 0 15px rgba(184, 156, 214, 0.3);
}

.typing-feedback {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  min-height: 30px;
}

.typing-feedback.correct {
  color: var(--judge-cool);
}

.typing-feedback.incorrect {
  color: var(--judge-miss);
}

/* Song Over Modal */
.song-over-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10002; /* above other site modals */
}

.song-over-modal.show {
  display: flex;
  animation: fadeIn 0.3s;
}

.modal-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid;
  border-radius: 50%;
  opacity: 0;
}

.ring-1 {
  width: 300px;
  height: 300px;
  border-color: var(--diva-purple);
  animation: ringExpand 2s infinite;
}

.ring-2 {
  width: 400px;
  height: 400px;
  border-color: var(--diva-cyan);
  animation: ringExpand 2s 0.5s infinite;
}

.ring-3 {
  width: 500px;
  height: 500px;
  border-color: var(--diva-pink);
  animation: ringExpand 2s 1s infinite;
}

.modal-content {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(250, 251, 252, 0.95)
  );
  border-radius: 30px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: modalBounce 0.5s var(--ease-bounce);
}

.song-complete {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--ink), var(--diva-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 20px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank-display {
  font-size: 120px;
  font-weight: 900;
  margin: 20px 0;
  background: linear-gradient(135deg, var(--diva-yellow), var(--diva-green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 5px 20px rgba(255, 243, 209, 0.5);
  animation: rankPulse 1s infinite;
}

.hit-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 30px 0;
}

.hit-stat {
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.hit-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--ink);
}

.hit-value {
  display: block;
  font-size: 24px;
  font-weight: 900;
}

.hit-stat.cool .hit-label {
  color: var(--judge-cool);
}
.hit-stat.great .hit-label {
  color: var(--judge-great);
}
.hit-stat.fine .hit-label {
  color: var(--judge-fine);
}
.hit-stat.miss .hit-label {
  color: var(--judge-miss);
}

.reward-display {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1),
    rgba(255, 193, 7, 0.1)
  );
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
}

.reward-label {
  font-size: 14px;
  font-weight: 800;
  color: #4a5568;
  margin-bottom: 10px;
}

.reward-amount {
  font-size: 36px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 5px;
}

.reward-bonus {
  font-size: 12px;
  color: #4a5568;
  font-weight: 600;
}

.modal-continue {
  background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-purple));
  color: var(--ink);
  border: 2px solid var(--pastel-purple);
  padding: 15px 40px;
  border-radius: 25px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 20px;
  box-shadow: 0 4px 15px rgba(230, 209, 255, 0.3);
}

.modal-continue:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(230, 209, 255, 0.5);
}

/* Effects Layer */
.effects-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}

.ring-effect {
  position: absolute;
  border: 3px solid;
  border-radius: 50%;
  animation: ringBurst 0.5s ease-out;
}

.burst-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: particleBurst 0.8s ease-out;
}

/* Animations */
@keyframes floatMiku {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes subtlePulse {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.2;
  }
}

@keyframes hudSlideIn {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes noteFall {
  from {
    /* Start much higher so notes fall from above the visible lane */
    top: -140px;
  }
  to {
    /* End slightly past the bottom to allow fade-out to trigger cleanly */
    top: calc(100% + 20px);
  }
}

@keyframes correctPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

@keyframes ringExpand {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

@keyframes modalBounce {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes rankPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ringBurst {
  from {
    width: 50px;
    height: 50px;
    opacity: 1;
  }
  to {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

@keyframes particleBurst {
  from {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* Loading States */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--diva-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-hud {
    padding: 10px 15px;
  }

  .hud-top,
  .hud-bottom {
    flex-wrap: wrap;
    gap: 10px;
  }

  .voltage-bar {
    max-width: 200px;
  }

  .game-modes {
    grid-template-columns: 1fr;
  }

  .answer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    min-height: 180px;
  }
  .answer-btn {
    padding: 15px 10px;
    font-size: 16px;
    min-height: 80px;
  }

  .rhythm-lanes {
    height: 180px;
  }

  .question-panel {
    margin-top: 200px;
  }

  .floating-miku {
    width: 150px;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .rank-display {
    font-size: 80px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* Dropdown Styling */
.mode-options select,
select#vocabDirection,
select#kanjiDirection {
  appearance: none;
  -webkit-appearance: none;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23596286' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 32px 8px 10px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.mode-options select:hover,
select#vocabDirection:hover,
select#kanjiDirection:hover {
  border-color: var(--diva-purple);
  box-shadow: 0 4px 12px rgba(165, 148, 249, 0.2);
}

.mode-options select:focus,
select#vocabDirection:focus,
select#kanjiDirection:focus {
  outline: none;
  border-color: var(--diva-cyan);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

/* Stage Singer */
#stageSinger {
  position: absolute;
  right: 80%;
  top: 0;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s;
}

#stageSinger img {
  width: 120px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
  animation: floatMiku 3s ease-in-out infinite;
}

/* typing mode big singer */
.typing-active #stageSinger {
  top: -70%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  opacity: 0.95;
}

.typing-active #stageSinger img {
  width: 160px;
  height: auto;
}

/* Focus Styles */
button:focus,
input:focus,
select:focus {
  outline: 3px solid var(--diva-purple);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .main-hud,
  .floating-miku,
  .effects-layer,
  .song-over-modal {
    display: none !important;
  }
}

/* Additional styles added for new hint and speech bubble */
/* Typing hint, small grey text */
.typing-hint {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.3;
  color: #6b7280;
  font-weight: 700;
  text-align: center;
}

/* Speech bubble for singer */
.speech-bubble {
  position: absolute;
  left: 50%;
  top: -60px;
  transform: translateX(-50%);
  background: linear-gradient(
    135deg,
    var(--pastel-blue) 0%,
    var(--pastel-pink) 50%,
    var(--pastel-purple) 100%
  );
  color: var(--ink);
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(43, 43, 68, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  white-space: normal;
  min-width: 120px;
  max-width: 320px;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  text-align: center;
  line-height: 1.3;
  z-index: 10;
  animation: floatMiku 3s ease-in-out infinite;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--pastel-pink);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
