/* Pixel Art Font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Archivo+Black&display=swap');

:root {
  --pixel-bg: #1a1a2e;
  --pixel-accent: #16213e;
  --neon-cyan: #0ff;
  --neon-pink: #f0f;
  --neon-yellow: #ff0;
  --neon-green: #0f0;
  --neon-red: #f00;
  --card-width: 300px;
  --card-height: 200px;
}

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

body {
  font-family: 'Press Start 2P', cursive;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #fff;
  overflow-x: hidden;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.game-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.game-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  padding-top: 60px;
}

.home-link {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 14px;
  color: var(--neon-cyan);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 8px 16px;
  border: 2px solid var(--neon-cyan);
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
  z-index: 100;
  cursor: pointer;
}

.home-link:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
  transform: translateX(-4px);
}

.game-header h1 {
  font-size: 28px;
  margin-bottom: 20px;
  text-shadow:
    4px 4px 0px rgba(0, 255, 255, 0.8),
    8px 8px 0px rgba(255, 0, 255, 0.6);
  animation: glitch 3s infinite;
  line-height: 1.3;
  padding: 0 60px;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 60px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

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

.streak-value {
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
}

/* Pixel Text */
.pixel-text {
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Game Area */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Loading Screen */
.loading-screen {
  text-align: center;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.loading-dots {
  font-size: 32px;
  color: var(--neon-cyan);
}

.loading-dots span {
  animation: dotPulse 1.5s infinite;
  display: inline-block;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Single Card Display */
.single-card-display {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Large Word Card */
.word-card-large {
  width: 100%;
  max-width: 500px;
  height: 250px;
  cursor: default;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.word-card-large .card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 16px;
  padding: 4px;
  background: linear-gradient(135deg, #fff, #ddd);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 255, 255, 0.4),
    inset 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Holographic Effect */
.word-card-large .card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.1) 0px,
      rgba(255, 255, 255, 0.2) 1px,
      transparent 1px,
      transparent 2px
    ),
    linear-gradient(
      135deg,
      rgba(0, 255, 255, 0.3) 0%,
      rgba(255, 0, 255, 0.3) 50%,
      rgba(255, 255, 0, 0.3) 100%
    );
  opacity: 0.8;
  mix-blend-mode: color-dodge;
  z-index: 2;
  pointer-events: none;
  animation: holoShift 3s linear infinite;
}

@keyframes holoShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}

.word-card-large .card-content {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

/* Pixel Border Effect */
.word-card-large .card-content::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0px, transparent 4px, rgba(255,255,255,0.05) 4px, rgba(255,255,255,0.05) 5px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 4px, rgba(255,255,255,0.05) 4px, rgba(255,255,255,0.05) 5px);
  pointer-events: none;
  border-radius: 14px;
}

.card-word-large {
  font-family: 'Archivo Black', sans-serif;
  font-size: 42px;
  text-align: center;
  color: #fff;
  text-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 255, 255, 0.5);
  padding: 0 20px;
  white-space: nowrap;
  max-width: 100%;
  letter-spacing: 2px;
}

.card-pronunciation {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

/* Question Text */
.question-text {
  font-size: 16px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  text-align: center;
}

/* Choices Container */
.choices-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.choice-button {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  padding: 20px 24px;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
  color: #fff;
  cursor: pointer;
  position: relative;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: 0 6px 0 #1a202c;
  line-height: 1.6;
  text-transform: none;
  letter-spacing: 0.5px;
}

.choice-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #1a202c;
  background: linear-gradient(180deg, #5a6678 0%, #3d4758 100%);
}

.choice-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #1a202c;
}

