html, body {
  margin: 0;
  padding: 0;
  background: #0b0b10;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0b10;
  overflow: hidden;
}

canvas {
  width: 100vw;
  height: 100vh;
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0b0b10;
  cursor: none;
}

canvas.blurred {
  filter: blur(4px) saturate(0.6) brightness(0.7);
  transition: filter 0.2s ease-out;
}

#deathOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
  gap: 12px;
  animation: deathFadeIn 0.25s ease-out;
}

@keyframes deathFadeIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.death-clock-wrap {
  width: 58px;
  height: 58px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.death-clock-face {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #e8c94a;
  background: rgba(14, 14, 22, 0.9);
  box-shadow: 0 0 20px rgba(232, 201, 74, 0.45), 0 4px 16px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.9);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.death-clock-ticks {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  animation: deathTicksSpin 2.5s linear infinite reverse;
}

.death-clock-hand {
  position: absolute;
  top: 6px;
  left: 22px;
  width: 4px;
  height: 18px;
  background: #e8c94a;
  border-radius: 2px;
  transform-origin: 2px 18px;
  animation: deathRewind 0.45s linear infinite;
  box-shadow: 0 0 8px #e8c94a;
}

.death-clock-center {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 6px #fff;
}

@keyframes deathRewind {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes deathTicksSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#deathCauseText {
  color: #ff4757;
  font-size: min(5vw, 24px);
  font-weight: 800;
  font-family: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.15em;
  text-shadow: 0 3px 0 #8b0018, 0 6px 16px rgba(0, 0, 0, 0.9), 0 0 14px rgba(255, 71, 87, 0.6);
}

#deathSubText {
  color: #f1c40f;
  font-size: min(3.2vw, 13px);
  font-family: monospace;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1a1a24 0%, #0b0b10 75%);
  z-index: 10;
  gap: 14px;
}

#title {
  font-family: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e8c94a;
  font-size: min(11vw, 72px);
  letter-spacing: .12em;
  text-shadow: 0 4px 0 #9c2430, 0 8px 14px rgba(0, 0, 0, .7);
}

#sub {
  color: #8a8a96;
  font-size: min(3.4vw, 15px);
  letter-spacing: .35em;
  font-family: monospace;
}

#help {
  color: #b9b9c4;
  font-size: min(3vw, 13px);
  line-height: 1.9;
  text-align: center;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

#help b {
  color: #e8c94a;
  font-weight: 600;
}

#btnGroup, .pause-btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  width: 100%;
  max-width: 260px;
}

.menu-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 24px;
  font-size: min(4.2vw, 18px);
  letter-spacing: .2em;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: transform .08s, background .2s, box-shadow .2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-radius: 3px;
}

.primary-btn {
  background: #9c2430;
  border-bottom: 4px solid #5e1219;
}
.primary-btn:hover {
  transform: translateY(-2px);
  background: #b52b3a;
  box-shadow: 0 6px 16px rgba(181, 43, 58, 0.4);
}
.primary-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.secondary-btn {
  background: #222232;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 4px solid #14141e;
}
.secondary-btn:hover {
  transform: translateY(-2px);
  background: #323246;
  border-color: rgba(232, 201, 74, 0.4);
}
.secondary-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

#pauseOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  gap: 12px;
  background: rgba(14, 14, 22, 0.94);
  border: 1.5px solid rgba(232, 201, 74, 0.45);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(0, 0, 0, 0.8);
  padding: 24px 36px;
  border-radius: 8px;
  animation: deathFadeIn 0.2s ease-out;
}

#pauseTitle {
  color: #e8c94a;
  font-size: min(5vw, 22px);
  font-weight: 800;
  font-family: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.15em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

#pauseSub {
  color: #8a8a9a;
  font-size: min(3vw, 12px);
  font-family: monospace;
  letter-spacing: 0.08em;
}

#bgmBtn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(22, 22, 34, 0.85);
  border: 1.5px solid rgba(232, 201, 74, 0.6);
  color: #e8c94a;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s, background 0.2s, border-color 0.2s;
}

#bgmBtn:hover {
  transform: scale(1.1);
  background: rgba(36, 36, 56, 0.95);
  border-color: #e8c94a;
}

#bgmBtn:active {
  transform: scale(0.95);
}

#bgmBtn.muted {
  filter: grayscale(0.8);
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.3);
}

#pauseBtn {
  position: fixed;
  top: 14px;
  right: 58px;
  z-index: 30;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(22, 22, 34, 0.85);
  border: 1.5px solid rgba(232, 201, 74, 0.6);
  color: #e8c94a;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s, background 0.2s, border-color 0.2s;
}

#pauseBtn:hover {
  transform: scale(1.1);
  background: rgba(36, 36, 56, 0.95);
  border-color: #e8c94a;
}

#pauseBtn:active {
  transform: scale(0.95);
}

.hidden {
  display: none !important;
}
