/* Emoji Guess Game - Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #a8edea 0%, #c3b4f5 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.game-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: rgba(255, 255, 255, 0.15);
}

/* ===== Header / Status Bar ===== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  color: #4a3f6b;
}

.header-item span {
  font-size: 14px;
}

.lives {
  color: #e74c3c;
  letter-spacing: 2px;
}

.coins-display {
  color: #f39c12;
}

.sound-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* ===== Screens ===== */

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
  text-align: center;
}

.screen.active {
  display: flex;
}

/* ===== Start Screen ===== */

.start-screen .game-title {
  font-size: 42px;
  font-weight: 900;
  color: #4a3f6b;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);
}

.start-screen .game-subtitle {
  font-size: 18px;
  color: #6c5b9e;
  margin-bottom: 40px;
}

.start-screen .emoji-showcase {
  font-size: 64px;
  margin-bottom: 40px;
  animation: bounce 2s infinite;
}

.btn {
  padding: 16px 48px;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 1px;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
  margin-top: 12px;
}

.btn-small {
  padding: 10px 24px;
  font-size: 14px;
}

.high-score-display {
  margin-top: 24px;
  font-size: 16px;
  color: #6c5b9e;
  font-weight: 600;
}

/* ===== Game Screen ===== */

.game-screen {
  justify-content: flex-start;
  padding-top: 16px;
}

.category-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.emoji-display {
  font-size: 72px;
  padding: 20px;
  margin: 8px 0 20px;
  line-height: 1.3;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-area {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 24px;
  min-height: 52px;
  padding: 0 10px;
}

.answer-slot {
  width: 44px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid #d1c4e9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #4a3f6b;
  transition: all 0.15s;
}

.answer-slot.filled {
  background: white;
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.answer-slot.space {
  width: 16px;
  background: transparent;
  border: none;
}

.answer-slot.correct {
  background: #d4edda;
  border-color: #28a745;
  color: #28a745;
  animation: popIn 0.3s ease;
}

.answer-slot.wrong {
  animation: shake 0.4s ease;
  border-color: #e74c3c;
  background: #fde8e8;
}

/* ===== Keyboard ===== */

.keyboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 0 20px;
  margin-bottom: 16px;
  width: 100%;
}

.key-btn {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: white;
  color: #4a3f6b;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}

.key-btn:active {
  transform: scale(0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.key-btn.used {
  opacity: 0.3;
  pointer-events: none;
  transform: scale(0.85);
}

/* ===== Action Buttons ===== */

.action-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: auto;
  padding: 12px 16px 24px;
  width: 100%;
}

.action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s, opacity 0.15s;
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.hint-btn {
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  color: #b34a00;
}

.backspace-btn {
  background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
  color: #555;
}

.skip-btn {
  background: linear-gradient(135deg, #fbc2eb, #a6c1ee);
  color: #5b3a8c;
}

/* ===== Level Complete Screen ===== */

.level-screen {
  gap: 16px;
}

.level-screen .level-title {
  font-size: 32px;
  font-weight: 900;
  color: #4a3f6b;
}

.level-screen .level-emoji {
  font-size: 64px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 16px 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 900;
  color: #667eea;
}

.stat-card .stat-label {
  font-size: 12px;
  color: #6c5b9e;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ===== Game Over Screen ===== */

.gameover-screen .gameover-title {
  font-size: 36px;
  font-weight: 900;
  color: #e74c3c;
  margin-bottom: 8px;
}

.gameover-screen .gameover-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

.gameover-screen .final-score {
  font-size: 48px;
  font-weight: 900;
  color: #4a3f6b;
}

.gameover-screen .final-score-label {
  font-size: 14px;
  color: #6c5b9e;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.gameover-screen .high-score-badge {
  display: inline-block;
  padding: 6px 20px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin: 12px 0 24px;
}

.gameover-screen .btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

/* ===== Feedback Overlay ===== */

.feedback-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.feedback-overlay.show {
  display: flex;
}

.feedback-content {
  font-size: 72px;
  animation: popIn 0.4s ease;
}

/* ===== Streak Popup ===== */

.streak-popup {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 24px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  z-index: 50;
  display: none;
  animation: slideDown 0.3s ease;
  white-space: nowrap;
}

.streak-popup.show {
  display: block;
}

/* ===== Animations ===== */

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes slideDown {
  0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* ===== Responsive ===== */

@media (max-width: 480px) {
  .game-container {
    max-width: 100%;
  }

  .emoji-display {
    font-size: 56px;
  }

  .answer-slot {
    width: 38px;
    height: 42px;
    font-size: 19px;
  }

  .keyboard {
    gap: 6px;
    padding: 0 16px;
  }

  .key-btn {
    font-size: 20px;
    border-radius: 10px;
  }

  .start-screen .game-title {
    font-size: 32px;
  }
}

@media (max-width: 360px) {
  .emoji-display {
    font-size: 48px;
  }

  .answer-slot {
    width: 34px;
    height: 38px;
    font-size: 17px;
    border-radius: 8px;
  }

  .keyboard {
    gap: 5px;
    padding: 0 12px;
  }

  .key-btn {
    font-size: 18px;
    border-radius: 8px;
  }
}

@media (min-height: 800px) {
  .emoji-display {
    margin: 16px 0 28px;
  }
}
