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

html,
body {
  width: 100%;
  height: 100%;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

/* 背景动画 */
body {
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.floating-food {
  position: absolute;
  font-size: 2rem;
  animation: float 15s infinite ease-in-out;
  opacity: 0.3;
}

.floating-food:nth-child(1) {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}
.floating-food:nth-child(2) {
  top: 60%;
  left: 80%;
  animation-delay: 2s;
}
.floating-food:nth-child(3) {
  top: 80%;
  left: 20%;
  animation-delay: 4s;
}
.floating-food:nth-child(4) {
  top: 40%;
  left: 70%;
  animation-delay: 6s;
}
.floating-food:nth-child(5) {
  top: 10%;
  left: 50%;
  animation-delay: 8s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(10deg);
  }
  50% {
    transform: translateY(10px) rotate(-10deg);
  }
  75% {
    transform: translateY(-10px) rotate(5deg);
  }
}

/* 主容器 */
#main {
  width: 90%;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  z-index: 10;
  position: relative;
}

/* 标题区域 */
.header-container {
  margin-bottom: 2rem;
  animation: fadeInDown 0.8s ease-out;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  color: #ff6b6b;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
}

.subtitle {
  font-size: 1.2rem;
  color: #ff6b6ba0;
  font-weight: 400;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.3s forwards;
}

/* 老虎机容器 */
#slot-machine {
  animation: fadeIn 1s ease-out 0.5s both;
}

.machine-frame {
  background: #ffffff;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: visible;
}

/* 装饰灯光 */
.machine-lights {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 100%;
  width: 90%;
}

.light {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffeb3b, #ffc107);
  box-shadow: 0 0 20px #ffc107;
  animation: pulse 2s infinite;
}

.light.celebrating {
  animation: celebrate 0.5s infinite alternate;
}

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

@keyframes celebrate {
  0% {
    background: radial-gradient(circle, #ffeb3b, #ffc107);
    transform: scale(1);
  }
  100% {
    background: radial-gradient(circle, #ff5252, #ff1744);
    transform: scale(1.3);
  }
}

/* 老虎机槽位 */
#slots-container {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  min-height: 200px;
  align-items: center;
}

.slot {
  flex: 1;
  max-width: 180px;
  height: 200px;
  background: linear-gradient(145deg, #2c3e50, #34495e);
  border-radius: 15px;
  padding: 10px;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  border: 3px solid #34495e;
}

.slot-inner {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.slot img {
  width: 100%;
  height: 75%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.slot .food-name {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
}

/* 旋转动画 */
.slot.spinning .slot-inner {
  animation: slot-spin 0.1s linear infinite;
}

.slot.spinning .slot-inner img {
  filter: blur(2px);
}

.slot.spinning .slot-inner .food-name {
  opacity: 0.3;
  filter: blur(1px);
}

@keyframes slot-spin {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-5px);
  }
}

/* 停止动画 */
.slot .slot-inner.stopping {
  animation: slot-stop 0.3s ease-out;
}

@keyframes slot-stop {
  0% {
    transform: translateY(-10px) scale(0.95);
  }
  50% {
    transform: translateY(5px) scale(1.05);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* 最终结果动画 */
.slot .slot-inner.final {
  animation: slot-final 0.5s ease-out;
}

@keyframes slot-final {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* 控制按钮 */
.controls {
  display: flex;
  justify-content: center;
}

.spin-button {
  background: #ff6b6b;
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.3rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  font-family: inherit;
}

.spin-button:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.spin-button:active:not(.disabled) {
  transform: translateY(0);
}

.spin-button.disabled {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: 0.7;
}

.button-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spin-button:hover .button-glow {
  opacity: 1;
  animation: button-glow 2s infinite;
}

@keyframes button-glow {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.1) rotate(180deg);
  }
}

/* 结果显示 */
.result-display {
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.result-display.show {
  opacity: 1;
  transform: translateY(0);
}

.result-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem 2rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.result-content h2 {
  font-size: 1.8rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.result-content p {
  font-size: 1.1rem;
  color: #7f8c8d;
  font-weight: 400;
}

/* 动画效果 */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  #main {
    width: 95%;
    padding: 0 1rem;
  }

  .machine-frame {
    padding: 1.5rem;
  }

  #slots-container {
    gap: 1rem;
    min-height: 160px;
  }

  .slot {
    max-width: 140px;
    height: 160px;
  }

  .spin-button {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
  }

  .result-content {
    padding: 1rem 1.5rem;
  }

  .result-content h2 {
    font-size: 1.5rem;
  }

  .machine-lights {
    gap: 80%;
  }
}

@media (max-width: 480px) {
  .header-container {
    margin-bottom: 1.5rem;
  }

  h1 {
    font-size: 2rem;
    margin-bottom: 0.3rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .machine-frame {
    padding: 1rem;
  }

  #slots-container {
    gap: 0.8rem;
    min-height: 140px;
  }

  .slot {
    max-width: 100px;
    height: 140px;
    padding: 6px;
  }

  .slot .food-name {
    font-size: 0.9rem;
    padding: 4px 2px;
  }

  .spin-button {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
  }

  .result-content h2 {
    font-size: 1.3rem;
  }

  .result-content p {
    font-size: 1rem;
  }

  .floating-food {
    font-size: 1.5rem;
  }
}

@media (max-width: 360px) {
  #slots-container {
    gap: 0.5rem;
  }

  .slot {
    max-width: 90px;
    height: 120px;
  }

  .spin-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 粒子效果容器 */
#particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.particle {
  position: absolute;
  font-size: 20px;
  animation: particle-float var(--lifetime, 1500ms) ease-out forwards;
  pointer-events: none;
  z-index: 1001;
  will-change: transform, opacity;
}

@keyframes particle-float {
  0% {
    transform: translate(0, 0) scale(0) rotate(0deg);
    opacity: 1;
  }
  20% {
    transform: translate(calc(var(--tx, 0) * 0.2), calc(var(--ty, 0) * 0.2 - 10px)) scale(1.2)
      rotate(72deg);
    opacity: 1;
  }
  50% {
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(1) rotate(180deg);
    opacity: 1;
  }
  80% {
    transform: translate(calc(var(--tx, 0) * 1.2), calc(var(--ty, 0) * 1.2 + 30px)) scale(0.8)
      rotate(252deg);
    opacity: 0.5;
  }
  100% {
    transform: translate(calc(var(--tx, 0) * 1.5), calc(var(--ty, 0) * 1.5 + 80px)) scale(0.3)
      rotate(360deg);
    opacity: 0;
  }
}

/* 额外的动画效果 */
.slot:hover {
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

.spin-button:not(.disabled):hover {
  animation: button-pulse 1s infinite;
}

@keyframes button-pulse {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
  }
}
