/* slapkirk zh chrome */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #4f86c6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

.page-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}

.page-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.game-shell {
  position: relative;
  flex: 1;
  width: min(100%, 520px);
  max-height: 62vh;
  border-radius: 14px;
  overflow: hidden;
  background: #16365f;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

#game-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
}

#animationFrame,
#animationAlertFrame {
  position: absolute;
  inset: 0;
  contain: strict;
}

#animationFrame {
  will-change: contents;
}

.animationCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  pointer-events: none;
}

#animationAlertFrame {
  background: rgba(255, 60, 60, 0.35);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

.animationImage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.hidden { display: none !important; }

.overlay {
  position: absolute;
  z-index: 10;
}

#scoreBox {
  top: 8px;
  right: 10px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

#highScoreBox {
  top: 36px;
  right: 10px;
  font-size: 11px;
  color: #ffe08a;
}

#controls {
  top: 8px;
  left: 8px;
}

#music {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

#music svg { width: 18px; height: 18px; }

#noMusicRemove {
  position: absolute;
  color: #ff6b6b;
}

.page-desc {
  margin: 14px 0 0;
  width: min(100%, 520px);
  text-align: center;
  font-size: clamp(0.82rem, 3.4vw, 0.95rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.page-source {
  margin: 8px 0 0;
  font: 500 11px/1.4 "PingFang SC", "Microsoft YaHei", sans-serif;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.page-source-link {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: underline;
  cursor: default;
}

@media (max-width: 640px) {
  .page-source {
    font-size: 9px;
    transform: scale(0.9);
    transform-origin: center bottom;
  }
}

#preloader {
  position: fixed;
  inset: 0;
  background: #4f86c6;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

#status {
  font-size: 2rem;
}

#full-meter,
#mini-meter {
  width: min(70%, 280px);
  height: 10px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

#mini-meter {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 80px;
  z-index: 20;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffd76a, #fff2b2);
  transition: width 0.2s ease;
}

#mobileInfoContainer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding:
    max(16px, env(safe-area-inset-top, 0px) + 8px)
    16px
    max(16px, env(safe-area-inset-bottom, 0px) + 8px);
  box-sizing: border-box;
}

.mobile-intro.is-visible {
  display: flex;
}

#mobileInfo {
  width: min(88%, 320px);
  padding: 20px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #222;
  text-align: center;
  line-height: 1.6;
  font-size: 15px;
}

#mobileInfoSound {
  margin: 10px 0 0;
  font-size: 13px;
  color: #666;
}

#mobileInfoCloseButton {
  display: inline-block;
  margin: 18px 0 0;
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  background: #000;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.pulse { animation: pulse 1s linear infinite; }

@keyframes pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.35; }
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeout {
  from { opacity: 1; }
  to { opacity: 0; }
}

.fadein { animation: fadein 0.6s both; }
.fadeout { animation: fadeout 0.6s both; }

.animated.bounce { animation: bounce 0.8s; }

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