.choice-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.choice-button.correct {
  border-color: var(--neon-green);
  background: linear-gradient(180deg, #48bb78 0%, #2f855a 100%);
  box-shadow: 0 0 20px var(--neon-green);
  animation: correctPulse 0.6s ease-out;
}

.choice-button.wrong {
  border-color: var(--neon-red);
  background: linear-gradient(180deg, #f56565 0%, #c53030 100%);
  animation: wrongShake 0.5s ease-out;
}

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

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

/* Game Controls */
.game-controls {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* Pixel Buttons */
.pixel-button {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  padding: 16px 32px;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #4a90e2 0%, #2e5c8a 100%);
  color: #fff;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 8px 0 #1a3a5a;
}

.pixel-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 0 #1a3a5a;
}

.pixel-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #1a3a5a;
}

.skip-button {
  background: linear-gradient(180deg, #e24a90 0%, #8a2e5c 100%);
  box-shadow: 0 8px 0 #5a1a3a;
}

.skip-button:hover {
  box-shadow: 0 10px 0 #5a1a3a;
}

.skip-button:active {
  box-shadow: 0 4px 0 #5a1a3a;
}

.next-button {
  background: linear-gradient(180deg, #48bb78 0%, #2f855a 100%);
  box-shadow: 0 8px 0 #1a4d2e;
}

.next-button:hover {
  box-shadow: 0 10px 0 #1a4d2e;
}

.next-button:active {
  box-shadow: 0 4px 0 #1a4d2e;
}

/* Result Screen */
.result-screen {
  width: 100%;
  max-width: 600px;
  animation: fadeIn 0.4s ease-out;
}

.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px;
  background: rgba(0, 0, 0, 0.4);
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.result-icon {
  font-size: 64px;
  animation: iconBounce 0.6s ease-out;
}

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

.result-title {
  font-size: 24px;
  text-align: center;
}

.result-title.correct {
  color: var(--neon-green);
  text-shadow: 0 0 20px var(--neon-green);
}

.result-title.wrong {
  color: var(--neon-red);
  text-shadow: 0 0 20px var(--neon-red);
}

.result-message {
  font-size: 14px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.correct-definition {
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  text-transform: none;
  letter-spacing: 0.5px;
}

.example-sentence {
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
  color: rgba(255, 255, 0, 0.9);
  padding: 20px;
  background: rgba(255, 255, 0, 0.05);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 0, 0.2);
  text-transform: none;
  letter-spacing: 0.5px;
  font-style: italic;
  margin-top: 16px;
}

.inline-definition {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  padding: 16px 20px;
  background: rgba(0, 255, 0, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(0, 255, 0, 0.3);
  text-transform: none;
  letter-spacing: 0.5px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glitch Animation */
@keyframes glitch {
  0%, 90%, 100% {
    transform: translate(0);
  }
  92% {
    transform: translate(-2px, 2px);
  }
  94% {
    transform: translate(2px, -2px);
  }
  96% {
    transform: translate(-2px, -2px);
  }
  98% {
    transform: translate(2px, 2px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .home-link {
    font-size: 10px;
    padding: 6px 12px;
    position: absolute;
    left: 0;
    top: 0;
  }

  .game-header {
    padding-top: 50px;
  }

  .game-header h1 {
    font-size: 16px;
    padding: 0 10px;
    line-height: 1.4;
  }

  .stats {
    gap: 30px;
  }

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

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

  .word-card-large {
    height: 200px;
  }

  .card-word-large {
    font-family: 'Archivo Black', sans-serif;
    letter-spacing: 1px;
    /* Font size is dynamically set by JavaScript */
    white-space: nowrap;
  }

  .card-pronunciation {
    font-size: 12px;
  }

  .question-text {
    font-size: 12px;
  }

  .choice-button {
    font-size: 10px;
    padding: 16px 20px;
  }

  .pixel-button {
    font-size: 10px;
    padding: 12px 24px;
  }

  .result-icon {
    font-size: 48px;
  }

  .result-title {
    font-size: 18px;
  }

  .result-message {
    font-size: 12px;
  }

  .correct-definition {
    font-size: 10px;
  }

  .example-sentence {
    font-size: 10px;
    padding: 16px;
  }

  .inline-definition {
    font-size: 12px;
    padding: 12px 16px;
  }
}

/* Leaderboard Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background-color: var(--pixel-bg);
  margin: 10% auto;
  padding: 30px;
  border: 4px solid var(--neon-blue);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
  position: relative;
  animation: slideDown 0.3s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 4px solid var(--neon-blue);
  padding-bottom: 15px;
}

.modal-header h2 {
  color: var(--neon-blue);
  margin: 0;
  font-size: 20px;
  text-shadow: 2px 2px 0 #000;
  line-height: 1.4;
}

.close-btn {
  color: var(--neon-blue);
  background: none;
  border: none;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0 10px;
}

.close-btn:hover {
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
}

.leaderboard-list {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

/* Custom Scrollbar */
.leaderboard-list::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: var(--neon-blue);
  border-radius: 4px;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 10px;
  border-bottom: 2px solid rgba(0, 243, 255, 0.1);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #fff;
  transition: background 0.2s;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-item:nth-child(1) { color: var(--neon-yellow); text-shadow: 0 0 5px rgba(255, 255, 0, 0.5); }
.leaderboard-item:nth-child(2) { color: #c0c0c0; text-shadow: 0 0 5px rgba(192, 192, 192, 0.5); }
.leaderboard-item:nth-child(3) { color: #cd7f32; text-shadow: 0 0 5px rgba(205, 127, 50, 0.5); }

.leaderboard-rank { width: 50px; }
.leaderboard-name { flex-grow: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.leaderboard-score { width: 80px; text-align: right; }

/* High Score Form */
.pixel-input {
  background: rgba(0, 0, 0, 0.5);
  border: 4px solid var(--neon-blue);
  color: #fff;
  padding: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  outline: none;
  width: 200px;
  text-transform: uppercase;
  box-shadow: 0 4px 0 rgba(0, 243, 255, 0.2);
}

.pixel-input:focus {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.3);
}

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

@keyframes slideDown {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
  .modal-content {
    margin: 20% auto;
    width: 95%;
    padding: 20px;
  }
  
  .modal-header h2 {
    font-size: 16px;
  }
  
  .leaderboard-item {
    font-size: 10px;
  }
}
