/* ===== Game System Styles ===== */

/* ===== XP Bar (fixed top) ===== */
.game-xp-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(26, 26, 26, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.game-xp-bar-level {
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFD600;
  white-space: nowrap;
  min-width: 58px;
}
.game-xp-bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.game-xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #E91E63, #FF6D00, #FFD600);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.game-xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: xp-shimmer 2s ease-in-out infinite;
}
@keyframes xp-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.game-xp-bar-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Push content below XP bar */
body { padding-top: 28px !important; }
.game-xp-bar ~ .navbar,
.game-xp-bar ~ .bg-blobs,
.game-xp-bar ~ .emoji-particles,
.game-xp-bar ~ .page-loader { top: 28px; }
.game-xp-bar ~ .navbar { top: 28px; }
.game-xp-bar ~ .bg-blobs { top: 28px; }

/* ===== XP Float Animation ===== */
.game-xp-float {
  position: fixed;
  z-index: 10000;
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFD600;
  text-shadow: 0 2px 8px rgba(255,214,0,0.5), 0 0 20px rgba(255,214,0,0.3);
  pointer-events: none;
  animation: xp-float-up 1.5s ease-out forwards;
  transform: translateX(-50%);
}
@keyframes xp-float-up {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) translateY(-40px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-80px) scale(0.8); }
}

/* ===== Combo Float ===== */
.game-combo-float {
  position: fixed;
  z-index: 10001;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0);
  text-align: center;
  pointer-events: none;
  animation: combo-pop 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.combo-num {
  display: block;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.combo-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #FF6D00;
  text-transform: uppercase;
  letter-spacing: 2px;
}
@keyframes combo-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-10deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(5deg); }
  60% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.8); }
}

