* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #1B2233; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  user-select: none; -webkit-user-select: none;
}
.stage {
  position: fixed; inset: 0; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #2C3A57 0%, #1B2233 60%, #141A27 100%);
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; z-index: 5;
}
.hud-left { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(160deg, #FFB067, #FF8A3D);
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff; overflow: hidden;
  pointer-events: auto; cursor: pointer;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hud-meta { display: flex; flex-direction: column; gap: 5px; }
.nick { font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.hpbar {
  width: 108px; height: 9px; border-radius: 99px; overflow: hidden;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35);
}
.hpbar i { display: block; height: 100%; width: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #FF8A3D, #FFD166); transition: width .18s ease; }
.hud-right { display: flex; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: 99px;
  background: rgba(20,26,39,.55); border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px); font-size: 13px; font-weight: 700;
}
.chip .mp-icon { width: 15px; height: 15px; color: #FFC46B; }

/* ---------- 通用 ---------- */
.screen {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(20,26,39,.55) 0%, rgba(20,26,39,.9) 55%, #141A27 100%);
  backdrop-filter: blur(3px);
}
.hidden { display: none !important; }

.hero { text-align: center; padding: 6px 0 14px; }
.hero-badge {
  display: inline-block; font-size: 11px; letter-spacing: .12em; font-weight: 700;
  color: #FFD9B8; background: rgba(255,138,61,.18);
  border: 1px solid rgba(255,138,61,.5); border-radius: 99px; padding: 4px 12px;
}
.hero-title {
  margin: 10px 0 6px; font-size: 30px; font-weight: 900; letter-spacing: .02em;
  background: linear-gradient(180deg, #FFF3E4 20%, #FFB067 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 6px 18px rgba(255,138,61,.35);
}
.hero-sub { margin: 0; font-size: 12.5px; line-height: 1.7; color: rgba(255,255,255,.62); }

.mode-list { display: flex; flex-direction: column; gap: 10px; }
.mode-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: #fff; font-family: inherit; transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.mode-card:active { transform: scale(.975); }
.mode-card .mp-icon {
  width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 12px; background: rgba(255,255,255,.1); color: #FFC46B;
  -webkit-mask-size: 22px 22px; mask-size: 22px 22px;
}
.mode-card.active {
  background: linear-gradient(135deg, rgba(255,138,61,.28), rgba(255,138,61,.1));
  border-color: rgba(255,138,61,.75);
  box-shadow: 0 8px 22px rgba(255,138,61,.22);
}
.mode-card.active .mp-icon { background: #FF8A3D; color: #fff; }
.mode-txt { display: flex; flex-direction: column; gap: 3px; }
.mode-txt b { font-size: 15px; font-weight: 800; }
.mode-txt span { font-size: 11.5px; color: rgba(255,255,255,.6); }

.role-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 4px;
  scrollbar-width: none;
}
.role-strip::-webkit-scrollbar { display: none; }
.role {
  flex: 0 0 auto; width: 62px; padding: 8px 4px 7px; border-radius: 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: #fff; font-family: inherit; cursor: pointer; transition: transform .12s ease;
}
.role:active { transform: scale(.95); }
.role.on { border-color: #FF8A3D; background: rgba(255,138,61,.22); box-shadow: 0 6px 16px rgba(255,138,61,.2); }
.role-face {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
}
.role-name { font-size: 10.5px; font-weight: 700; white-space: nowrap; }

.play-btn {
  margin-top: 16px; width: 100%; height: 52px; border: 0; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 17px; font-weight: 800; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #FFA45C, #FF8A3D 55%, #F06E1E);
  box-shadow: 0 10px 24px rgba(255,138,61,.4), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .12s ease, box-shadow .12s ease;
}
.play-btn:active { transform: translateY(2px) scale(.985); box-shadow: 0 4px 12px rgba(255,138,61,.35); }
.play-btn .mp-icon { width: 20px; height: 20px; }
.start-foot { margin-top: 10px; text-align: center; font-size: 11.5px; color: rgba(255,255,255,.45); }

/* ---------- 结算 ---------- */
#overScreen { justify-content: center; }
.over-card {
  border-radius: 22px; padding: 22px 18px 18px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.over-title { font-size: 17px; font-weight: 800; color: #FFD9B8; }
.over-score { margin: 8px 0 16px; font-size: 46px; font-weight: 900; line-height: 1;
  background: linear-gradient(180deg, #FFF3E4, #FFB067); -webkit-background-clip: text; background-clip: text; color: transparent; }
.over-score em { font-size: 15px; font-style: normal; margin-left: 4px; color: rgba(255,255,255,.6); -webkit-text-fill-color: rgba(255,255,255,.6); }
.over-stats { display: flex; gap: 8px; margin-bottom: 18px; }
.over-stats > div {
  flex: 1; padding: 10px 4px; border-radius: 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  display: flex; flex-direction: column; gap: 3px;
}
.over-stats b { font-size: 16px; font-weight: 800; color: #FFC46B; }
.over-stats span { font-size: 10.5px; color: rgba(255,255,255,.55); }
.ghost-btn {
  margin-top: 10px; width: 100%; height: 46px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.8); font-family: inherit; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ghost-btn:active { background: rgba(255,255,255,.14); }
.ghost-btn .mp-icon { width: 17px; height: 17px; }

/* ---------- 昵称弹层 ---------- */
.sheet { position: absolute; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(10,14,22,.72); backdrop-filter: blur(4px); }
.sheet-card {
  width: 100%; max-width: 340px; border-radius: 20px; padding: 20px 18px;
  background: #202A3E; border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.sheet-title { font-size: 16px; font-weight: 800; margin-bottom: 12px; text-align: center; }
#nameInput {
  width: 100%; height: 46px; border-radius: 13px; padding: 0 14px; font-size: 15px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff;
  font-family: inherit; outline: none;
}
#nameInput:focus { border-color: #FF8A3D; }
