* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #14233b; color: #eef4fb;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; min-height: 100dvh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- 通用按钮 ---------- */
.btn {
  background: #1f3552; border: 1px solid #33517a; color: #eef4fb;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: background .15s;
}
.btn:hover { background: #2a4568; }
.btn.primary { background: #3e7d4f; border-color: #4f9a62; }
.btn.primary:hover { background: #4f9a62; }
.btn.danger { background: #7d3e3e; border-color: #9a4f4f; }
.btn.wide { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.pill {
  background: transparent; border: 1px solid #33517a; color: #a9c0dd;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
}
.pill.on { background: #3e7d4f; border-color: #4f9a62; color: #fff; }

/* ---------- 表单 ---------- */
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 12px; color: #8aa4c4; margin-bottom: 6px; letter-spacing: .05em; }
.inp {
  width: 100%; padding: 10px 12px; background: #0e1a2e; border: 1px solid #33517a;
  border-radius: 10px; color: #eef4fb; outline: none;
}
.inp:focus { border-color: #4f9a62; }
.inp.code { text-transform: uppercase; letter-spacing: .2em; text-align: center; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c6d5e8; cursor: pointer; }
.hint { color: #8aa4c4; font-size: 12px; margin: 8px 0 0; }
.err { color: #ff8a8e; font-size: 13px; margin: 8px 0 0; }

/* ---------- 大厅 ---------- */
.lobby-head { padding: 28px 20px 8px; }
.brand { font-size: 22px; font-weight: 700; }
.lobby-sub { color: #8aa4c4; font-size: 13px; margin-top: 4px; }
.lobby-grid { padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.game-card {
  background: #1d3350; border: 1px solid #33517a; border-radius: 16px;
  padding: 26px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.game-card:hover { background: #263f60; }
.game-icon { font-size: 44px; }
.game-name { font-size: 15px; font-weight: 600; }

/* ---------- 游戏页 ---------- */
.game-root { min-height: 100dvh; display: flex; flex-direction: column; }
.game-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: #0e1a2e; border-bottom: 1px solid #1f3552;
  position: sticky; top: 0; z-index: 10;
}
.g-left { min-width: 0; display: flex; flex-direction: column; }
.g-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sub { color: #8aa4c4; font-size: 12px; }
.g-right { display: flex; gap: 8px; flex: none; }

#playView { position: relative; flex: 1; display: flex; flex-direction: column; }
#playCanvas { width: 100%; height: calc(100dvh - 150px); display: block; }
.play-hud { display: flex; gap: 16px; padding: 10px 16px; }
.hud { font-size: 13px; color: #a9c0dd; }
.hud b { color: #fff; font-size: 16px; }
.tap-hint { text-align: center; color: #8aa4c4; font-size: 12px; padding-bottom: 10px; }

#panoView { flex: 1; padding: 12px 16px 24px; }
#panoCanvas { width: 100%; border-radius: 14px; display: block; }
.pano-meta { margin-top: 10px; }
.meta-line { font-size: 13px; color: #c6d5e8; }
.meta-line b { color: #fff; }

.tabs { display: flex; gap: 8px; margin: 14px 0 10px; }
.tabs button {
  background: transparent; border: 1px solid #33517a; color: #a9c0dd;
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
}
.tabs button.on { background: #3e7d4f; border-color: #4f9a62; color: #fff; }
.board { background: #0e1a2e; border: 1px solid #1f3552; border-radius: 12px; overflow: hidden; }
.brow { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #1a2c44; font-size: 14px; }
.brow:last-child { border-bottom: 0; }
.brank { color: #8aa4c4; width: 24px; flex: none; }
.bname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bval { color: #ffd66b; font-weight: 600; }
.empty { color: #8aa4c4; padding: 16px; text-align: center; font-size: 13px; }
.pano-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pano-actions .btn { flex: 1; min-width: 90px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; }
.veil { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet {
  position: relative; width: 100%; max-width: 430px; max-height: 90dvh; overflow-y: auto;
  background: #14233b; border: 1px solid #2a4568; border-radius: 18px;
  padding: 18px 18px 20px;
}
.sheet.narrow { max-width: 340px; }
.sheet.center { text-align: center; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-h h2 { margin: 0; font-size: 16px; }
.sheet-f { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.x { background: none; border: 0; color: #8aa4c4; font-size: 16px; }
.q-prompt { font-size: 16px; margin: 0 0 14px; }
.opt {
  display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 12px 14px;
  background: #1d3350; border: 1px solid #33517a; border-radius: 12px; color: #eef4fb; font-size: 15px;
}
.opt:hover { background: #263f60; }
.wheel { font-size: 56px; font-weight: 800; color: #ffd66b; }
.wheel-text { color: #c6d5e8; margin: 8px 0 16px; }

/* ---------- 后台 ---------- */
.center-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel { background: #0e1a2e; border: 1px solid #1f3552; border-radius: 14px; padding: 16px; margin: 14px 16px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: #8aa4c4; }
.stat { display: inline-block; background: #1d3350; border-radius: 10px; padding: 10px 14px; margin: 4px; font-size: 13px; color: #c6d5e8; }
.stat b { color: #fff; font-size: 18px; display: block; }
.breaker.green { color: #7ee2a0; } .breaker.yellow { color: #ffd66b; } .breaker.red { color: #ff8a8e; }
.table { display: flex; flex-direction: column; }
.trow { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid #1a2c44; font-size: 13px; flex-wrap: wrap; }
.trow .mono { font-family: ui-monospace, Consolas, monospace; color: #ffd66b; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #eef4fb; color: #14233b; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 99;
}

@media (min-width: 768px) {
  .lobby-grid { max-width: 900px; margin: 0 auto; }
  .game-root { max-width: 720px; margin: 0 auto; border-left: 1px solid #1f3552; border-right: 1px solid #1f3552; }
  #playCanvas { height: calc(100dvh - 150px); }
}
