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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#app {
  width: 100%;
  height: 100vh;
  position: relative;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
}

.page.active {
  display: flex;
}

#page-start {
  background: linear-gradient(180deg, #ffecd2 0%, #fcb69f 50%, #ffecd2 100%);
}

.start-content {
  text-align: center;
  padding: 20px;
}

.start-icon {
  font-size: 80px;
  animation: bounce 1s ease-in-out infinite;
  margin-bottom: 20px;
}

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

.start-title {
  font-size: 36px;
  color: #8b4513;
  font-weight: bold;
  margin-bottom: 5px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.start-sub {
  font-size: 14px;
  color: #a0522d;
  margin-bottom: 30px;
}

.start-desc {
  background: rgba(255,255,255,0.8);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.desc-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  font-size: 16px;
  color: #333;
}

.item-emoji {
  font-size: 20px;
  margin-right: 10px;
}

.cake-text { color: #f59e0b; }
.money-text { color: #22c55e; }
.trap-text { color: #ef4444; }
.buff-text { color: #a855f7; }

.btn-start, .btn-back, .btn-restart {
  display: block;
  width: 200px;
  margin: 15px auto;
  padding: 15px 30px;
  border: none;
  border-radius: 50px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-start {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 5px 20px rgba(245,158,11,0.4);
}

.btn-start:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(245,158,11,0.6);
}

.btn-back {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.btn-back:hover {
  transform: scale(1.05);
}

.btn-restart {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 5px 20px rgba(34,197,94,0.4);
}

.btn-restart:hover {
  transform: scale(1.05);
}

#page-game {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.game-hud {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.hud-item {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 20px;
  display: flex;
  align-items: center;
}

.hud-label {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-right: 10px;
}

.hud-value {
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.hud-coin {
  color: #fbbf24;
}

.hud-emoji {
  font-size: 20px;
  margin-right: 5px;
}

.hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.combo-display {
  font-size: 32px;
  font-weight: bold;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251,191,36,0.8);
  animation: comboPop 0.3s ease-out;
}

@keyframes comboPop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.game-buffs {
  position: absolute;
  top: 80px;
  left: 20px;
  z-index: 100;
}

.buff-item {
  background: rgba(168,85,247,0.9);
  backdrop-filter: blur(10px);
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  animation: buffAppear 0.3s ease-out;
}

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

.buff-icon {
  font-size: 18px;
  margin-right: 8px;
}

.buff-time {
  color: white;
  font-weight: bold;
}

.touch-guide {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.guide-text {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.7);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
}

#page-over {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.over-content {
  text-align: center;
  padding: 20px;
}

.over-icon {
  font-size: 100px;
  margin-bottom: 20px;
  animation: shake 0.5s ease-in-out;
}

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

.over-title {
  font-size: 32px;
  color: #ef4444;
  font-weight: bold;
  margin-bottom: 5px;
}

.over-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 30px;
}

.result-panel {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
}

.result-item {
  margin-bottom: 15px;
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-label {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  margin-bottom: 5px;
}

.result-value {
  font-size: 28px;
  font-weight: bold;
}

.result-value.score { color: #3b82f6; }
.result-value.coin { color: #fbbf24; }
.result-value.cake { color: #f59e0b; }

.result-message {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 30px;
  min-height: 24px;
}

.word-item {
  position: absolute;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  color: white;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.1s;
}

.word-cake {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: 2px solid #d97706;
}

.word-money {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: 2px solid #15803d;
}

.word-trap {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 2px solid #b91c1c;
}

.word-buff {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  border: 2px solid #7e22ce;
  animation: buffGlow 1s ease-in-out infinite;
}

@keyframes buffGlow {
  0%, 100% { box-shadow: 0 4px 15px rgba(168,85,247,0.5); }
  50% { box-shadow: 0 4px 25px rgba(168,85,247,0.8); }
}

.cut-effect {
  position: absolute;
  font-size: 20px;
  pointer-events: none;
  animation: cutFloat 0.5s ease-out forwards;
}

@keyframes cutFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-50px) scale(1.5); }
}

.coin-fly {
  position: absolute;
  font-size: 24px;
  pointer-events: none;
  animation: coinFly 0.8s ease-out forwards;
}

@keyframes coinFly {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-100px) rotate(360deg); }
}

.splash-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: splash 0.4s ease-out forwards;
}

@keyframes splash {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

.line-trail {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  pointer-events: none;
  animation: trailFade 0.3s ease-out forwards;
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

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