/* 联机大富翁 & 飞行棋 — 样式 */
:root {
  --bg: #F3E6C8;
  --bg-deep: #E8D4A8;
  --ink: #1A1A2E;
  --muted: #5C5470;
  --board: #1B4D3E;
  --board-2: #245c4a;
  --gold: #D4A017;
  --gold-2: #F0C548;
  --red: #E74C3C;
  --yellow: #F1C40F;
  --green: #27AE60;
  --blue: #3498DB;
  --card: #FFF8E7;
  --line: rgba(26, 26, 46, 0.12);
  --shadow: 0 8px 28px rgba(26, 26, 46, 0.12);
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(212, 160, 23, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(27, 77, 62, 0.12), transparent 45%),
    var(--bg);
  min-height: 100%;
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.hidden { display: none !important; }

/* ===== 触控基础 ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, a, input, select, textarea, .game-opt, .avatar-opt, .seat {
  touch-action: manipulation;
}
input, textarea {
  -webkit-user-select: text;
  user-select: text;
  font-size: 16px;
}
.btn-primary { min-height: 44px; }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(255, 248, 231, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand .dice-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  display: grid; place-items: center;
  color: #fff; font-size: 18px; font-weight: 900;
  box-shadow: 0 3px 0 #8a6508;
}
.user-chip { display: flex; align-items: center; gap: 12px; font-size: 0.92rem; }
.user-chip .name { font-weight: 700; }
.user-chip .wins {
  background: var(--board); color: var(--gold);
  padding: 2px 10px; border-radius: 999px; font-size: 0.8rem;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; font-weight: 700;
  transition: transform .12s ease, box-shadow .12s ease, background .12s, filter .12s;
  touch-action: manipulation;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.is-press { transform: translateY(2px) scale(0.96); filter: brightness(1.05); }
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #c4920f);
  color: #fff; box-shadow: 0 3px 0 #8a6508, var(--shadow);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-dark { background: var(--board); color: var(--gold); box-shadow: 0 3px 0 #0f2e25; }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 3px 0 #922b21; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

/* ===== 登录 ===== */
#view-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(420px, 100%);
  padding: 36px 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue), var(--gold));
}
.auth-card h1 { font-size: 1.8rem; margin: 8px 0 4px; letter-spacing: 0.04em; }
.auth-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 0.95rem; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 18px;
  background: var(--bg-deep); padding: 4px; border-radius: 999px;
}
.auth-tabs button { padding: 10px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.auth-tabs button.active {
  background: var(--card); color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; outline: none;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,.2); }
.auth-error { color: var(--red); font-size: 0.88rem; min-height: 1.2em; margin-bottom: 10px; }
.auth-pawns { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; }
.pawn {
  width: 18px; height: 18px; border-radius: 50% 50% 45% 45%;
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}
.pawn.red { background: var(--red); }
.pawn.yellow { background: var(--yellow); }
.pawn.green { background: var(--green); }
.pawn.blue { background: var(--blue); }