/* ===== Level Up Overlay ===== */
.game-levelup-overlay {
  position: fixed;
  z-index: 10002;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: levelup-fade-in 0.5s ease;
  transition: opacity 0.5s;
}
.game-levelup-content {
  text-align: center;
  animation: levelup-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-levelup-icon {
  font-size: 5rem;
  animation: levelup-spin 1s ease;
}
.game-levelup-title {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
  font-weight: 600;
}
.game-levelup-level {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.game-levelup-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
@keyframes levelup-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes levelup-bounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes levelup-spin {
  0% { transform: rotate(0deg) scale(0); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ===== Achievement Unlock Toast ===== */
.game-ach-unlock {
  position: fixed;
  z-index: 10003;
  top: 80px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1a1a1a, #333);
  border: 2px solid #FFD600;
  border-radius: 16px;
  padding: 14px 18px;
  animation: ach-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: all 0.5s;
  max-width: 280px;
  box-shadow: 0 8px 32px rgba(255,214,0,0.3);
}
.ach-unlock-icon {
  font-size: 2.2rem;
  animation: ach-icon-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}
.ach-unlock-info { flex: 1; }
.ach-unlock-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #FFD600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.ach-unlock-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}
.ach-unlock-desc {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}
@keyframes ach-slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes ach-icon-bounce {
  0% { transform: scale(0) rotate(-30deg); }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ===== Adventure Map Styles ===== */
.adventure-map {
  padding: 20px 16px;
  position: relative;
}
.adventure-map::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 4px;
  height: calc(100% - 40px);
  background: linear-gradient(180deg, rgba(233,30,99,0.15), rgba(255,109,0,0.15));
  border-radius: 4px;
  transform: translateX(-50%);
  margin-top: 20px;
}

.stage-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.stage-node:nth-child(odd) { flex-direction: row-reverse; }
.stage-node:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 8px 32px rgba(233,30,99,0.15); }

.stage-node.locked {
  opacity: 0.5;
  filter: grayscale(0.6);
  cursor: not-allowed;
}
.stage-node.locked:hover { transform: none; box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

.stage-node.current {
  border: 2px solid var(--pink, #E91E63);
  box-shadow: 0 0 0 4px rgba(233,30,99,0.15), 0 8px 32px rgba(233,30,99,0.15);
  animation: stage-pulse 2s ease-in-out infinite;
}
@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(233,30,99,0.15), 0 8px 32px rgba(233,30,99,0.15); }
  50% { box-shadow: 0 0 0 8px rgba(233,30,99,0.08), 0 8px 32px rgba(233,30,99,0.2); }
}

.stage-node.cleared {
  background: linear-gradient(135deg, #fff, #FCE4EC);
}
.stage-node.cleared::after {
  content: '✅';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.2rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stage-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  position: relative;
}
.stage-icon::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 19px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(233,30,99,0.3), rgba(255,109,0,0.3)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.stage-info { flex: 1; }
.stage-name {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.stage-desc {
  font-size: 0.78rem;
  color: #999;
}
.stage-lock-info {
  font-size: 0.72rem;
  color: #E91E63;
  font-weight: 600;
  margin-top: 4px;
}

/* ===== Daily Quest Card ===== */
.quest-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quest-card:hover { transform: translateX(4px); }
.quest-card.completed {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  border: 1px solid #A5D6A7;
}
.quest-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(233,30,99,0.08);
  flex-shrink: 0;
}
.quest-card.completed .quest-icon {
  background: rgba(76,175,80,0.15);
}
.quest-info { flex: 1; }
.quest-name { font-size: 0.85rem; font-weight: 700; }
.quest-progress-track {
  height: 6px;
  background: rgba(0,0,0,0.06);
  border-radius: 6px;
  margin-top: 6px;
  overflow: hidden;
}
.quest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #E91E63, #FF6D00);
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quest-card.completed .quest-progress-fill {
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
}
.quest-xp {
  font-size: 0.72rem;
  font-weight: 700;
  color: #FF6D00;
  white-space: nowrap;
}
.quest-card.completed .quest-xp { color: #4CAF50; }
.quest-check {
  font-size: 1.2rem;
  color: #4CAF50;
  flex-shrink: 0;
}

/* ===== Battle Mode Styles ===== */
.battle-header {
  background: linear-gradient(135deg, #C62828, #E91E63);
  border-radius: 20px;
  padding: 20px;
  color: #fff;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.battle-header::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.battle-title {
  font-size: 0.85rem;
  opacity: 0.8;
}
.battle-monster {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.battle-monster-icon { font-size: 2.5rem; }
.battle-monster-info { flex: 1; }
.battle-monster-name {
  font-size: 1.1rem;
  font-weight: 800;
}
.battle-hp-track {
  height: 12px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  margin-top: 6px;
  overflow: hidden;
}
.battle-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF5252, #FFD600, #69F0AE);
  border-radius: 12px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.battle-hp-text {
  font-size: 0.7rem;
  margin-top: 4px;
  opacity: 0.8;
}
.battle-combo {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 8px;
  color: #FFD600;
}

/* Quiz answer feedback */
.quiz-option.correct {
  background: #E8F5E9 !important;
  border-color: #4CAF50 !important;
  color: #2E7D32 !important;
  animation: quiz-correct 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quiz-option.wrong {
  background: #FFEBEE !important;
  border-color: #F44336 !important;
  color: #C62828 !important;
  animation: quiz-wrong 0.5s ease;
}
@keyframes quiz-correct {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes quiz-wrong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ===== Flashcard Treasure ===== */
.fc-treasure {
  text-align: center;
  padding: 16px;
  margin-bottom: 16px;
}
.fc-treasure-chest {
  font-size: 4rem;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
}
.fc-treasure-chest:hover { transform: scale(1.15) rotate(-5deg); }
.fc-treasure-chest.opening {
  animation: chest-open 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes chest-open {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(1.2) rotate(-10deg); }
  60% { transform: scale(0.9) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
.fc-treasure-reward {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #FF6D00;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fc-treasure-reward.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Boss Interview ===== */
.boss-header {
  background: linear-gradient(135deg, #4A148C, #9C27B0, #E91E63);
  border-radius: 20px;
  padding: 24px;
  color: #fff;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.boss-header::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.boss-header::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.boss-icon { font-size: 3.5rem; animation: boss-idle 2s ease-in-out infinite; }
@keyframes boss-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.boss-name {
  font-size: 1.2rem;
  font-weight: 900;
  margin-top: 8px;
}
.boss-subtitle {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 4px;
}
.boss-hp-track {
  height: 16px;
  background: rgba(255,255,255,0.2);
  border-radius: 16px;
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}
.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #F44336, #FF5252, #FF8A80);
  border-radius: 16px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.boss-hp-fill.low {
  background: linear-gradient(90deg, #FF1744, #F44336);
  animation: boss-hp-flash 0.5s ease infinite;
}
@keyframes boss-hp-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.boss-hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.boss-timer {
  margin-top: 12px;
  font-size: 1.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.boss-timer.warning { color: #FF1744; animation: timer-pulse 0.5s ease infinite; }
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===== Victory Screen ===== */
.victory-overlay {
  position: fixed;
  z-index: 10004;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: victory-fade 0.5s ease;
}
.victory-content {
  text-align: center;
  animation: victory-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}
.victory-icon { font-size: 5rem; }
.victory-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 12px;
}
.victory-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
}
.victory-xp {
  font-size: 1.5rem;
  font-weight: 800;
  color: #FFD600;
  margin-top: 16px;
}
.victory-btn {
  margin-top: 24px;
  padding: 14px 36px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #E91E63, #FF6D00);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.victory-btn:hover { transform: scale(1.05); }
.victory-btn:active { transform: scale(0.95); }
@keyframes victory-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes victory-bounce {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Character Status Card ===== */
.char-card {
  background: linear-gradient(135deg, #1a1a1a, #333);
  border-radius: 20px;
  padding: 20px;
  color: #fff;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.char-card::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(233,30,99,0.15);
}
.char-card::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,109,0,0.1);
}
.char-top {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.char-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(233,30,99,0.3), rgba(255,109,0,0.3));
  border: 2px solid rgba(255,214,0,0.3);
}
.char-info { flex: 1; }
.char-name {
  font-size: 1rem;
  font-weight: 800;
}
.char-title {
  font-size: 0.75rem;
  color: #FFD600;
  font-weight: 600;
}
.char-level-badge {
  padding: 4px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  color: #1a1a1a;
  font-size: 0.72rem;
  font-weight: 800;
}
.char-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}
.char-stat {
  text-align: center;
  padding: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
}
.char-stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFD600;
}
.char-stat-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

/* ===== Pet Widget ===== */
.pet-widget {
  position: fixed;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.pet-bubble {
  background: #fff;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 0.7rem;
  color: #E91E63;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(233,30,99,0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  position: relative;
}
.pet-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
}
.pet-bubble.pet-bubble-show {
  opacity: 1;
  transform: translateY(0);
}
.pet-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FCE4EC, #FFF3E0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(233,30,99,0.25);
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pet-avatar:hover {
  transform: scale(1.1);
}
.pet-icon {
  font-size: 1.6rem;
  transition: transform 0.3s;
}
.pet-bounce {
  animation: pet-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pet-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-12px) scale(1.2); }
  50% { transform: translateY(-6px); }
  70% { transform: translateY(-8px) scale(1.05); }
}
.pet-name-tag {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 700;
  background: #E91E63;
  color: #fff;
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.pet-hunger-bar {
  width: 40px;
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.pet-hunger-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF5252, #FF6D00, #69F0AE);
  border-radius: 4px;
  transition: width 0.5s;
}
.pet-actions {
  display: flex;
  gap: 4px;
}
.pet-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pet-btn:hover {
  transform: scale(1.15);
}
.pet-btn:active {
  transform: scale(0.9);
}

/* ===== Gacha Page Styles ===== */
.gacha-container {
  min-height: 100vh;
  padding: 80px 16px 100px;
  background: linear-gradient(180deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.gacha-header {
  text-align: center;
  margin-bottom: 24px;
}
.gacha-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00, #E91E63);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gacha-subtitle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}
.gacha-machine {
  max-width: 320px;
  margin: 0 auto 32px;
  background: linear-gradient(135deg, #2a1a4e, #1a0a3e);
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  border: 2px solid rgba(255,214,0,0.2);
  box-shadow: 0 8px 40px rgba(233,30,99,0.3), inset 0 0 60px rgba(233,30,99,0.05);
  position: relative;
  overflow: hidden;
}
.gacha-machine::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(255,214,0,0.05), transparent, rgba(233,30,99,0.05), transparent);
  animation: gacha-rotate 8s linear infinite;
}
@keyframes gacha-rotate {
  to { transform: rotate(360deg); }
}
.gacha-orb {
  width: 100px;
  height: 100px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFD600, #FF6D00, #E91E63);
  box-shadow: 0 0 40px rgba(255,214,0,0.4), 0 0 80px rgba(233,30,99,0.2);
  animation: gacha-orb-pulse 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
  cursor: pointer;
}
.gacha-orb:active {
  transform: scale(0.9);
}
@keyframes gacha-orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(255,214,0,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(255,214,0,0.6), 0 0 100px rgba(233,30,99,0.3); }
}
.gacha-orb-text {
  font-size: 2rem;
  line-height: 100px;
}
.gacha-pull-btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 30px;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gacha-pull-btn:active { transform: scale(0.92); }
.gacha-pull-free {
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(255,214,0,0.4);
}
.gacha-pull-pay {
  background: linear-gradient(135deg, #E91E63, #9C27B0);
  color: #fff;
  box-shadow: 0 4px 20px rgba(233,30,99,0.4);
  margin-top: 8px;
}
.gacha-rates {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

/* Gacha Result Overlay */
.gacha-result-overlay {
  position: fixed;
  z-index: 10005;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gacha-result-in 0.5s ease;
}
@keyframes gacha-result-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.gacha-result-card {
  width: 280px;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  animation: gacha-card-reveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.gacha-result-card.rarity-R {
  background: linear-gradient(135deg, #37474F, #455A64);
  border: 2px solid #78909C;
  box-shadow: 0 8px 32px rgba(120,144,156,0.4);
}
.gacha-result-card.rarity-SR {
  background: linear-gradient(135deg, #4A148C, #7B1FA2);
  border: 2px solid #CE93D8;
  box-shadow: 0 8px 32px rgba(206,147,216,0.4);
}
.gacha-result-card.rarity-SSR {
  background: linear-gradient(135deg, #E65100, #FF6D00, #FFD600);
  border: 2px solid #FFD600;
  box-shadow: 0 8px 40px rgba(255,214,0,0.6), 0 0 80px rgba(255,109,0,0.3);
}
@keyframes gacha-card-reveal {
  0% { transform: scale(0) rotateY(180deg); opacity: 0; }
  60% { transform: scale(1.1) rotateY(0deg); opacity: 1; }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}
.gacha-rarity-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.gacha-rarity-badge.R { background: #78909C; color: #fff; }
.gacha-rarity-badge.SR { background: #CE93D8; color: #1a1a1a; }
.gacha-rarity-badge.SSR { background: #FFD600; color: #1a1a1a; }
.gacha-result-icon {
  font-size: 3.5rem;
  margin: 12px 0;
}
.gacha-result-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.gacha-result-category {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
}
.gacha-result-content {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  margin-top: 12px;
  line-height: 1.6;
  padding: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
}
.gacha-result-new {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  background: #E91E63;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  margin-top: 8px;
  animation: gacha-new-pulse 1s ease-in-out infinite;
}
@keyframes gacha-new-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.gacha-result-close {
  margin-top: 16px;
  padding: 10px 24px;
  border-radius: 20px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* Card Collection */
.gacha-collection {
  margin-top: 24px;
}
.gacha-collection-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #FFD600;
}
.gacha-collection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.gacha-card-item {
  aspect-ratio: 3/4;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gacha-card-item:hover { transform: scale(1.05); }
.gacha-card-item.collected {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
}
.gacha-card-item.collected.rarity-R { border-color: #78909C; }
.gacha-card-item.collected.rarity-SR { border-color: #CE93D8; background: rgba(206,147,216,0.1); }
.gacha-card-item.collected.rarity-SSR { border-color: #FFD600; background: rgba(255,214,0,0.1); box-shadow: 0 0 20px rgba(255,214,0,0.2); }
.gacha-card-item.uncollected {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
}
.gacha-card-item .card-name {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
  text-align: center;
  line-height: 1.2;
  padding: 0 2px;
}

/* ===== Shop Page Styles ===== */
.shop-container {
  min-height: 100vh;
  padding: 80px 16px 100px;
  background: linear-gradient(180deg, #1a0a2e 0%, #0d1b2a 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.shop-header {
  text-align: center;
  margin-bottom: 24px;
}
.shop-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.shop-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: rgba(255,214,0,0.1);
  border: 1px solid rgba(255,214,0,0.3);
  border-radius: 20px;
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #FFD600;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.shop-item:hover { transform: translateY(-2px); border-color: rgba(255,214,0,0.3); }
.shop-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(233,30,99,0.2), rgba(255,109,0,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.shop-item-info { flex: 1; }
.shop-item-name {
  font-size: 0.9rem;
  font-weight: 700;
}
.shop-item-desc {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.shop-item-owned {
  font-size: 0.65rem;
  color: #69F0AE;
  margin-top: 2px;
}
.shop-item-buy {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  color: #1a1a1a;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.shop-item-buy:active { transform: scale(0.92); }
.shop-item-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Leaderboard Page ===== */
.leaderboard-container {
  min-height: 100vh;
  padding: 80px 16px 100px;
  background: linear-gradient(180deg, #1a0a2e 0%, #0d1b2a 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.leaderboard-header {
  text-align: center;
  margin-bottom: 24px;
}
.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD600, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lb-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.lb-tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}
.lb-tab.active {
  background: linear-gradient(135deg, #E91E63, #FF6D00);
  color: #fff;
  border-color: transparent;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: all 0.3s;
}
.lb-item.me {
  background: rgba(233,30,99,0.15);
  border: 1px solid rgba(233,30,99,0.3);
}
.lb-rank {
  width: 28px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
}
.lb-rank.top1 { color: #FFD600; font-size: 1.1rem; }
.lb-rank.top2 { color: #B0BEC5; font-size: 1rem; }
.lb-rank.top3 { color: #FF8A65; font-size: 1rem; }
.lb-avatar {
  font-size: 1.3rem;
}
.lb-info { flex: 1; }
.lb-name {
  font-size: 0.85rem;
  font-weight: 700;
}
.lb-level {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
}
.lb-xp {
  font-size: 0.8rem;
  font-weight: 800;
  color: #FFD600;
}

/* ===== PK Mode Styles ===== */
.pk-arena {
  background: linear-gradient(135deg, #1a0a2e, #16213e);
  border-radius: 24px;
  padding: 20px;
  color: #fff;
  margin-bottom: 16px;
}
.pk-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.pk-player {
  text-align: center;
  flex: 1;
}
.pk-player-icon { font-size: 2.5rem; }
.pk-player-name { font-size: 0.8rem; font-weight: 700; margin-top: 4px; }
.pk-player-level { font-size: 0.65rem; color: rgba(255,255,255,0.5); }
.pk-player-hp {
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
}
.pk-player-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #69F0AE, #00E676);
  border-radius: 8px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pk-vs-text {
  font-size: 1.5rem;
  font-weight: 900;
  color: #FF5252;
  text-shadow: 0 0 20px rgba(255,82,82,0.5);
  animation: pk-vs-pulse 1s ease-in-out infinite;
}
@keyframes pk-vs-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.pk-timer {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: #FFD600;
  margin-bottom: 12px;
}
.pk-question {
  background: rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.pk-question-text {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
}
.pk-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pk-option {
  padding: 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.pk-option:hover { border-color: rgba(255,214,0,0.5); background: rgba(255,214,0,0.1); }
.pk-option.correct {
  border-color: #69F0AE;
  background: rgba(105,240,174,0.15);
  animation: pk-correct 0.5s;
}
.pk-option.wrong {
  border-color: #FF5252;
  background: rgba(255,82,82,0.15);
  animation: pk-wrong 0.5s;
}
@keyframes pk-correct {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes pk-wrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.pk-result {
  text-align: center;
  padding: 24px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
}
.pk-result-icon { font-size: 4rem; }
.pk-result-text {
  font-size: 1.2rem;
  font-weight: 900;
  margin-top: 8px;
}
.pk-result-xp {
  font-size: 0.9rem;
  color: #FFD600;
  font-weight: 700;
  margin-top: 4px;
}

/* ===== Costume Selection ===== */
.costume-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.costume-item {
  text-align: center;
  padding: 16px 8px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.costume-item:hover { transform: translateY(-2px); }
.costume-item.active {
  border-color: #FFD600;
  background: rgba(255,214,0,0.1);
  box-shadow: 0 0 20px rgba(255,214,0,0.2);
}
.costume-item.locked {
  opacity: 0.4;
  filter: grayscale(0.5);
  cursor: not-allowed;
}
.costume-icon { font-size: 2rem; }
.costume-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  margin-top: 6px;
}
.costume-unlock {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  margin-top: 2px;
}

/* ===== Study Calendar Heatmap ===== */
.calendar-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: 12px;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  transition: all 0.3s;
}
.calendar-day.studied {
  background: #69F0AE;
  box-shadow: 0 0 6px rgba(105,240,174,0.4);
}
.calendar-day.studied.level-1 { background: rgba(105,240,174,0.3); }
.calendar-day.studied.level-2 { background: rgba(105,240,174,0.5); }
.calendar-day.studied.level-3 { background: #69F0AE; }
.calendar-day.today {
  border: 2px solid #FFD600;
}
.calendar-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: 4px;
}
.calendar-label {
  text-align: center;
  font-size: 0.5rem;
  color: rgba(255,255,255,0.3);
}

/* ===== Dialogue System ===== */
.game-dialogue-overlay {
  position: fixed;
  z-index: 10004;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: dialogue-in 0.3s ease;
  transition: opacity 0.4s;
}
@keyframes dialogue-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.game-dialogue-box {
  width: 100%;
  max-width: 480px;
  background: rgba(20,20,30,0.95);
  backdrop-filter: blur(20px);
  border-top: 2px solid rgba(233,30,99,0.4);
  padding: 20px 24px 28px;
  border-radius: 24px 24px 0 0;
}
.game-dialogue-speaker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.game-dialogue-avatar {
  font-size: 1.5rem;
}
.game-dialogue-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: #E91E63;
}
.game-dialogue-text {
  font-size: 0.9rem;
  color: #fff;
  line-height: 1.7;
  min-height: 50px;
  font-weight: 500;
}
.game-dialogue-hint {
  text-align: right;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  margin-top: 12px;
  animation: dialogue-hint-blink 1.5s ease-in-out infinite;
}
@keyframes dialogue-hint-blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ===== Easter Egg Effect ===== */
.easter-egg-effect {
  position: fixed;
  z-index: 10006;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 5rem;
  animation: egg-pop 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none;
}
@keyframes egg-pop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-30deg); }
  40% { transform: translate(-50%, -50%) scale(1.5) rotate(10deg); }
  60% { transform: translate(-50%, -50%) scale(0.9) rotate(-5deg); }
  80% { transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
  100% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0; }
}

/* ===== XP Bar Costume Icon ===== */
.game-xp-bar-costume {
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-xp-bar-costume:hover { transform: scale(1.3); }

/* ===== Inventory Bar ===== */
.inventory-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.inventory-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255,214,0,0.1);
  border: 1px solid rgba(255,214,0,0.2);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFD600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.inventory-item:hover {
  background: rgba(255,214,0,0.2);
}
.inventory-item:active {
  transform: scale(0.95);
}
.inventory-count {
  background: rgba(255,255,255,0.15);
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 0.6rem;
}
