/* ========== 全局背景 ========== */
body {
  background: #0a0a1a;
  font-family: 'Courier New', 'Noto Sans SC', monospace;
  margin: 0;
  padding: 0;
}

/* ========== 赛博标题 ========== */
.cyber-title {
  color: #00ffcc;
  text-shadow:
    0 0 10px #00ffcc,
    0 0 20px #00ffcc,
    0 0 40px #00ffcc88,
    0 0 80px #00ffcc44;
  letter-spacing: 8px;
  animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc, 0 0 40px #00ffcc88, 0 0 80px #00ffcc44; }
  50% { text-shadow: 0 0 15px #00ffcc, 0 0 30px #00ffcc, 0 0 60px #00ffccaa, 0 0 100px #00ffcc66; }
}

/* ========== 功德箱主体 ========== */
.merit-box-wrapper {
  position: relative;
  perspective: 800px;
}

.merit-box-glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(ellipse at center, #ffcc0033 0%, transparent 70%);
  border-radius: 30px;
  animation: boxGlow 3s ease-in-out infinite;
  z-index: -1;
}

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

.merit-box {
  width: 320px;
  background: linear-gradient(180deg, #1a1a3e 0%, #0d0d2b 50%, #1a1a3e 100%);
  border: 2px solid #ffcc00;
  border-radius: 16px;
  padding: 0;
  box-shadow:
    0 0 20px #ffcc0044,
    0 0 60px #ffcc0022,
    inset 0 0 30px #00000088;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.merit-box.shake {
  animation: boxShake 0.4s ease;
}

@keyframes boxShake {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-6px) rotate(-1deg); }
  40% { transform: translateY(4px) rotate(1deg); }
  60% { transform: translateY(-3px) rotate(-0.5deg); }
  80% { transform: translateY(2px); }
}

/* ========== 顶部装饰 ========== */
.box-top {
  position: relative;
  background: linear-gradient(180deg, #2a1a00, #1a1000);
  padding: 16px 20px 12px;
  text-align: center;
  border-bottom: 1px solid #ffcc0066;
}

.box-top-light {
  position: absolute;
  top: 6px;
  right: 16px;
  width: 8px;
  height: 8px;
  background: #00ff88;
  border-radius: 50%;
  box-shadow: 0 0 6px #00ff88, 0 0 12px #00ff88;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.box-top-text {
  color: #ffcc00;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 12px;
  text-shadow: 0 0 10px #ffcc00, 0 0 20px #ffcc0088;
}

.box-top-scanner {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffcc00, transparent);
  animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ========== 投币口 ========== */
.coin-slot {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 14px 0;
  background: linear-gradient(180deg, #0d0d2b, #111133);
}

.coin-slot-inner {
  width: 120px;
  height: 10px;
  background: #000;
  border: 2px solid #ffcc00;
  border-radius: 6px;
  box-shadow: inset 0 0 8px #ffcc0044, 0 0 10px #ffcc0033;
}

.coin-slot-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 30px;
  background: radial-gradient(ellipse, #ffcc0022 0%, transparent 70%);
  pointer-events: none;
}

/* ========== 显示屏 ========== */
.display-screen {
  position: relative;
  margin: 12px 20px;
  background: #001100;
  border: 2px solid #00ff8855;
  border-radius: 8px;
  padding: 20px 16px;
  overflow: hidden;
  box-shadow: inset 0 0 20px #00ff8822, 0 0 10px #00ff8822;
}

.screen-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(180deg, #00ff8833, transparent);
  animation: screenScan 3s linear infinite;
  pointer-events: none;
}

@keyframes screenScan {
  0% { top: -4px; }
  100% { top: 100%; }
}

.screen-content {
  text-align: center;
  position: relative;
  z-index: 2;
}

.merit-label {
  color: #00ff88;
  font-size: 14px;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 0 6px #00ff88;
}

.merit-count {
  color: #ffcc00;
  font-size: 56px;
  font-weight: bold;
  line-height: 1;
  text-shadow:
    0 0 10px #ffcc00,
    0 0 20px #ffcc00,
    0 0 40px #ffcc0088;
  transition: transform 0.15s ease;
  font-family: 'Courier New', monospace;
}

.merit-count.pop {
  animation: countPop 0.3s ease;
}

@keyframes countPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.merit-sub {
  color: #00ff8888;
  font-size: 10px;
  letter-spacing: 6px;
  margin-top: 8px;
}

.screen-flicker {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    #00000015 2px,
    #00000015 4px
  );
  pointer-events: none;
  z-index: 3;
}

/* ========== 底部LED ========== */
.box-bottom {
  padding: 12px 20px 16px;
  background: linear-gradient(180deg, #111133, #0d0d2b);
  border-top: 1px solid #ffcc0033;
}

.led-strip {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffcc00;
  box-shadow: 0 0 4px #ffcc00, 0 0 8px #ffcc00;
  animation: ledBlink 1s infinite;
}

.led:nth-child(2n) { animation-delay: 0.15s; }
.led:nth-child(3n) { animation-delay: 0.3s; }
.led:nth-child(4n) { animation-delay: 0.45s; }

@keyframes ledBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px #ffcc00, 0 0 8px #ffcc00; }
  50% { opacity: 0.4; box-shadow: 0 0 2px #ffcc0066; }
}

.circuit-lines {
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #ffcc0022 0px,
    #ffcc0022 8px,
    transparent 8px,
    transparent 12px
  );
  border-radius: 2px;
}

/* ========== 功德按钮 ========== */
.merit-btn {
  position: relative;
  padding: 18px 48px;
  font-size: 22px;
  font-weight: bold;
  color: #ffcc00;
  background: linear-gradient(180deg, #2a1a00, #1a0d00);
  border: 2px solid #ffcc00;
  border-radius: 60px;
  cursor: pointer;
  outline: none;
  overflow: hidden;
  transition: all 0.2s ease;
  text-shadow: 0 0 8px #ffcc00;
  box-shadow:
    0 0 20px #ffcc0044,
    0 0 40px #ffcc0022,
    inset 0 0 20px #ffcc0011;
  font-family: 'Courier New', 'Noto Sans SC', monospace;
}

.merit-btn:hover {
  background: linear-gradient(180deg, #3a2a00, #2a1a00);
  box-shadow:
    0 0 30px #ffcc0066,
    0 0 60px #ffcc0033,
    inset 0 0 30px #ffcc0022;
  transform: translateY(-2px);
}

.merit-btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow:
    0 0 15px #ffcc0044,
    0 0 30px #ffcc0022;
}

.btn-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, #ffcc0022 0%, transparent 60%);
  animation: btnGlow 2s ease-in-out infinite;
  pointer-events: none;
}

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

.btn-text {
  position: relative;
  z-index: 2;
}

.btn-ring {
  position: absolute;
  inset: -4px;
  border: 2px solid #ffcc0044;
  border-radius: 60px;
  animation: ringPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.08); opacity: 0; }
}

