/* ===== 全局基础 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-1: #0f1226;
  --bg-2: #1a1f3c;
  --accent: #8a2be2;
  --accent-2: #ff4d6d;
  --good: #2ecc71;
  --warn: #f1c40f;
  --bad: #e74c3c;
  --text: #e8eaf6;
  --muted: #9aa0a6;
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 10%, #241b4d 0%, var(--bg-1) 45%, #07091a 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 游戏外壳 ===== */
.game-shell {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== 顶部信息栏 ===== */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(138,43,226,.18), rgba(255,77,109,.12));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px 18px;
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1px;
}

.brand-logo {
  font-size: 24px;
  filter: drop-shadow(0 0 6px var(--accent));
}

.brand-name {
  background: linear-gradient(90deg, #b388ff, #ff80ab);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.hp-stat {
  align-items: flex-start;
  min-width: 160px;
}

.hp-bar {
  width: 160px;
  height: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid rgba(255,255,255,.15);
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--good), #aef359);
  transition: width .25s ease, background .25s ease;
}

/* ===== 游戏舞台 ===== */
.stage {
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 420px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 120%, rgba(138,43,226,.25), transparent 60%),
    linear-gradient(180deg, #11142e, #0a0c1d);
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,.6);
}

.stage-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 18px;
  text-align: center;
  pointer-events: none;
  transition: opacity .3s;
}

.float-layer {
  position: absolute;
  inset: 0;
}

/* ===== 怪物 ===== */
.monster {
  position: absolute;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  user-select: none;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.25), rgba(255,77,109,.35));
  box-shadow: 0 0 18px rgba(255,77,109,.6);
  transition: transform .12s ease;
  animation: spawn .3s ease;
}

.monster:hover {
  transform: scale(1.08);
}

.monster.boss {
  width: 96px;
  height: 96px;
  font-size: 64px;
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.3), rgba(241,196,15,.4));
  box-shadow: 0 0 28px rgba(241,196,15,.8);
}

.monster .hp-mini {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 6px;
  border-radius: 4px;
  background: rgba(0,0,0,.5);
  overflow: hidden;
}

.monster .hp-mini > div {
  height: 100%;
  background: var(--good);
  transition: width .15s;
}

@keyframes spawn {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.monster.hit {
  animation: hit .2s ease;
}

@keyframes hit {
  0% { transform: scale(1.25); filter: brightness(2); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* ===== 飘字 ===== */
.float-text {
  position: absolute;
  font-weight: 800;
  font-size: 22px;
  pointer-events: none;
  animation: floatUp .9s ease forwards;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}

@keyframes floatUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

/* ===== 底部操作栏 ===== */
.bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px 16px;
}

.btn {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255,255,255,.14);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), #b64bff);
  border: none;
  box-shadow: 0 6px 18px rgba(138,43,226,.4);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(138,43,226,.55);
}

.btn-lg {
  padding: 14px 36px;
  font-size: 18px;
}

.difficulty {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-label {
  color: var(--muted);
  font-size: 14px;
  margin-right: 4px;
}

.diff-btn {
  border: 1px solid rgba(255,255,255,.2);
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}

.diff-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== 遮罩层 ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,7,20,.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity .3s;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: min(90%, 460px);
  background: linear-gradient(160deg, #1c2142, #11142e);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 36px 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.overlay-title {
  font-size: 34px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #b388ff, #ff80ab);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay-desc {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 18px;
  font-size: 15px;
}

.overlay-rank {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--warn);
  min-height: 22px;
}

.overlay-tip {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ===== 屏幕震动 ===== */
.stage.shake {
  animation: shake .3s;
}

@keyframes shake {
  0%,100% { transform: translate(0,0); }
  25% { transform: translate(-6px, 4px); }
  50% { transform: translate(5px, -5px); }
  75% { transform: translate(-4px, -3px); }
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .top-bar { justify-content: center; }
  .stats { justify-content: center; }
  .brand { width: 100%; justify-content: center; }
  .stage { height: 56vh; min-height: 340px; }
  .difficulty { margin-left: 0; width: 100%; justify-content: center; }
}