/* ===== 大厅 / 房间 ===== */
#view-lobby { padding: 28px 20px 40px; max-width: 1100px; margin: 0 auto; width: 100%; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; }
@media (max-width: 800px) { .lobby-grid { grid-template-columns: 1fr; } }
.game-picker { padding: 22px; }
.game-picker h2 { font-size: 1.2rem; margin-bottom: 6px; }
.game-picker .hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.game-options { display: grid; gap: 12px; }
.game-opt {
  display: flex; gap: 14px; align-items: center;
  padding: 14px; border: 2px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, background .15s; background: #fff;
}
.game-opt:hover { border-color: var(--gold); }
.game-opt.selected { border-color: var(--gold); background: rgba(212,160,23,.1); }
.game-opt .icon {
  width: 56px; height: 56px; border-radius: 12px;
  display: grid; place-items: center; font-size: 28px; background: var(--bg-deep);
}
.game-opt .icon.mono { background: #2d6a4f; }
.game-opt .icon.ludo {
  background: conic-gradient(var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0);
}
.game-opt strong { display: block; font-size: 1.05rem; }
.game-opt span { color: var(--muted); font-size: 0.85rem; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.lobby-actions select, .lobby-actions input {
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
.room-list-panel { padding: 22px; display: flex; flex-direction: column; min-height: 320px; }
.room-list-panel h2 {
  font-size: 1.2rem; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.room-items { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow: auto; max-height: 420px; }
.room-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; gap: 10px;
}
.room-item .meta { display: flex; flex-direction: column; gap: 2px; }
.room-item .code {
  font-weight: 800; letter-spacing: 0.12em; font-family: ui-monospace, monospace;
}
.room-item .tags { color: var(--muted); font-size: 0.82rem; }
.empty-tip { color: var(--muted); text-align: center; padding: 40px 10px; }

#view-room { padding: 28px 20px; max-width: 900px; margin: 0 auto; width: 100%; }
.room-header {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 22px; margin-bottom: 16px;
}
.room-code-box { display: flex; align-items: center; gap: 12px; }
.room-code-box .code {
  font-family: ui-monospace, monospace;
  font-size: 2rem; font-weight: 800; letter-spacing: 0.18em; color: var(--board);
}
.seat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; padding: 18px;
}
.seat {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: #fff;
}
.seat.filled { border-style: solid; }
.seat .pawn { width: 28px; height: 28px; }
.seat .n { font-weight: 700; }
.seat .s { font-size: 0.8rem; color: var(--muted); }
.seat .s.ready { color: var(--green); font-weight: 700; }
.room-toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 4px 8px; }
.chat-box { padding: 16px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-log {
  height: 140px; overflow: auto; background: rgba(0,0,0,.03);
  border-radius: 10px; padding: 10px 12px; font-size: 0.9rem;
}
.chat-log .sys { color: var(--muted); font-style: italic; }
.chat-row { display: flex; gap: 8px; }
.chat-row input {
  flex: 1; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}

/* ===== 对局 ===== */
#view-game { padding: 12px 12px 20px; width: 100%; max-width: 100vw; overflow-x: hidden; }
.game-layout {
  display: grid;
  grid-template-columns: 210px minmax(360px, 760px) 210px;
  gap: 14px;
  justify-content: center;
  align-items: start;
}
@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
.side-col { display: flex; flex-direction: column; gap: 12px; }

.player-card { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.player-card.active { outline: 3px solid var(--gold); animation: activePulse 1.4s ease infinite; }
@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,160,23,.35); }
  50% { box-shadow: 0 0 0 8px rgba(212,160,23,0); }
}
.player-card .row { display: flex; align-items: center; gap: 10px; }
.player-card .name { font-weight: 700; flex: 1; }
.player-card .money { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--board); font-size: 1.15rem; }
.player-card .money.neg { color: var(--red); }
.player-card .worth {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 0.78rem; color: var(--muted);
  padding: 4px 8px; border-radius: 8px;
  background: rgba(27, 77, 62, 0.06);
  font-variant-numeric: tabular-nums;
}
.player-card .worth strong { color: var(--ink); font-weight: 700; }
.player-card .worth .v-good { color: var(--green); }
.player-card .worth .v-warn { color: var(--orange, #E67E22); }
.player-card .fin {
  display: flex; flex-direction: column; gap: 4px;
}
.player-card .sub { font-size: 0.8rem; color: var(--muted); }
.player-card.bankrupt { opacity: 0.5; }

/* 房产明细 */
.prop-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 160px; overflow: auto;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.prop-list:empty::after {
  content: '暂无地产';
  color: var(--muted); font-size: 0.75rem; text-align: center; padding: 6px 0;
}
.prop-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
  border-left: 4px solid #999;
  font-size: 0.75rem;
  line-height: 1.2;
}
.prop-chip .pname {
  flex: 1; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prop-chip .hs {
  letter-spacing: -1px; font-size: 0.7rem;
}
.prop-chip .pval {
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.7rem;
}
.prop-chip.c-brown { border-left-color: #8B5A2B; }
.prop-chip.c-lightblue { border-left-color: #5DADE2; }
.prop-chip.c-pink { border-left-color: #F1948A; }
.prop-chip.c-orange { border-left-color: #E67E22; }
.prop-chip.c-red { border-left-color: #E74C3C; }
.prop-chip.c-yellow { border-left-color: #F4D03F; }
.prop-chip.c-green { border-left-color: #27AE60; }
.prop-chip.c-darkblue { border-left-color: #2874A6; }
.prop-chip.c-rail { border-left-color: #5D6D7E; }
.prop-chip.hotel { background: #fff5f5; }
.prop-chip .deed-mini {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}

.piece-detail {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.piece-pill {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.piece-pill.done { background: #d5f5e3; border-color: var(--green); color: var(--green); font-weight: 700; }
.piece-pill.home { color: var(--muted); }
.piece-pill.run { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.piece-pill.dead {
  background: #fdecea; border-color: var(--red); color: var(--red);
  text-decoration: line-through; opacity: .75;
}

.money-pop { animation: moneyPop .45s ease; display: inline-block; }
@keyframes moneyPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); color: var(--green); }
  100% { transform: scale(1); }
}
.money-pop.down { animation-name: moneyDown; }
@keyframes moneyDown {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); color: var(--red); }
  100% { transform: scale(1); }
}

/* 棋子状态栏 */
.piece-roster {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.piece-roster .roster-title {
  font-size: 0.85rem; font-weight: 800; color: var(--muted);
  letter-spacing: 0.06em;
}
.roster-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.roster-player {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.roster-player.is-turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212,160,23,.2);
}
.roster-player.is-out {
  opacity: 0.55;
  background: #f3f0ea;
}
.roster-player.is-win {
  border-color: var(--green);
  background: #f0faf3;
}
.roster-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px; font-size: 0.8rem; font-weight: 800;
}
.roster-head .dot {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.roster-head .pname {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.roster-head .pstat {
  font-size: 0.68rem; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: var(--bg-deep); color: var(--muted);
}
.roster-head .pstat.s-ok { background: #d5f5e3; color: var(--green); }
.roster-head .pstat.s-turn { background: rgba(212,160,23,.2); color: var(--gold); }
.roster-head .pstat.s-out { background: #fdecea; color: var(--red); }
.roster-head .pstat.s-win { background: #d5f5e3; color: var(--green); }

.roster-pieces {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.rpiece {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.68rem;
  padding: 3px 5px;
  border-radius: 6px;
  background: var(--bg-deep);
  font-variant-numeric: tabular-nums;
}
.rpiece .pno { font-weight: 800; color: var(--muted); width: 1.2em; }
.rpiece .pst { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpiece.s-base { opacity: 0.75; }
.rpiece.s-run { background: #fff6d6; }
.rpiece.s-home { background: #e8f1ff; }
.rpiece.s-done { background: #d5f5e3; color: var(--green); font-weight: 700; }
.rpiece.s-dead { background: #fdecea; color: var(--red); text-decoration: line-through; }
.rpiece.s-vet::after { content: '★'; color: var(--gold); margin-left: 2px; }

/* 聊天 / 操作日志 */
.chat-log .log-act {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px;
  padding: 5px 8px; margin: 2px 0;
  border-radius: 8px;
  background: rgba(27, 77, 62, 0.05);
  border-left: 3px solid var(--gold);
  font-size: 0.82rem;
}
.chat-log .log-act .lg-icon { font-size: 0.9rem; }
.chat-log .log-act .lg-actor { font-weight: 800; color: var(--board); }
.chat-log .log-act .lg-act {
  font-weight: 700; color: var(--gold);
  background: rgba(212, 160, 23, 0.12);
  padding: 1px 6px; border-radius: 999px; font-size: 0.72rem;
}
.chat-log .log-act .lg-res {
  flex: 1 1 100%;
  color: var(--ink); opacity: 0.9;
  padding-left: 2px;
}
.chat-log .log-act.f-good { border-left-color: var(--green); }
.chat-log .log-act.f-bad { border-left-color: var(--red); }
.chat-log .log-act.f-chance { border-left-color: var(--gold); }
.chat-log .log-act .lg-time {
  margin-left: auto; font-size: 0.68rem; color: var(--muted);
}

.game-center { display: flex; flex-direction: column; gap: 12px; align-items: stretch; position: relative; min-width: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
.board-wrap {
  background: var(--board);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow);
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  cursor: default;
}
.board-wrap.dragging { cursor: grabbing; user-select: none; }
.board-inner { width: 100%; min-width: 0; max-width: 560px; margin: 0 auto; }
.board-wrap svg, .board-wrap canvas {
  width: 100%; height: 100%; display: block; border-radius: 10px;
}

.action-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 12px; min-height: 64px;
}
.action-dock {
  display: flex; flex-direction: column; gap: 8px;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.chat-box.collapsed .chat-log,
.chat-box.collapsed .chat-row { display: none; }
.event-toast {
  text-align: center; padding: 10px 14px;
  background: rgba(27, 77, 62, 0.08);
  border-radius: 12px; font-size: 0.95rem; min-height: 2.6em;
}
.event-toast.bump { animation: eventBump .4s ease; }
@keyframes eventBump {
  0% { transform: scale(.98); background: rgba(212,160,23,.25); }
  100% { transform: scale(1); }
}
.event-toast.f-good { box-shadow: inset 0 0 0 2px rgba(39,174,96,.45); }
.event-toast.f-bad { box-shadow: inset 0 0 0 2px rgba(231,76,60,.45); }
.event-toast.f-chance { box-shadow: inset 0 0 0 2px rgba(212,160,23,.55); }

/* 事件悬浮卡（掷骰后悬停，便于阅读） */
.event-float {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: min(320px, 92%);
  max-width: min(420px, 94%);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(27, 77, 62, 0.96);
  color: #F5EBD0;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  border: 1px solid rgba(212, 160, 23, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.9,.3,1.15);
  backdrop-filter: blur(8px);
}
.event-float.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.event-float.k-good { border-color: rgba(39,174,96,.7); background: rgba(27, 77, 62, 0.96); }
.event-float.k-bad { border-color: rgba(231,76,60,.75); background: rgba(74, 28, 28, 0.95); }
.event-float.k-chance { border-color: rgba(212,160,23,.85); }
.event-float.k-move { border-color: rgba(52,152,219,.7); }
.ef-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.ef-body { flex: 1; min-width: 0; }
.ef-actor-row {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.ef-actor {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--gold-2, #F0C548);
  background: rgba(212, 160, 23, 0.18);
  border: 1px solid rgba(212, 160, 23, 0.45);
  padding: 2px 10px;
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ef-actor:empty { display: none; }
.ef-actor .ef-avatar {
  width: 1.15em; height: 1.15em;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: inline-grid; place-items: center;
  font-size: 0.75em;
}
.ef-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.8;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
}
.ef-text {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.ef-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.12);
  color: #F5EBD0;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.ef-close:active { background: rgba(255,255,255,.22); }





/* 交换地块选择器 */
.swap-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
.swap-head {
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.swap-list {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.swap-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
}
.swap-opt .n { font-weight: 700; font-size: 0.88rem; }
.swap-opt .m { font-size: 0.72rem; color: var(--muted); }
.swap-opt.sel,
.swap-opt:hover {
  border-color: var(--gold);
  background: rgba(212,160,23,0.12);
}
.swap-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 480px) {
  .swap-picker { grid-template-columns: 1fr; }
  .swap-list { max-height: 160px; }
}

/* ===== 大富翁 / 飞行棋 棋盘（统一布局） ===== */
.game-center {
  display: flex; flex-direction: column; gap: 12px;
  align-items: stretch; position: relative;
  min-width: 0; width: 100%; max-width: 100%;
}
.board-wrap {
  background: var(--board);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.board-inner { width: 100%; max-width: 560px; margin: 0 auto; }
.board-wrap svg { width: 100%; height: auto; display: block; border-radius: 8px; }

/* 大富翁 8×8 蛇形 */
.mono-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 1;
  background: #143d32;
  border-radius: 8px;
}
.mono-cell {
  background: var(--card);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  font-size: 0.58rem;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
}
.mono-cell .band { height: 18%; min-height: 6px; }
.mono-cell .tile-icon { text-align: center; line-height: 1; margin-top: 1px; }
.mono-cell .tile-icon .glyph { font-size: 0.95rem; }
.mono-cell .nm {
  flex: 1;
  text-align: center;
  font-weight: 700;
  padding: 0 2px;
  line-height: 1.15;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.mono-cell .price {
  text-align: center; font-size: 0.52rem;
  color: var(--muted); font-weight: 800;
  padding-bottom: 2px;
  white-space: nowrap;
}
.mono-cell.corner { background: #e8d4a8; font-weight: 800; }
.mono-cell[data-type="chance"] { background: #fff6d6; }
.mono-cell[data-type="item"] { background: #e8f8ff; }
.mono-cell[data-type="tax"] { background: #fdecea; }
.mono-cell[data-type="gotojail"] { background: #f3d1ff; }
.mono-cell[data-type="jail"] { background: #e8d4a8; }
.mono-cell[data-type="go"] { background: #d5f5e3; }
.mono-cell[data-type="free"] { background: #d6eaf8; }

.house-row { display: flex; justify-content: center; gap: 1px; min-height: 10px; }
.house-mark { width: 10px; height: 10px; display: grid; place-items: center; font-size: 9px; }
.owner-badge {
  position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px; border-radius: 2px;
}
.owner-badge.red, .owner-badge.pink { background: var(--red); }
.owner-badge.yellow { background: var(--yellow); }
.owner-badge.green { background: var(--green); }
.owner-badge.blue { background: var(--blue); }
.owner-badge.orange { background: var(--orange, #E67E22); }
.owner-badge.purple { background: #8e44ad; }
.owner-badge.cyan { background: #16a085; }

.tokens {
  position: absolute; inset: 0;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 1px; padding: 2px; pointer-events: none;
}
.token-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  margin: 10px 2px 0;
  pointer-events: none;
}
.token-name {
  font-size: 0.48rem; font-weight: 800; color: #fff;
  padding: 1px 4px; border-radius: 999px;
  background: #555; max-width: 56px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 1px;
}
.token-wrap .token {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; overflow: hidden;
  display: grid; place-items: center;
}
.token-wrap .token .avatar-img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}

/* 飞行棋 */
.ludo-board {
  width: 100%; height: auto;
  display: block;
}
.ludo-svg { width: 100%; height: auto; display: block; border-radius: 8px; }
.ludo-token-sg { pointer-events: auto; }
.ludo-token-sg.selectable {
  filter: drop-shadow(0 0 6px #F0C548);
  cursor: pointer;
}

/* 飞行棋侧栏 */
.ludo-side {
  background: linear-gradient(180deg, #6FA34A, #547E36);
  border-radius: 12px;
  padding: 16px 14px;
  color: #fff;
  display: flex; flex-direction: column; gap: 14px;
}
.side-title { font-weight: 800; text-align: center; color: #F5EBD0; }
.side-turn {
  text-align: center; font-size: 1.15rem; font-weight: 800;
  color: #E8F5D8;
}
.side-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.btn-side {
  background: #8B3A2A; color: #F5E6C8;
  border: 2px solid #6B2A1E; border-radius: 6px;
  padding: 14px 12px; font-size: 1.15rem; font-weight: 800;
  cursor: pointer;
}

/* token fly 动画层 */
.token-fly {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 15;
}
.token-fly .token,
.token-fly .hop-ghost {
  position: absolute;
  margin: 0;
  transform: translate(-50%, -50%);
  transition: left .16s ease, top .16s ease, transform .16s ease;
  z-index: 16;
}
.token-fly .hop {
  transform: translate(-50%, -50%) scale(1.12);
}
.mono-cell.cell-step { filter: brightness(1.15); }
.mono-cell.cell-land, .ludo-svg .cell-land { filter: brightness(1.25); }

/* 响应式 */
@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr !important; }
  .side-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (max-width: 720px) {
  .board-wrap { padding: 6px; max-width: 100%; }
  .board-inner { max-width: 100%; }
  .mono-board { gap: 2px; font-size: 0.55rem; }
  .mono-cell { font-size: 0.52rem; }
  .mono-cell .tile-icon .glyph { font-size: 0.85rem; }
  .mono-cell .nm { font-size: 0.55rem; }
  .mono-cell .price { font-size: 0.55rem; }
  .token-wrap .token { width: 12px; height: 12px; }
  .token-name { font-size: 0.42rem; max-width: 48px; }
}

/* 头像尺寸约束（防止被父容器撑大） */
.avatar-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 56px;
  max-height: 56px;
  object-fit: cover;
  object-position: center;
  display: block;
}
.avatar-inline {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  max-width: 28px;
  overflow: hidden;
  border-radius: 50%;
  flex-shrink: 0;
}
.avatar-inline .avatar-img {
  max-width: 28px !important;
  max-height: 28px !important;
}
.avatar-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px;
  max-width: 36px;
  overflow: hidden;
  border-radius: 50%;
  padding: 0 !important;
}
.avatar-btn .avatar-img {
  max-width: 36px !important;
  max-height: 36px !important;
}
.seat .avatar-btn {
  width: 48px !important;
  height: 48px !important;
}
.seat .avatar-btn .avatar-img {
  max-width: 48px !important;
  max-height: 48px !important;
}
.token-wrap .token {
  width: 14px !important;
  height: 14px !important;
  overflow: hidden;
}
.token-wrap .token .avatar-img {
  max-width: 14px !important;
  max-height: 14px !important;
}
.rap-item img {
  width: 52px !important;
  height: 52px !important;
  max-width: 52px;
  max-height: 52px;
  object-fit: cover;
  border-radius: 50%;
}

/* 蛇形连线：只连下一格 */
.snake-link {
  background: rgba(212, 160, 23, 0.35);
  border-radius: 2px;
  z-index: 1;
  pointer-events: none;
  min-width: 0; min-height: 0;
}
.snake-link.h {
  height: 4px;
  align-self: center;
  margin: 0 1px;
}
.snake-link.v {
  width: 4px;
  justify-self: center;
  margin: 1px 0;
}
.snake-link.turn {
  width: 40%; height: 4px;
  justify-self: end; align-self: center;
}
.snake-plane {
  z-index: 5;
  display: grid; place-items: center;
  font-size: 1.15rem;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.3));
  animation: planeFly 1.6s ease-in-out infinite;
}
@keyframes planeFly {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(4px, -6px) rotate(8deg); }
}

/* 防抖动：格子等分且不被内容撑开 */
.mono-board {
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(8, minmax(0, 1fr)) !important;
  overflow: hidden;
}
.mono-cell {
  overflow: hidden !important;
  min-width: 0 !important;
  min-height: 0 !important;
  contain: layout;
}
.token-wrap {
  max-width: 100%;
  overflow: hidden;
}

/* ===== 弹窗与卡牌 ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(26,26,46,.45);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  width: min(400px, 100%);
  box-shadow: var(--shadow);
  text-align: center;
  max-height: 85vh;
  overflow: auto;
}
.modal h3 { margin-bottom: 10px; font-size: 1.3rem; }
.modal p { color: var(--muted); margin-bottom: 18px; }

/* 事件悬浮卡 */
.event-float {
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 30;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: min(320px, 92%);
  max-width: min(420px, 94%);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(27, 77, 62, 0.96);
  color: #F5EBD0;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  border: 1px solid rgba(212, 160, 23, 0.55);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.event-float.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.event-float.hidden { display: none !important; }
.ef-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center; font-size: 1.25rem;
  flex-shrink: 0;
}
.ef-body { flex: 1; min-width: 0; }
.ef-actor-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.ef-actor {
  font-size: 1.05rem; font-weight: 900;
  color: var(--gold-2, #F0C548);
  background: rgba(212, 160, 23, 0.18);
  border: 1px solid rgba(212, 160, 23, 0.45);
  padding: 2px 10px; border-radius: 999px;
}
.ef-title {
  font-size: 0.72rem; font-weight: 700;
  opacity: .8; padding: 2px 8px;
  border-radius: 999px; background: rgba(255,255,255,.1);
}
.ef-text { font-size: 0.95rem; font-weight: 600; line-height: 1.35; word-break: break-word; }
.ef-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.12);
  color: #F5EBD0; font-size: 1.1rem; cursor: pointer;
}

/* 翻牌 / 机会卡 */
.game-card {
  width: 220px; height: 320px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2,.8,.3,1.1);
}
.game-card.flipped { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 18px;
  box-shadow: var(--shadow);
}
.card-back {
  background: repeating-linear-gradient(45deg, #1B4D3E 0 10px, #245c4a 10px 20px);
  color: var(--gold); border: 4px solid var(--gold);
}
.card-front {
  transform: rotateY(180deg);
  background: var(--card); border: 4px solid var(--gold);
}
.card-icon { font-size: 3rem; }
.card-title { font-size: 1.25rem; font-weight: 900; }
.card-text { font-size: .88rem; color: var(--muted); text-align: center; }
.card-effect {
  font-size: 1.25rem; font-weight: 900; color: var(--gold);
  padding: 8px 18px; border-radius: 999px;
  background: rgba(212,160,23,.15);
}

/* 刮刮乐 */
.scratch-card {
  width: min(360px, 96vw);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sc-luck { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; }
.sc-luck-bar {
  width: 90px; height: 8px; border-radius: 999px;
  background: var(--bg-deep); overflow: hidden;
}
.sc-luck-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--green));
  width: 60%;
}
.sc-tiers { display: flex; flex-wrap: wrap; gap: 4px; font-size: .68rem; color: var(--muted); }
.sc-tiers span {
  padding: 2px 6px; border-radius: 999px; background: var(--bg-deep);
}
.sc-tiers span.hot {
  background: rgba(212,160,23,.25); color: var(--gold); font-weight: 800;
}
.sc-stage {
  position: relative;
  width: 100%; max-width: 280px; height: 180px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--line);
}
.sc-result {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 10px;
  background: linear-gradient(160deg, #fff6d6, #ffe8a8);
  text-align: center;
}
.sc-tier { font-size: .75rem; font-weight: 800; color: var(--muted); letter-spacing: .12em; }
.sc-icon { font-size: 1.8rem; }
.sc-title { font-size: 1.05rem; font-weight: 900; }
.sc-text { font-size: .78rem; color: var(--muted); padding: 0 8px; }
.sc-effect {
  font-size: 1.15rem; font-weight: 900; color: var(--gold);
  margin-top: 4px;
}
#scCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}
.sc-progress {
  height: 6px; border-radius: 999px;
  background: var(--bg-deep); overflow: hidden;
}
.sc-progress i {
  display: block; height: 100%; width: 0;
  background: var(--gold); border-radius: 999px;
}
.sc-actions { display: flex; gap: 8px; justify-content: center; }
.sc-actions .btn { flex: 1; min-height: 42px; }
.sc-hint { text-align: center; font-size: .72rem; color: var(--muted); }
.scratch-card.revealed #scCanvas {
  opacity: 0; pointer-events: none; transition: opacity .35s ease;
}

/* 飘字 */
.fly-label {
  position: absolute; z-index: 40;
  font-weight: 900; font-size: .95rem;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(255,255,255,.6);
  animation: flyLabel 1s ease forwards;
}
.fly-label.good { color: var(--green); }
.fly-label.bad { color: var(--red); }
.fly-label.gold { color: var(--gold); }
@keyframes flyLabel {
  0% { transform: translate(-50%, 0) scale(.8); opacity: 0; }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); }
  100% { transform: translate(-50%, -48px) scale(1); opacity: 0; }
}

.fx-burst { position: absolute; pointer-events: none; z-index: 30; }
.fx-particle {
  position: absolute; left: 0; top: 0;
  font-size: 14px;
  animation: fxFly .7s ease-out forwards;
}
@keyframes fxFly {
  0% { transform: translate(0, 0) scale(.6); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.3); opacity: 0; }
}

/* 卡片下方按钮居中 */
.card-stage {
  display: flex; flex-direction: column; align-items: center;
  width: 100%;
}
.card-stage .btn {
  margin: 14px auto 0 !important;
  display: inline-flex;
  min-width: 140px;
}
.sc-actions {
  display: flex !important;
  justify-content: center !important;
  align-items: center;
  width: 100%;
  gap: 10px;
}
.sc-actions .btn {
  flex: 0 1 auto;
  min-width: 120px;
}
.modal {
  display: flex; flex-direction: column; align-items: center;
}
.modal .btn { margin: 0 auto; }
.event-float { align-items: center; }