/* ========== 功德语录 ========== */
.merit-quote {
  color: #00ffcc88;
  font-size: 14px;
  letter-spacing: 2px;
  min-height: 24px;
  transition: opacity 0.3s ease;
  text-shadow: 0 0 6px #00ffcc44;
}

/* ========== 飘字 +1 ========== */
.float-text {
  position: absolute;
  color: #ffcc00;
  font-size: 28px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 10px #ffcc00, 0 0 20px #ffcc00;
  animation: floatUp 1.2s ease-out forwards;
  z-index: 20;
  font-family: 'Courier New', monospace;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  60% {
    opacity: 1;
    transform: translateY(-80px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-140px) scale(0.8);
  }
}

/* ========== 金光粒子 ========== */
.spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffcc00;
  box-shadow: 0 0 6px #ffcc00, 0 0 12px #ffcc00;
  pointer-events: none;
  animation: sparkFly 0.8s ease-out forwards;
}

@keyframes sparkFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

/* ========== 金光爆发 ========== */
.golden-burst {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffcc0066 0%, #ffcc0022 30%, transparent 70%);
  pointer-events: none;
  animation: burstAnim 0.6s ease-out forwards;
  z-index: 15;
}

@keyframes burstAnim {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* ========== 屏幕闪光 ========== */
.screen-flash {
  position: absolute;
  inset: 0;
  background: #ffcc0044;
  pointer-events: none;
  animation: flashAnim 0.3s ease-out forwards;
  z-index: 5;
  border-radius: 6px;
}

@keyframes flashAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========== 光线射线 ========== */
.light-ray {
  position: absolute;
  width: 2px;
  height: 80px;
  background: linear-gradient(180deg, #ffcc00, transparent);
  pointer-events: none;
  transform-origin: bottom center;
  animation: rayShoot 0.6s ease-out forwards;
  z-index: 15;
}

@keyframes rayShoot {
  0% {
    opacity: 1;
    transform: rotate(var(--angle)) scaleY(0);
  }
  50% {
    opacity: 1;
    transform: rotate(var(--angle)) scaleY(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) scaleY(1.5);
  }
}

/* ========== 响应式 ========== */
@media (max-width: 400px) {
  .merit-box {
    width: 280px;
  }
  .merit-count {
    font-size: 42px;
  }
  .cyber-title {
    font-size: 24px;
    letter-spacing: 4px;
  }
  .merit-btn {
    padding: 14px 36px;
    font-size: 18px;
  }
}
