* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden; background: #0c1116;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #eaeaea; user-select: none; -webkit-user-select: none; touch-action: none;
}
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* HUD */
#hud {
  position: absolute; top: 0; left: 0; right: 0; height: 64px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
  pointer-events: none;
}
#hud .panel {
  pointer-events: auto; min-width: 92px; padding: 6px 10px; border-radius: 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
}
#hud .panel.right { text-align: right; }
#hud .panel.active { background: rgba(80,180,120,.28); border-color: #4fd08a; }
#hud .name { font-size: 13px; opacity: .9; }
#hud .group { font-size: 12px; margin-top: 2px; color: #ffd66b; }
#hud .center { flex: 1; text-align: center; }
#hud #turnTip { font-size: 14px; font-weight: 600; }
#hud #msg { font-size: 12px; margin-top: 4px; min-height: 16px; color: #ffd66b; }
#hud #btnMenu {
  pointer-events: auto; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
#hud #btnSound {
  pointer-events: auto; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 8px 10px; font-size: 15px;
}

/* 遮罩（结算 / 网络） */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5,8,12,.72); backdrop-filter: blur(2px); z-index: 40; padding: 16px;
}
.overlay .card {
  width: min(360px, 88vw); background: rgba(20,28,38,.96); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 24px; text-align: center;
}
.overlay #overTitle { font-size: 22px; font-weight: 700; }
.overlay .sub { font-size: 13px; opacity: .75; margin-top: 8px; }
.overlay #netStatus { font-size: 16px; }
.overlay .modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.overlay .modes button {
  background: linear-gradient(180deg, #2f7d52, #246343); color: #fff; border: none;
  border-radius: 12px; padding: 13px 10px; font-size: 15px; font-weight: 600;
}
.overlay .modes button.ghost2 { background: rgba(255,255,255,.12); }

/* 菜单 */
#menu {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #16324a, #0a0f15);
  padding: 16px;
}
#menu .card {
  width: min(440px, 92vw); background: rgba(20,28,38,.9); border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px; padding: 22px; text-align: center;
}
#menu h1 { font-size: 24px; letter-spacing: 1px; }
#menu .sub { font-size: 13px; opacity: .7; margin: 8px 0 18px; }
#menu .modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#menu button {
  background: linear-gradient(180deg, #2f7d52, #246343); color: #fff; border: none;
  border-radius: 12px; padding: 14px 10px; font-size: 15px; font-weight: 600; cursor: pointer;
}
#menu button:active { transform: translateY(1px); }
#menu #joinBtn { grid-column: 1 / -1; background: linear-gradient(180deg, #3a6ea5, #2f568a); }
#onlineBox { margin-top: 12px; display: flex; gap: 8px; }
#onlineBox input {
  flex: 1; background: #0e1620; border: 1px solid rgba(255,255,255,.2); color: #fff;
  border-radius: 10px; padding: 12px; font-size: 18px; text-align: center; letter-spacing: 4px; text-transform: uppercase;
}
#onlineBox button {
  background: linear-gradient(180deg, #3a6ea5, #2f568a); color: #fff; border: none;
  border-radius: 10px; padding: 12px 16px; font-weight: 600;
}
#diffBox { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
#diffBox .difflabel { font-size: 14px; opacity: .85; }
#diffBox button {
  flex: 1; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px; padding: 11px 0; font-weight: 600;
}
#diffBox button.sel { background: linear-gradient(180deg, #2f7d52, #246343); border-color: transparent; }
#roomInfo { margin-top: 16px; }
#roomInfo .code {
  font-size: 40px; letter-spacing: 10px; font-weight: 800; color: #ffd66b; margin: 6px 0;
}
#roomInfo #roomStatus { font-size: 13px; opacity: .8; }
#menu .hint { margin-top: 16px; font-size: 12px; opacity: .6; line-height: 1.5; }

/* 竖屏提示 */
#rotateHint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #0a0f15; text-align: center; font-size: 16px; padding: 24px; z-index: 50;
}
