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

html,
body {
  height: 100%;
  background: #04060f;
  overflow: hidden;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #14213d 0%, transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 110%, #1a0f2e 0%, transparent 60%),
    #04060f;
}

#game-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  height: min(100vh, 150vw);
  max-height: 100vh;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(90, 200, 255, 0.25),
    0 0 45px rgba(0, 140, 255, 0.18),
    0 30px 80px rgba(0, 0, 0, 0.7);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #04060f;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 10;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(86%, 380px);
  padding: 30px 26px;
  text-align: center;
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(16, 28, 54, 0.92), rgba(10, 14, 30, 0.94));
  border: 1px solid rgba(90, 200, 255, 0.3);
  box-shadow:
    0 0 30px rgba(0, 140, 255, 0.15) inset,
    0 20px 50px rgba(0, 0, 0, 0.6);
  animation: panel-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes panel-in {
  from {
    transform: translateY(24px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.kicker {
  font-size: 11px;
  letter-spacing: 4px;
  color: #5ad0ff;
  margin-bottom: 10px;
}

.kicker.danger {
  color: #ff5a7a;
}

.title {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 10px;
  color: #eaf6ff;
  text-shadow:
    0 0 14px rgba(90, 200, 255, 0.9),
    0 0 40px rgba(0, 140, 255, 0.5);
  margin-bottom: 4px;
}

.title.danger {
  text-shadow:
    0 0 14px rgba(255, 90, 122, 0.9),
    0 0 40px rgba(255, 40, 80, 0.5);
}

.subtitle {
  font-size: 13px;
  letter-spacing: 8px;
  color: #7fa8c9;
  margin-bottom: 20px;
}

.rules {
  font-size: 13px;
  color: #b8cfe6;
  line-height: 2;
  margin-bottom: 14px;
}

.rules .key {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 2px;
  border-radius: 5px;
  background: rgba(90, 200, 255, 0.12);
  border: 1px solid rgba(90, 200, 255, 0.35);
  color: #9adcff;
  font-size: 12px;
}

.rules .tip {
  color: #6f8aa6;
  font-size: 12px;
}

.power-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
  font-size: 12px;
  color: #b8cfe6;
}

.power-legend em {
  font-style: normal;
  margin-right: 6px;
}

.pw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  margin-right: 4px;
}

.pw-w {
  color: #ffd75a;
  border: 1px solid rgba(255, 215, 90, 0.6);
  box-shadow: 0 0 10px rgba(255, 215, 90, 0.35);
}

.pw-s {
  color: #5affd0;
  border: 1px solid rgba(90, 255, 208, 0.6);
  box-shadow: 0 0 10px rgba(90, 255, 208, 0.35);
}

.pw-h {
  color: #ff8a9a;
  border: 1px solid rgba(255, 138, 154, 0.6);
  box-shadow: 0 0 10px rgba(255, 138, 154, 0.35);
}

.panel button {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #041018;
  padding: 12px 44px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #7ce4ff, #2ea6ff);
  box-shadow:
    0 0 20px rgba(90, 200, 255, 0.55),
    0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.panel button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 32px rgba(90, 200, 255, 0.8),
    0 8px 18px rgba(0, 0, 0, 0.5);
}

.panel button:active {
  transform: translateY(0) scale(0.98);
}

.best {
  margin-top: 16px;
  font-size: 12px;
  color: #6f8aa6;
  letter-spacing: 2px;
}

.best span {
  color: #ffd75a;
  font-weight: 700;
}

.panel.small h2 {
  font-size: 30px;
  letter-spacing: 8px;
  color: #eaf6ff;
  margin-bottom: 8px;
}

.panel.small .tip {
  font-size: 12px;
  color: #6f8aa6;
  margin-bottom: 20px;
}

.score-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 6px;
}

.score-board > div {
  padding: 10px 6px;
  border-radius: 10px;
  background: rgba(90, 200, 255, 0.07);
  border: 1px solid rgba(90, 200, 255, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-board .label {
  font-size: 11px;
  color: #6f8aa6;
  letter-spacing: 2px;
}

.score-board .num {
  font-size: 22px;
  font-weight: 800;
  color: #eaf6ff;
  text-shadow: 0 0 10px rgba(90, 200, 255, 0.5);
}

.new-record {
  display: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffd75a;
  text-shadow: 0 0 12px rgba(255, 215, 90, 0.7);
  margin-bottom: 6px;
  animation: record-blink 0.8s ease infinite alternate;
}

.new-record.show {
  display: block;
}

@keyframes record-blink {
  from { opacity: 0.55; }
  to { opacity: 1; }
}
