* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #101024; touch-action: none; overscroll-behavior: none; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #fff; user-select: none; }

/* 游戏舞台:竖屏时整体旋转 90°,横版画面竖着玩 */
#stage { position: fixed; inset: 0; overflow: hidden; }
body.portrait #stage {
  top: 0; left: 100vw; right: auto; bottom: auto;
  width: 100vh; height: 100vw;
  transform: rotate(90deg); transform-origin: 0 0;
}
#stage > * { position: fixed; }

#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#btnFull.off { display: none; }

.layer {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 30, .82); backdrop-filter: blur(6px); z-index: 30;
}
.layer.translucent { background: rgba(10, 10, 30, .35); backdrop-filter: none; pointer-events: none; transition: opacity .5s; }
.hidden { display: none !important; }

.card { text-align: center; padding: 28px 34px; border-radius: 20px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }
.introCard { position: relative; pointer-events: auto; background: rgba(16,16,40,.85); border-color: rgba(255,255,255,.2); }
#introClose {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; padding: 0; margin: 0;
  border-radius: 50%; font-size: 18px; line-height: 1; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
}
.introNo { color: #ffd76a; font-size: 13px; letter-spacing: 4px; margin-bottom: 4px; }
.introHint { color: #b9c1e8; font-size: 14px; margin-top: 10px; max-width: 420px; line-height: 1.7; }
.logo { font-size: 42px; }
h1 { font-size: 26px; margin: 6px 0 2px; }
h2 { font-size: 24px; margin-bottom: 8px; }
.slogan { color: #9aa3c7; font-size: 14px; margin-bottom: 18px; }
.big { font-size: 30px; }

button {
  border: none; border-radius: 14px; padding: 12px 22px; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, #ff7a59, #ff4d6d); cursor: pointer; width: 100%; margin-top: 4px;
}
button:active { transform: scale(.96); }
.joinRow { display: flex; gap: 10px; margin-top: 12px; }
.joinRow input {
  flex: 1; width: 60px; text-align: center; font-size: 20px; letter-spacing: 6px; text-transform: uppercase;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; padding: 10px;
}
.joinRow button { width: auto; margin-top: 0; background: linear-gradient(135deg, #4d8dff, #6a5cff); }
.tip { font-size: 13px; color: #8a92b8; margin-top: 14px; line-height: 1.7; }
.err { color: #ff6b81; font-size: 13px; margin-top: 10px; min-height: 16px; }
.bigCode { font-size: 56px; font-weight: 800; letter-spacing: 14px; color: #ffd76a; text-indent: 14px; margin: 8px 0; }

#btnBgm.off { opacity: .45; }

/* 注册 / 选角 / 交换弹窗 */
#reg input, .charRow { margin-top: 10px; }
#reg input {
  width: 100%; text-align: center; font-size: 16px; letter-spacing: 1px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; padding: 11px;
}
.charRow { display: flex; gap: 12px; }
.charCard {
  flex: 1; padding: 14px 8px; border-radius: 16px; background: rgba(255,255,255,.07);
  border: 2px solid rgba(255,255,255,.2); text-align: center; cursor: pointer;
}
.charCard.taken { opacity: .35; border-style: dashed; }
.charCard.mine { border-color: #ffd76a; background: rgba(255,215,106,.12); }
.charFace { width: 52px; height: 52px; margin: 0 auto 6px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.charName { font-size: 16px; font-weight: 700; }
.charTip { font-size: 11px; color: #9aa3c7; margin-top: 4px; line-height: 1.6; }
.btnRow { display: flex; gap: 10px; margin-top: 14px; }
.btnRow button { margin-top: 0; }
#swapText { white-space: pre-line; line-height: 1.8; }

/* 提示气泡 */
#toast {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  z-index: 45; padding: 10px 18px; border-radius: 12px; font-size: 14px; line-height: 1.7;
  background: rgba(0,0,0,.75); border: 1px solid rgba(255,215,106,.4); color: #ffd76a;
  text-align: center; max-width: 86%; pointer-events: auto;
  transition: opacity .4s; white-space: pre-line;
}

/* 关卡选择面板 */
.levelsCard { max-width: 640px; width: min(92vw, 640px); max-height: 88vh; overflow-y: auto; }
#levelGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 14px; }
.lvBtn { padding: 10px 4px; font-size: 12px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvBtn:active { transform: scale(.95); }
.lvBtn.locked { background: rgba(255,255,255,.03); color: #5a6284; border-color: rgba(255,255,255,.08); }
@media (max-width: 560px) { #levelGrid { grid-template-columns: repeat(3, 1fr); } }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 14px; pointer-events: none; }
#roleBadge { font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.2); }
#roleBadge.a { color: #ffb38a; border-color: #ff7a5988; }
#roleBadge.b { color: #9ac8ff; border-color: #4d8dff88; }
#levelLabel { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.35); color: #ffd76a; }
#hudBtns { display: flex; gap: 8px; }
#hudBtns button { pointer-events: auto; width: auto; margin: 0; padding: 6px 12px; font-size: 12px; border-radius: 999px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.25); }

/* 虚拟按键 */
#controls { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.padL { position: absolute; left: 18px; bottom: 20px; display: flex; gap: 14px; }
.key {
  pointer-events: auto; display: flex; align-items: center; justify-content: center;
  width: 74px; height: 74px; border-radius: 50%; font-size: 26px; font-weight: 700;
  background: rgba(255,255,255,.10); border: 2px solid rgba(255,255,255,.28); color: rgba(255,255,255,.85);
  touch-action: none;
}
.key.on { background: rgba(255,255,255,.32); }
.jump { position: absolute; right: 22px; bottom: 26px; width: 92px; height: 92px; font-size: 22px; background: rgba(255,120,90,.22); border-color: rgba(255,150,110,.5); }

/* (旧的"请横屏"提示已移除:竖屏时舞台自动旋转 90°) */
